Unicorn Hat not lighting up


Just got around to trying the Unicorn Hat using Raspberry Pi3. I ran an update to ensure the Pi was updated as well as the Unicornhat installer. Everything seems to be updated. I ran simple.py after the installation and nothing happens, none of the light display at all on the UnicornHat.

Here is my setup:

Suggestions are welcome! Thank you in advance!


It should be mounted over the Pi, lift it up, rotate 180 degrees, reseat.


Okay, I will give that try and report back. Thank you!


Thank you so much gadgetoid! I got the purple lights now! The assistance is much appreciated! I’m still learning so I’m glad it was something simple.


Hooray! Glad you’re up and running. Most HATs and pHATs will mount over the top of the Pi- so the mounting holes align. There are some exceptions, though, just to be confusing, such as our Button SHIM.


It’s a lot of trial/error for me, but I love the learning!

I’m trying to run some of the other demo scripts but now I’m getting a RuntimeError stating that ws2811_init failed with code -5 (map() failed). I pretty use this user error again. :)


You always need to use the Pi equivalent of “simon says” for running Unicorn HAT code. The magic sorcery it uses to drive those LEDs needs access to some technical stuff (that I don’t fully understand, but mostly involves accessing chunks of memory really fast and throwing them at some GPIO pins to get the signal timing right).

So you always need to:

sudo ./example.py


sudo python example.py


What I’m trying to do is run the script from IDLE rather than the terminal, that’s when I’m getting the errors. I’m thinking my script is not saved in the appropriate directory.


Ah, IDLE is a common gotcha! It doesn’t run with root privileges when you start it from the menu. You need to open up Terminal and run IDLE from there with sudo idle (for Python 2) and sudo idle3 (for Python 3) depending on which you’re using.