Tag Archives: Unicorn HAT

The 64-RGB Unicorn HAT for the Raspberry Pi

Using an RGB LED connected to the single board computer RBPi (Raspberry Pi), one can generate most of the colors of the rainbow. If one RGB LED has so versatile uses, imagine what you could do with 64 of them. Agreed, it takes more programming effort to play with 64 RGB LEDs, but with some help from the Pimroni GitHub repository and using their 64-RGB Unicorn HAT, this could be a fun project with Python scripts.

The Unicorn is a HAT or Hardware Attached on Top board for the RBPi. That means it has means to let the RBPi detect the GPIO pins required to drive it. Once plugged into the GPIO connector of the RBPi, the Unicorn becomes functional. You can program the matrix of 8×8 RGB LEDs on the Unicorn using Python scripts in many imaginative ways.

For those sensitive to different types of light, there is a word of caution. RBPi is capable of flashing, strobing and creating patterns of light with the RGB LEDs and this may cause epileptic seizures in those who are photosensitive. LEDs are strong point sources of light and directly gazing into a bright LED may cause eye-damage.

The GPIO interface on the RBPi can control each individual LED of the matrix. This includes assigning a level of brightness to each LED in addition to choosing its color. The Unicorn board comes with 64 RGB LEDs and its own Python library that Pimroni has provided. That makes it every easy for developers to control the board with its extensive capabilities. The LEDs may seem too bright if you operated them at their full brilliance.

Operating them at about 20% brightness is generally enough for most purposes. So many LEDs require a lot of energy, and as the board derives its energy from the RBPi, it is advisable to use at least a 2A power supply for powering the duo.

The Unicorn HAT uses the PWM hardware and the GPIO 18. Although this does not affect the HDMI output, it does interfere with analog audio playback. HATs are only compatible with the newer models, as HATs plug on to the 40-pin GPIO connector of the RBPi, model B+.

Although the RGB LEDs look great when working without a cover, a diffuser can soften the light output and mix neighboring colors, presenting a uniform display. You can use the matrix to present static or dynamic information. This pocket aurora, the Unicorn HAT, can present a wash of controllable color, which you can use for mood-lightening, pixel art, status indication or for simply blasting your surroundings with color.

The human eye has persistence of vision. That means it briefly remembers the image it has seen for about one-sixteenth of a second after the image is removed. You can use this feature to present information on the LED matrix of the Unicorn to make it look as if the image is moving continuously.
With all the colors of the rainbow at your disposal, this 8×8 RGB LED matrix can present countless hours of enjoyment and fun while teaching programming.