PanTiltHat connection pins

Hi friends,

I’m using Pan Tilt Hat from Pimoroni to control to servo motors. I found here ( that Pan Tilt Hat uses 3 GPIO pins and 5V power to work. To my understanding it uses pins no. 2 (5V), 3,5 (I2C) and 36 (GPIO). For my pan tilt hat connection I use wires, as I need some stand-offs to fit my other components. Also I cannot afford to use all 40 pins by pan tilt hat. So I manually connect pins 2,3,5 and 36 to the hat. However, in such case, I get an error: IOError: Failed to write byte. It seems that it fails to communicate over I2C. When I connect my pan tilt hat directly to 40 pin header it works fine.

i2cdetect -y 1

gives me:

Thank you for helping.

Here is my wiring:

Red top is Pin 2 (5V), black and yellow are Pin 3 and 5 (I2C), red bottom is Pin 36 (GPIO).

And at the other side:

Red top is Pin 2 (5V), black and yellow are Pin 3 and 5 (I2C), red bottom is Pin 36 (GPIO).

So where are all your ground 0 volts or earth pins - they are essential too!

That what I was thinking… The question is do I have to wire all 8 grounds (at least to pan tilt hat end)?

Yes, you need to wire all the grounds in the pinout with the black horseshoe boarders around them.
On the Pi all the grounds are one common connection. On a Hat or pHat its not easy or may not even be possible to link them all together. Not with out adding more layers (and cost) to the circuit board. Plugging the pHat or Hat into the Pi will link them all together for you. Assuming the user plugs it directly into the Pi. ;)
I had a similar issue on my Fan Shim because I missed the one extra ground connection it used.

If you get one of these

And use the 11mm stacking header from here
Might also want this stand off pack

It will make life easier and let you screw one stand off on top of the other. Proto hat in between the two.
You stack it between your Pi and Hat and then get access to the GPIO pins.