Member-only story

Extending the Rainbow HAT for the Raspberry Pi with More Peripherals

Charles Xie
7 min readFeb 28, 2019

--

The Rainbow HAT for the Raspberry Pi is a board for learning physical computing and IoT programming recommended for Google’s Android Things. The HAT comes with a “buffet” (in the manufacturer’s own words) of sensors and actuators that are fun to mess with. But if you are tired of eating the same buffet every day, you can always connect your own peripherals to its breakout GPIO pins — PWM0, UART0, I2C1, and SPI0.1 — to create more interesting projects. These open pins can be found on the left side of the board. In this article, I show how to connect a strip of RGB LED lights through the Serial Peripheral Interface (SPI) bus as an example of extending the functionality of the Rainbow HAT. If you would like to create the animated glowing effect shown in Figure 1 below with the Rainbow HAT, this article is for you.

Fig. 1: An animated glowing rainbow in pitch darkness

The Adafruit DotStar model

As the first try, I used the half-meter DotStar Digit LED Strip from Adafruit. This strip has 72 addressable RGB LED lights and a 4-pin JST SM male connector on one end. Out of the four pins, one is supposed to connect to a power source (3V3 or 5V), one to the ground (GND), one to the Serial Clock (SCLK), and the last one to the Master Output Slave Input (MOSI) to which the data will be written. You should connect the two non-power pins to the SCLK and…

--

--

Charles Xie
Charles Xie

Written by Charles Xie

Computational Scientist, Physicist, & Inventor at the Institute for Future Intelligence https://intofuture.org

No responses yet