Adafruit is very well known in the maker and electronics community. For 15 years the New York-based company has provided kits and boards for Arduino, Beaglebone and Raspberry Pi and their latest board is the $39.95 BrainCraft HAT. Designed for use with the Raspberry Pi 4, this HAT is a hub of inputs and outputs, including a screen that shows image recognition, to facilitate machine learning Raspberry Pi projects.
If you are keen to try out machine learning projects using TensorFlow Lite then the Raspberry Pi 4 is the ideal machine for taking your first steps. It is cheap to buy, has plenty of power and adaptable to your needs. The BrainCraft HAT provides a low friction means with which we can learn a new skill with very little outlay.
We got hands on with the BrainCraft HAT and learned all of its secrets.
BrainCraft HAT Hardware Specifications
- 1.54" IPS TFT display with 240x240 resolution that can show text or video
- Stereo speaker ports for audio playback - either text-to-speech, alerts or for creating a voice assistant.
- Stereo headphone out for audio playback through a stereo system, headphones, or powered speakers.
- Stereo microphone input - perfect for making your very own smart home assistants
- Two 3-pin JST STEMMA connectors that can be used to connect more buttons, a relay, or even some NeoPixels!
- STEMMA QT plug-and-play I2C port, can be used with any of our 50+ I2C STEMMA QT boards, or can be used to connect to Grove I2C devices with an adapter cable.
- 5-Way Joystick + Button for user interface and control.
- Three RGB DotStar LEDs for colorful LED feedback.
Design of the BrainCraft HAT
Designed for all models of Raspberry Pi with 40 pin GPIO, BrainCraft HAT is best used with the Raspberry Pi 4, 400 and the new Compute Module 4 as Tensorflow Lite requires plenty of computing power. The HAT itself doesn’t provide any additional computing power.
The most prominent feature of the BrainCraft HAT is a 1.5 inch IPS TFT screen which is used as a viewfinder when used with a Raspberry Pi Camera. Looking to the top right of the board and we can see three DotStar RGB LEDs, a joystick and push button used for basic input.
Speaking of inputs, there are two microphones present (left and right mic) which can be used to create voice assistants using Google and Amazon APIs. As per Adafruit’s Bill of Rights these microphones have a hardware switch to completely disconnect them, providing a sure means to protect your privacy.
Speakers aren’t built in so audio output comes via two JST ports offering a 1W output to compatible speakers, or we can use the TRRS headphone jack. Two STEMMA ports for connecting compatible devices and a STEMMA QT plug and play I2C port complete the line up. Flipping the BrainCraft HAT over and we see four spacers, these are used to attach the included fan, necessary to keep the Raspberry Pi 4 cool. Fitting the fan is rather simple, but the JST power connector can prove troublesome for larger hands.
Using BrainCraft HAT
The Adafruit BrainCraft HAT is designed to be one board that can perform many functions for machine learning. It has no onboard computational power to assist machine learning / Tensorflow Lite, for that we need a Tensor Processing Unit (TPU) such as Google’s Coral USB Accelerator which is available separately.
The power of the Raspberry Pi 4 provides enough computational power for basic projects. Following Adafruit’s excellent user guide we setup our BrainCraft HAT along with a Raspberry Pi HQ Camera. After a little debugging with our Python setup, our project came to life and we pointed the camera at an apple, to find that it identified the type of apple, a Granny Smith.
The default model used for identifying objects is quite simple and it can identify around 2000 objects but we can train our own mode using Google’s Teachable Machine to identify objects in our home / workplace.
BrainCraft HAT’s inputs and output can be controlled using a mixture of Python libraries, chief among them is Blinka, a compatibility layer for CircuitPython libraries. With Blinka we can control the DotStar LEDs and read the direction in which the joystick is pressed along with controlling / reading the state of the two STEMMA JST connectors when used with compatible devices.
The fan has its own installation script which runs a service on boot to start the fan, a bash script to read the temperature and turn on the fan as needed would be of real benefit as the fan is rather noisy and interferes with the microphones and audio playback. Audio setup and the display module is handled via two respective scripts. Take care with the display install script, we made an error and had to restart the install process. Follow the guidance here and you will not repeat our mistake.
Use Cases for the BrainCraft HAT
With an emphasis on machine learning, you would think that the BrainCraft HAT is a one trick pony. Far from it. The BrainCraft HAT can be used to build home assistant projects using Google Assistant APIs. The builtin microphone and audio output lend themselves to projects such as this. Breakouts for the GPIO and STEMMA compatible devices means we can add servos, motors, sensors etc to a voice assistant project or we can use the board as a hub for multiple devices.
Adafruit’s BrainCraft HAT is the ideal way to dip your toe into the world of machine learning. The low price point, great instructions and ease of use enable anyone to use machine learning in their project.
As we said, this is not a singular use board. Building voice assistants is also made trivial thanks to the onboard microphone and audio outputs. Buy this board, learn the skills needed for machine learning projects and then move on to more powerful hardware as your need and skills allow.