Each successive generation of Raspberry Pi has brought something new to the table. The latest release, the Raspberry Pi 4, is no exception, upgrading the low-cost single-board computer to include true gigabit Ethernet connectivity, a high-performance 64-bit central processor, more powerful graphics processor, and up to 4GB of RAM.
Even with these impressive-for-the-price specifications, though, there’s something the Raspberry Pi can’t easily do unaided: deep learning and other artificial intelligence workloads. With an explosion of interest in AI-at-the-edge, though, there’s a market for Raspberry Pi add-ons which offer to fill in the gap - and the Grove AI HAT is just such a device, billed by creator Seeed Studio as ideal for AI projects in fields from hobbyist robotics to the medical industry.
The question is: does it deliver on its lofty promises, despite a sub-$30 price tag?
An Intro to RISC-V
Before getting into the nitty gritty of the Grove AI HAT itself, there’s something that makes it stand out from competition like Google’s Coral AI Accelerator - a USB-connected variant of the company’s in-house Tensor Processing Unit (TPU) chips, designed to accelerate deep-learning performance on any device with a USB port - and that’s the instruction set architecture (ISA) in use. Where a lot of accelerator devices - known in the early days of computing as co-processors, or coppers - are either based on graphics processing unit (GPU) technology or proprietary chip designs, the Grove AI HAT uses something different: RISC-V.
Originally developed at the University of California, Berkeley, RISC-V - pronounced “risk five,” with RISC standing for “reduced instruction set computing” - isn’t very old: the first version of the ISA was released in 2010. It’s generating considerable interest, though, and for a very good reason: it’s free-as-in-speech, licensed in such a way that anyone is able to build a processor from the specification, modified or otherwise, and sell it. With licenses for proprietary ISAs like x86 and Arm - holding the majority shares of the mainstream computing and smartphone markets respectively - costing millions of dollars in fees plus royalties on top, that’s a tempting proposition.
Early adopters of RISC-V were, naturally, academics. In the years since its public release, though, it has won considerable support in the industry: Western Digital, which has released its own RISC-V core under a permissive license, uses RISC-V for storage processing products; Nvidia for logic chips in its graphics processing products plus as an IO core for its high-performance prototype research processor RC18; Rambus has baked RISC-V into some of its security products; and human-machine interface specialist Synaptics has begun shifting to RISC-V parts too.
RISC-V, its proponents claim, scales remarkably well. Implementations of the ISA are being developed by teams around the world for everything from ultra-low-power embedded microcontrollers to many-core chips aimed at high-performance computing (HPC). Some are released under permissive licenses, just like the ISA itself; others remain proprietary, a freedom of choice permitted by the terms of the RISC-V license.
A Thinking Cap for your Raspberry Pi?
The reason for the modern history lesson: the Grove AI HAT is based on the RISC-V ISA, courtesy of a Kendryte K210 system-on-chip hidden under a metal heatspreader. This SoC includes two 64-bit RISC-V processor cores running at 400MHz or 600MHz depending on user preference and a custom “Kendryte Processing Unit” (KPU) co-processor which offers a claimed performance of 230 billion matrix multiplication operations per second (GMULps).
The Kendryte K210 has then been taken on by a company called Sipeed, which built what it calls the Maix M1 AI Module around it. This unlocks the functionality of the K210 SoC and adds a few features of its own, providing access to a fast Fourier transform accelerator and an audio co-processor capable of driving eight microphones simultaneously.
It’s this module that Seeed Studio, the third company to be involved in the development of this particular product, has taken to power the Grove AI HAT itself. Seed’s contribution: a carrier board for the module which connects to a Raspberry Pi via the GPIO header and includes six Grove-format connectors for external hardware - of which one offers digital input/output (IO), one pulse-width modulated (PWM) IO, one access to an I²C bus, one a UART bus, and two analogue-to-digital conversion (ADC). There’s also a connector for an LCD display, and another for a camera, plus a USB Type-C connector, and a single built-in microphone.
Installation and First Use
The hardware side of installation is straightforward: a bundled booster header slides through a passthrough header on the Grove AI HAT, then mates with the Raspberry Pi’s GPIO header. Mounting holes matching those of a full-size Raspberry Pi board are included in the HAT’s design, but standoffs are not supplied; the full-size HAT rests on the USB ports, however, remaining fairly stable in use.
The booster header’s pins are lengthy and provide access to the unused GPIO pins for adding additional hardware, which is handy. What’s less handy is the documentation, which fails to make it clear which pins are used by the AI HAT and which are available for use with alternative hardware.
The documentation does, however, walk through the installation of the software required to use the Grove AI HAT: the Arduino IDE. The first two example projects on the Seeed Studio site are based purely on using the Grove aspect of the HAT, turning it into a RISC-V-based microcontroller. They also reveal a somewhat surprising aspect of the HAT: unlike most Raspberry Pi add-on boards, it’s entirely functional as a standalone microcontroller board.
Using the Grove AI HAT with the Arduino IDE is no more difficult than using any other non-standard Arduino-compatible board: a custom board definition is loaded into the IDE’s settings screen, then the complete toolchain downloaded. Programs written for the Grove AI HAT in the Arduino IDE look, by and large, no different from any other Arduino program, and are uploaded in the same way: via the USB port, which both powers the board and provides two-way data communication.
So far, though, there’s not much in the way of AI in the AI HAT - which is where Seeed’s third and final sample project comes into play.
The AI Fly in the Ointment
The only AI-focused project for the Grove AI HAT, at the time of writing, starts off in a promising manner: it details how to use the board as an actual Raspberry Pi add-on, rather than a standalone development board, to detect faces in a video stream and provide a running tally. It’s fairly basic stuff, but the Sipeed Maix M1 AI Module isn’t exactly a powerhouse: the board only includes 6MB of static RAM plus an additional 2MB dedicated to the KPU co-processor.
Anyone who has bought the bare board is in for a nasty surprise: the project mandates the use of a custom camera module and small LCD panel - optional extras priced at $7.60 and $6.90 respectively - which connect to the ports on the Grove AI HAT itself. Without these, there’s no way to complete the build - which leads onto the next issue.
For all that it’s sold as a HAT - an acronym standing for Hardware Attached on Top, a standard put together by the Raspberry Pi Foundation which mandates both the shape and size of a given board along with the presence of an EEPROM through which the board can communicate its capabilities to the Raspberry Pi - the Grove AI HAT is remarkably disconnected from the Raspberry Pi itself. The reason the face-recognition project requires a special camera is that the HAT has no way to access the video feed from a Raspberry Pi Camera Module hooked into the Pi’s CSI connector; the LCD panel, meanwhile, is needed as there’s no way to feed video from the Grove AI HAT’s own camera connector to the Raspberry Pi’s display connectors.
The disconnect doesn’t only exist in hardware, either. At the time of writing, Kendryte - responsible for the K210 SoC Sipeed used to build the Maix M1 AI Module which Seeed Studio then used to build the Grove AI HAT - hadn’t released a toolchain for Arm processors. The result: while you can install the Arduino IDE on the Raspberry Pi, you can’t compile any programs for the K210 nor upload them to the Grove AI HAT. This is made clear in the face recognition project instructions, where programming of the HAT needs to take place on a traditional x86 desktop or laptop prior to its connection to the Raspberry Pi.
The actual AI aspect, in fact, comes straight from Kendryte’s GitHub repository. Seeed Studio’s documentation doesn’t even attempt to describe how it works: instead, it concentrates purely on how to compile and upload the pre-written face recognition project to the Grove AI HAT. A separate instruction page details how to use a modified version of the project with a custom counter program that runs on the Raspberry Pi - and which is supplied as a precompiled binary, making it entirely useless as a means of learning how to write your own programs for the Grove AI HAT.
The best you can say about the demo application is that it’s functional: it does, indeed, recognize faces as they are presented to the camera, ringing them in the live video feed on the LCD and notifying the Raspberry Pi that another face has been seen so it can increment its counter. It’s just that’s all it does: you can’t transfer a still or video image from the HAT to the Raspberry Pi, and with no storage and only 8MB total RAM on the HAT expanding the project to do something useful like record a clip of visitors or match faces to a recognition database isn’t an option. In short, it’s more a face counter than a facial recognition program.
The Grove AI HAT is clever, there’s no denying it. It’s also affordable. Sadly, that affordability comes at too high a price. By disconnecting the K210 processor from the Raspberry Pi, and relying entirely on the low-speed GPIO header for the small amounts of communication the two devices can perform, Seeed Studio has taken what appears to be marketed as a co-processor for AI workloads and turned it into little more than a souped-up Arduino-compatible board.
Without an Arm toolchain from Kendryte, there’s no way to program the Grove AI HAT from a Raspberry Pi. The only AI-focused project on Seeed’s site handily demonstrates the limitations even when you’re happy to program the HAT from a different computer, too: the Raspberry Pi is left doing nothing other than incrementing a counter, oblivious to the video feed or AI workload being carried out on the Grove AI HAT.
There’s also no way to access the K210 directly from the Raspberry Pi, meaning it’s not possible to use the Grove AI HAT as a true accelerator or co-processor, nor to use it to accelerate common workloads like TensorFlow and Caffee, and while Seeed’s engineers say they’re looking into the possibility it’s likely to hinge on Kendryte deciding to develop an Arm-compatible toolchain - and even then will be sorely constrained by the slow peak throughput available from the Raspberry Pi’s GPIO header.
As a standalone development board, the Grove AI HAT is more interesting. Divorced from any promise of bringing AI acceleration to the Raspberry Pi, the Grove AI HAT is a low-cost board - though don’t forget to factor in the proprietary camera and LCD panel add-ons - with some very interesting hardware on it. It’s not the only K210-based board out there, though, and certainly not the cheapest - even from Seeed Studio itself - and has no on-board networking for communication with the outside world.
It’s the documentation that’s the real let-down, however. There’s no attempt made to walk the user through actually creating their own AI programs, simply downloading and running someone else’s - and providing the Raspberry Pi half of the face recognition project as a precompiled binary means you can’t even take a look at the code and try to figure it out yourself, short of reverse-engineering it.
For anyone looking to accelerate traditional deep-learning workloads on the Raspberry Pi, the Grove AI HAT is useless; look into Google’s admittedly considerably more expensive Coral USB Accelerator instead, or even abandon the Raspberry Pi platform and move to Nvidia’s AI-focused Jetson Nano.
Image Credits: Gareth Halfacree
MORE: All Raspberry Pi Content
MORE: Raspberry Pi Projects and Guides
That amount of RAM is the real deal-breaker. Any interesting AI model is going to be much larger. So, even if they sort out the software issues and you use a USB link for the Pi to have some decent bandwidth communication with the hat, it's ultimately going to be limited by that RAM.
I wonder if they designed the hardware without knowing enough about how it should be used. Then, when they realized it wasn't going to be very useful, just shoved the thing out the door to try and recoup some of their up-front costs.