SOLVED - UNICORN Hat GPIO connection

Hello, I already have an Board on top of my pi and so i cant put the unicorn hat on it. Is there a possibility ( maybe with the VCC DIN GND connections) to connect it otherwise? What are the pins used? I cant see the used pins in the pinout. Because i have a female to male GPIO connector i could connect them anyway?
Thanks in advance.

The pinout for unicorn hat is found here

you can then jump the connections onto the pi header.

So I must connect PIN 2 on the pi to VCC, pin 9 to GND and pin 12 to DIN?

Yep! You could use physical pins 4, 6 and 12 with no problems; they’re a little less scattered. The grounds are all connected anyway.

Thanks! As i tested it out without the other HAT, there was random flickering, maybe i must add force_hdmi_hotplug=1?

yes, most likely. Or run:

curl https://get.pimoroni.com/audio | bash

and choose option 3.

1 Like

Thaniks I will try this soon!

The Pin 12 has a function on the other HAT, is there a setiing for changing the DIN Pin?

The Pin 12 has a function on the other HAT, is there a seting for changing the DIN Pin?

I think there is a way to wire it to BCM 12 but I am unsure how to. Do you now what the physical pin 12 is doing on the other hat

The pin 12 is giong to the Ultrasonic sensor that im using already

The pin 12 is giong to the Ultrasonic sensor that im using already

BCM 12 is physical pin 32. We tend to use BCM numbering rather than physical. Physical pin 12 is usually referred to as pin 18, or BCM 18.

If you’re not using audio, you can route the WS2812 signal out via BCM 12, but this is a somewhat advanced process that involves modifying the Unicorn HAT library.

Install the development version of the rpi_ws281x-python library:

git clone https://github.com/pimoroni/rpi_ws281x-python
cd rpi_ws281x-python
git submodule update --init
cd library
python setup.py build

And grab development version of the Unicorn HAT library:

git clone https://github.com/pimoroni/unicorn-hat -b dev
cd unicorn-hat/library/UnicornHat

Edit the library:

nano unicornhat.py

And change LED_PIN from 18 to 12

Then install the modified library:

sudo python setup.py install

My /usr/local/lib/python2.7/dist-packages/unicornhat.py still has pin 18 in it. And now there are two .egg files, one has the name unicornhat-2.1.3-py2.7.egg and the other one unicornhat-2.2.0-py2.7.egg

How do I import the modified library? Is it just like importing the normal library?

Yup! Once it’s installed sudo python setup.py install it’ll just import as import unicornhat and you wont know the difference. It just wont work with a Unicorn HAT plugged right onto the GPIO ;) You can modify it back to fix that.

My /usr/local/lib/python2.7/dist-packages/unicornhat.py still has pin 18 in it. And now there are two .egg files, one has the name unicornhat-2.1.3-py2.7.egg and the other one unicornhat-2.2.0-py2.7.egg. What shall I do?

Python should, in theory, only load the 2.2.0 version. If all else fails, run sudo pip uninstall unicornhat a few times or sudo apt-get remove python-unicornhat to clean up any other versions and then reinstall your modified version.

Now my problem is that if I try to make simple.py that there is only random flickering and nothing else

That’s a start. I suspect it’s a grounding/wiring issue now. Check all your wiring, and now I’m trying to remember if there’s an extra connection that needs making on Unicorn HAT that Pinout may still be missing.