# PiicoDev\_Servo i2c connection

**URL:** <https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973>\
**Category:** Uncategorized\
**Created:** [1 March 2025 05:57 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973 "2025-03-01T05:57:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [1 March 2025 05:57 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/1 "2025-03-01T05:57:22Z")

</div>

Hi  
Does the PiicoDev Servo Driver require the i2c connection only via a PiicoDev cable or can it be connected directly from the Pico i2c pins (pin 1 - sda, pin 2 - sci, pin 3 gnd, and pin 39 - 3.3v) to the i2c ‘pins’ on the end of the PiicoDev board?

This issue has arisen where the project does not include a PiicoDev expansion board but the i2c connection needs to be hard wired.

Thanks  
Toni

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [1 March 2025 07:37 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/2 "2025-03-01T07:37:46Z")

</div>

> [@Toni135859](#):
>
> Does the PiicoDev Servo Driver require the i2c connection only via a PiicoDev cable

I’ve not used this motor driver but I have used other piicodev products.

Best I understand the piicodev cable and the adapter is just a JST with no bells and whistles.  
From experience with other piicodev stuff, you’ll find joy connecting this to any I2C bus via the pin-outs provided or by hard wiring it to any compatible plug. Most\* piicodev product, including this one, have internal pullup resistors required for the i2c protocol.

I’m basing this on the [schematic](https://raw.githubusercontent.com/CoreElectronics/CE-PiicoDev-Servo-Driver/main/Documents/piicodev-servo-driver-schematic.pdf). 🙂

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/f/fb4278bc6710ebefc2e63738211da1071d40e4fa.png)

\*all?

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [2 March 2025 06:22 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/3 "2025-03-02T06:22:18Z")

</div>

Thanks Jonny

Just to clarify my question, a Raspberry Pi Pico does not incorporate an i2c socket so i2c can only be used via the appropriate 4 pins on the board.

Using these pins I have previously made successful i2c connections to PCA9685 16-channel driver boards and assumed the process with the PicoDev Servo Driver would be similar.

With this cabled connection I have tried to run the code(s) published in the guide but they fail when it comes to the i2c address. I have tried to get on top of the PiicoDev\_Servo.py library file which is where the error messages originate from but am not having much success.

Can you help?

Regards  
Toni

---

<div class="post-metadata">

**Author:** ![Jeff105671](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jeff105671/32/3729_2.png) [@Jeff105671](https://forum.core-electronics.com.au/u/Jeff105671)\
**Post date:** [2 March 2025 06:52 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/4 "2025-03-02T06:52:19Z")

</div>

There’s nothing magical about an I2C socket - it simply connects straight to the appropriate GP pins and power. What is the code you are using to create the I2C bus on pins GP0 and GP1?

What is the error you are getting? What address have you configured the [PiicoDev Servo Driver](https://core-electronics.com.au/piicodev-servo-driver.html) for, and have you confirmed that the device is detected at that address?

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [2 March 2025 07:40 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/5 "2025-03-02T07:40:39Z")

</div>

> [@Toni135859](#):
>
> a Raspberry Pi Pico does not incorporate an i2c socket

By “i2c socket” are do you mean one of these? 🙂

> **[JST-SH 4-Pin SMD Connector (Side Entry) - PiicoDev Compatible Connector](https://core-electronics.com.au/connector-sh-4pin-r-a-smd.html)**
>
> Add a small 4-pin connector to your SMD PCB designs with this  JST-SH 4-pin compatible connector...

Like @Jeff105671 I’d love to see an error message. 🙂

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [2 March 2025 21:09 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/6 "2025-03-02T21:09:51Z")

</div>

Thanks gents

Attached are photo of the physical setup and resulting error messages.

The coding is exactly the same as that in the Getting Started Guide.

 ![IMG_2242](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/7/707671ad4868d6694108e8196aab6ee0016ea092.jpeg)  
 ![IMG_2243](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/1/13ca6841a9e7ee0a24c5fb029fab2ba364aea189.jpeg)

Hope this helps  
Toni

---

<div class="post-metadata">

**Author:** ![Jeff105671](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jeff105671/32/3729_2.png) [@Jeff105671](https://forum.core-electronics.com.au/u/Jeff105671)\
**Post date:** [2 March 2025 22:12 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/7 "2025-03-02T22:12:03Z")

</div>

Can you post a description of your wiring - it is not possible to check it completely from an image, where some of wires are concealed.

What I2C address have you configured the driver module for? Have you used the [I2C scan utility](https://randomnerdtutorials.com/raspberry-pi-pico-i2c-scanner-micropython/) to confirm that it is responding correctly at that address?

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [2 March 2025 22:25 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/8 "2025-03-02T22:25:22Z")

</div>

I have experienced a situation where I needed to power off and on the Pico to get I2C to work after making some changes to the code. Something in the micropython code startup I put it down to.

Was extremely frustrating till I accidently removed power and it worked when powered up again. I was able to duplicate it too. But this situation has occurred very rarely.

Suggest try a power cycle and see what happens, might not be the problem but worth a try after what I experienced.

BTW I have successfully hardwired a I2C piicodev cable to a pico board and it worked. the main problem I had was getting the data lines the right way around. Always check that first.

Cheers  
Jim

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [2 March 2025 22:56 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/9 "2025-03-02T22:56:06Z")

</div>

Jeff, my answers to your questions are as follows:

Ii2c GND - pico pin3  
i2c 3.3V - pico pin39  
i2c SDA - pico pin 1  
i2c SCL - pico pin2

i2c.scan() gives ie nothing connected

Unlike with the successful code I wrote for the 16 Chanel PCA9685 board, the code for the PiicoDev servo board, as given in the Guide, does not include the set up i2c statements I would have expected.  
Further delving into the published libraries seems to indicate that the i2c definitions are buried in these documents including a statement \__I2C\_ADDRESS_ = 0x44 . I’m not clear how this operates but would not expect the i2c ‘address’ to be in a library document rather I would expect it to be in the operating code.

Thanks  
Toni

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [2 March 2025 23:01 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/10 "2025-03-02T23:01:58Z")

</div>

Thanks Jonny, I am hoping not to have to go down that road but even if I do the pins of the JST-SH Connector do not align with those on the Pico, so some hard wiring would inevitably be required.  
Toni

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [2 March 2025 23:30 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/11 "2025-03-02T23:30:03Z")

</div>

Thanks James,

Yes I have already tried the old power on/off trick to no avail.

With your connection to the Pico am I right in assuming that you used an I2C PiicoDev cable with one end cut off and soldered to the pico pins? In my case I am not using the I2C PiicoDev cable connector but am wiring the cable directly from the pico to the i2c pins at the end of the board. Perhaps this is an issue?

Did you use the published code?

Toni

---

<div class="post-metadata">

**Author:** ![Liam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam/32/3562_2.png) [@Liam](https://forum.core-electronics.com.au/u/Liam)\
**Post date:** [2 March 2025 23:43 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/12 "2025-03-02T23:43:05Z")

</div>

Hi Toni,

> [@Toni135859](#):
>
> i2c SDA - pico pin 1  
> i2c SCL - pico pin2

The servo driver is expecting the I2C pins to be on the [micropython default I2C pins](https://docs.micropython.org/en/latest/rp2/quickref.html#hardware-i2c-bus) (8/9)

For pins 0/1 to be used they can be specified manually like:

```auto
from machine import Pin, I2C
i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=400_000)
controller = PiicoDev_Servo_Driver(i2c=i2c) 
# Rest of your code here

```

Let us know how that goes!  
Liam

---

<div class="post-metadata">

**Author:** ![Jeff105671](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jeff105671/32/3729_2.png) [@Jeff105671](https://forum.core-electronics.com.au/u/Jeff105671)\
**Post date:** [2 March 2025 23:49 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/13 "2025-03-02T23:49:56Z")

</div>

> [@Toni135859](#):
>
> i2c.scan() gives ie nothing connected  
> …does not include the set up i2c statements I would have expected.

That’s the clue. The scan is telling you that the device is not visible, and the lack of a specific setup is telling you that the default is being used, The default bus is not the one the device is connected to. Either use the default bus and leave the code as is, or adjust the code to use the bus you are connected to.

It is not unusual for a library to include default values. That means that a simple form of the initialisation will use those defaults, but there are override forms of the initialisation that allow you to specify a different configuration.

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [2 March 2025 23:50 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/14 "2025-03-02T23:50:38Z")

</div>

Yes,Picodev cable one end cut off and header pins crimped on. (Core actually sell these I found out later) The header pins and the Pico plugged into a piece of vero board with sockets. Allows for removal of the parts if necessary. The connection was to GP8 & GP9 and used the PicoDev library.

As @Liam has mentioned GP8 & GP9 are used by the PicoDev libraries. The defaults are built into the library but you can override them by passing the pins numbers in your code, as @Liam showed.

Cheers  
Jim

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [3 March 2025 00:15 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/15 "2025-03-03T00:15:16Z")

</div>

Thanks all

With Liam’s code installed the error message is still _unexpected keyword argument i2c_ at the _controller =_ line.

Adding the _i2c.scan()_ code produces:  
[68,112]  
so something is happening but still the error message appears.

Toni

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [3 March 2025 00:20 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/16 "2025-03-03T00:20:20Z")

</div>

note 68 decimal is 44 hex which is what is nominated in the library PiicoDev\_Servo.py

---

<div class="post-metadata">

**Author:** ![Dan](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/dan/32/10815_2.png) [@Dan](https://forum.core-electronics.com.au/u/Dan)\
**Post date:** [3 March 2025 01:40 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/17 "2025-03-03T01:40:27Z")

</div>

Hi @Toni135859

Looks like Liam had a human moment there, the code should have been

```auto
from machine import Pin, I2C
i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=400_000)
controller = PiicoDev_Servo_Driver() 
# Rest of your code here
```

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [3 March 2025 03:49 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/18 "2025-03-03T03:49:42Z")

</div>

Sorry Dan, but the following code still produces the attached error messages:

from machine import Pin, I2C  
from PiicoDev\_Unified import sleep\_ms  
from PiicoDev\_Servo import PiicoDev\_Servo, PiicoDev\_Servo\_Driver

i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=400\_000)  
print(i2c.scan())  
controller = PiicoDev\_Servo\_Driver()

 ![IMG_2244](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/7/78ded739dfac84709465674574cef3474cbb94b4.jpeg)

I must be really missing something!!  
Toni

---

<div class="post-metadata">

**Author:** ![Dan](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/dan/32/10815_2.png) [@Dan](https://forum.core-electronics.com.au/u/Dan)\
**Post date:** [3 March 2025 04:16 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/19 "2025-03-03T04:16:16Z")

</div>

Hi @Toni135859

My apologies, the frequency should be set to 400000 not 400\_000, remove that underscore and see how you go

---

<div class="post-metadata">

**Author:** ![Toni135859](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@Toni135859](https://forum.core-electronics.com.au/u/Toni135859)\
**Post date:** [3 March 2025 05:16 UTC](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973/20 "2025-03-03T05:16:44Z")

</div>

Hi Dan

That change didn’t fix the problem, same error message appears. I’ve tried power on/off etc but nothing changes.

Toni

[Next page](https://forum.core-electronics.com.au/t/piicodev-servo-i2c-connection/21973.md?page=2)
