No Blinky Blinky- Pi Zero W & Unicorn PHAT

Hey community. Bit of a rPi configuration noob here.

My goal- Using a rPi Zero W and a Unicorn PHAT I want get the LEDs to light up. Then use it to indicate when I am in meeting etc at home.

Hardware: As above with Pogo pins to connect 5v, ground and data (GPIO 18) between the Pi and the Unicorn PHAT.

Software: Raspbian OS Lite installed on an 8 GB micro SD card. I have then followed the guide here https://github.com/carolinedunn/unicorn-busy-server and even followed the pimoroni guide on https://github.com/pimoroni/unicorn-hat. However I did get ‘command not found’ when running sudo idle or sudo idle3.

Either way I am not able to get the LEDs to light up. In the 1st method I should be able to use http get command to make calls to the pi to turn the unicorn pi hat a certain colour and in the 2nd method there are example python scripts to run LED sequences. Neither work. I’ve run the detect.py but I’m not completely understanding the output.

*Unicorn HAT Detect-o-matic v2.0

Note: Your Unicorn HAT must be plugged in before boot to detect properly!

We couldn’t find a connected EEPROM, so we’ll assume you’re using a Unicorn pHAT.

You should use the following in your code:

import unicornhat
unicornhat.set_layout(unicornhat.PHAT)

If you’re sure you’ve connected a HAT, use:

import unicornhat
unicornhat.set_layout(unicornhat.HAT)

A pip freeze | grep unicornhat command reads back

unicornhat==2.2.3

So I know a the module is installed. But I’m really lost on this one. Can anyone help at all?

Thanks in advance.

You mention that the pHAT eeprom is not detected - it lives on pins 27 & 28 see pinout…


You will need pogo pins on those pins and possibly more ground pins.
Perhaps there’s someone more familiar with this pHAT can help further.

Pin 9 (Ground) needs to be connected. The above pinout indicates its the ground pin used. On the Pi all the grounds are common (wired together). That’s not always the case on a Hat, its not always possible to link them.

Thank you both. I have added a pogo on pin 9. Both before and after adding I’ve noticed that on occasion I am able to run an example script and the LEDs light up if I gently squeeze the the unicorn hat and pi onto the pins. But the LEDs are not showing properly. The Pi also keeps rebooting. I’ve also noticed that he Pi zero keeps dropping pings. This is happening when it is sat on its own and I am not touching it.

Some of your issues are likely due to the pogo pins. They are meant to be used between two devices that “both” don’t have headers soldered on them.
IMHO, your going to need a PI with a male header on it to get this working reliably.

Yep- neither the Pi or the hat have header pins on. Would you expect this to work?

OK, that should be fine. I was thinking it was a Unicorn Hat for some reason when I made that post?

Now that I’m looking at the correct pinout, the pHat one, a lot of ground pins need to be connected for it to work.
Pin’s, 6, 9, 14, 20, 25, 30, 34 and 39 all need to be connected along with Pin 2 and 12.

Thanks. I tried adding all the ground pins as well as the 5v and data that were already connected. I used pogo pins but still no joy. To help verify there wasn’t any actual issue with the hat I wedged it on the 40 pins that came pre-fitted to my other pi (rPi 4 b+) and was able to get the unicorn hat to work. With my lack of understanding the pinout diagram I’ve brought some header pins, connecting all 40 pins between the pi zero w and the hat. And now I’m getting the LEDs to work as expected.

Excuse my poor knowledge. I wasn’t able to fully understand the unicorn hat pin out page.

But I have a working solution now. Thanks all for your help thus far. :)

Pogo pin usage and using individual jumper wires for extending pHATs/HATs away from Pi’s seem to cause more problems than they are worth.

The problem being that there are often more pins, particularly ground pins, used than appear to be indicated. As mentioned previously all the ground pins on the Pi itself are connected together - something the pHAT/HAT can take advantage of to save tortuous track routing - but it does mean you need to connect ALL the ground pins to be sure.

It may have been cheaper to supply the Pi-Zero, and various pHATS/HATs, without headers but that too causes problems for beginners who may be reluctant or unable to solder them on.

IMHO its a double edged sword. I like the option of being able to solder on a header of “my” choice. I have some Zero’s with female headers on the back side and some with 90 degree headers. This lets me plug them into things like the pHat Stack and avoid having to use a ribbon cable. I’m a retired electronic technician so soldering is no big deal for me.
It can be a big deal if you have never done it before, which is why I think the with header version of the Zero appeared.

The grounds “used” could IMHO be better marked on the Pinout page. That caught me out with my LED Shim. It uses two and if you leave the second one out it doesn’t lite up.

I’ve noticed a lot of the pHats and Hats now have the slim low profile SMT female headers on the back side. No through holes at all which leaves more space for components on the top. Looks a lot nicer too.