# PanTiltHat connection pins

**URL:** https://forums.pimoroni.com/t/pantilthat-connection-pins/11986
**Category:** Support
**Created:** [October 22, 2019, 9:03am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986 "2019-10-22T09:03:54Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![vykintas52](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vykintas52](https://forums.pimoroni.com/u/vykintas52)
#### Post date: [October 22, 2019, 9:03am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/1 "2019-10-22T09:03:54Z")

</div>

Hi friends,

I’m using Pan Tilt Hat from Pimoroni to control to servo motors. I found here ([https://pinout.xyz/pinout/pan\_tilt\_hat](https://pinout.xyz/pinout/pan_tilt_hat)) 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:

 ![IMG_3165](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/e/e1e8b45e3faf9f1f87e057fc48b00b3cdf49d98c.jpeg)

Thank you for helping.

---

<div class="post-metadata">

### Author: ![vykintas52](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vykintas52](https://forums.pimoroni.com/u/vykintas52)
#### Post date: [October 22, 2019, 9:04am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/2 "2019-10-22T09:04:29Z")

</div>

Here is my wiring:

 ![IMG_3163](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/7/7e825296ef9486860839f5468380448eda1b60ff.jpeg)

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

---

<div class="post-metadata">

### Author: ![vykintas52](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vykintas52](https://forums.pimoroni.com/u/vykintas52)
#### Post date: [October 22, 2019, 9:05am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/3 "2019-10-22T09:05:08Z")

</div>

And at the other side:

 ![IMG_3164](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/7/7d43d1f52eb0d7fb1960712fca9fe837d41b4b11.jpeg)

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

---

<div class="post-metadata">

### Author: ![neilman](https://avatars.discourse-cdn.com/v4/letter/n/6de8d8/32.png) [@neilman](https://forums.pimoroni.com/u/neilman)
#### Post date: [October 22, 2019, 9:13am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/4 "2019-10-22T09:13:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![vykintas52](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vykintas52](https://forums.pimoroni.com/u/vykintas52)
#### Post date: [October 22, 2019, 9:19am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/5 "2019-10-22T09:19:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)
#### Post date: [October 22, 2019, 9:32am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/6 "2019-10-22T09:32:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)
#### Post date: [October 22, 2019, 9:35am UTC](https://forums.pimoroni.com/t/pantilthat-connection-pins/11986/7 "2019-10-22T09:35:37Z")

</div>

If you get one of these

> **[Adafruit Perma-Proto HAT for Pi Mini Kit – Pimoroni Store](https://shop.pimoroni.com/products/adafruit-perma-proto-hat-for-pi-mini-kit?variant=1038451613)**
>
> Design your own Pi HAT, attach custom circuitry and otherwise dress your Pi 3, 2, A+ or B+ with this jaunty prototyping HAT kit.

  
And use the 11mm stacking header from here  
[https://shop.pimoroni.com/?q=11+mm+header](https://shop.pimoroni.com/?q=11+mm+header)  
Might also want this stand off pack  

> **[Premium Pi standoff selection – Pimoroni Store](https://shop.pimoroni.com/products/premium-pi-standoff-selection)**
>
> Specifically selected for Pi HATs and pHATs this standoff selection also includes male to female standoffs to allow you to stack your boards securely

  
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.
