SOLVED - UNICORN Hat GPIO connection


#1

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.


#2

The pinout for unicorn hat is found here

you can then jump the connections onto the pi header.


#3

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


#4

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.


#5

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


#6

yes, most likely. Or run:

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

and choose option 3.


#7

Thaniks I will try this soon!


#8

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


#9

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


#10

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


#11

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


#12

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


#13

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

#14

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


#15

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


#16

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.


#18

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?


#19

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.


#20

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


#21

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.