The idea of Rainbow HAT (a HAT - Hardware Attached on Top - is an add-on board for your Raspberry Pi) is to showcase the full range of what’s possible on a HAT, in terms of inputs and sensors, and outputs, as well as the interfaces used to communicate with them and, of course, our signature colourful LED lights.
We’ve crammed as much as was physically possible onto it - two different types of LEDs, a 4-digit alphanumeric display, a buzzer, three capacitive touch buttons, and a temperature and pressure sensor - making Rainbow HAT an incredibly versatile bit of hardware.
Developers, meet Raspberry Pi
With Android Things™ on the Raspberry Pi, Google’s aim (and ours) was to introduce developers working on Internet of Things (IoT) projects to the sorts of things that are possible on the Raspberry Pi with respect to interfaces and hardware and, vice versa, to introduce Raspberry Pi users to the world of Android development.
Rainbow HAT is designed to stimulate ideas - a development platform that can be used to build new and exciting IoT hardware and software. It’s also meant to be fun to use, and that should be apparent just by looking at it - the playful rainbow formed from the seven APA102 LEDs, and the barometer type markings below it.
We think that making hardware and software development enjoyable carries that enjoyment through into the developers’ products, and therefore to their customers.
Our Raspberry Pi 3 Starter Kit for Android Things™
We’ve put together a really neat little starter kit to get you going with Android Things™ on the Raspberry Pi 3. It contains: a Rainbow HAT, a Raspberry Pi 3, a special Android Things™ branded Pibow Coupé in Android green, a worldwide power supply, and an 8GB microSD card with the Raspbian OS on.
The aim is to get you up-and-running as quickly as possible. Just plug everything in and away you go! Google have written Rainbow HAT drivers for Android Things™. Just pop the Android ThingsTM for Raspberry Pi image on your microSD card, install the Android SDK, and start developing your apps.
All of Google's official Android Things™ examples use the Rainbow HAT pinout, so they should work out of the box with Rainbow HAT.
As an alternative to Android Things™, our Python library means that you can use Rainbow HAT, and explore all of its functionality, straight on Raspbian.
The possibilities
There’s so much fun to be had with Rainbow HAT! The range of inputs and outputs mean that you can combine them in heaps of ways. In a lot of ways, it’s like our Flotilla system in terms of how you can combine the different parts, except it’s all on a single HAT.
Because we used 14-segment displays, rather than the more commonly-used 7-segment displays, you can display proper text on them - upper and lower case - as well as numbers, obviously. The multicolour LEDs can be used to display data through colours, or as a bar-chart because they’re in a single row. The buttons can be used for whatever you want - to toggle things on or off, trigger actions, and they even have push-to-hold that enables a different type of interaction. There’s also the little piezo buzzer that can be used for audible feedback, or even to play simple tunes. And, finally, there's the BMP280 temperature and pressure sensor.
Here are a few of the ideas that we’ve come up with:
Weather station
Use the temperature and pressure sensor, and display the values on the 14-segment displays. You could even use the rainbow LEDs to display a bar chart of the temperature or pressure with the colour indicating cold or warm temperatures, or low or high pressure. Why not make it internet-connected and tweet the values, or log the values to a Google Sheet?
Check out Google's example of this here.
Tiny, three-note piano
There are plenty of tunes you can play with three notes! Here’s one to get you started - Mary Had a Little Lamb. The piezo buzzer uses PWM (pulse width modulation) to generate different frequencies of sound, and it’s easy to map these frequencies to notes. You could even use chording to get up to eight notes!
Reaction time game
Use the buttons to make a reaction time game for up to three players. Press a button to start, and when the rainbow lights change from red to green the first player to hit their button is the winner. Display the winning time on the 14-segment displays.
Stopwatch or countdown timer
Use the buttons as controls for starting or stopping a stopwatch, and display the time on the 14-segment displays. You could use the rainbow LEDs to display the seconds ticking. Or use the buttons to set the seconds and minutes on a countdown timer, displaying the countdown on the displays, and then buzz the buzzer when the time is up!
Mood light
Set your mood with the rainbow LEDs, using the 3 buttons to select and adjust each colour channel, fade through the hue, or switch between lighting effects.
We’re sure that you’ll come up with even more creative ideas for your Rainbow HAT once you get one in your hands!
Grab a Rainbow HAT or a Raspberry Pi 3 Starter Kit for Android Things™ here.