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.
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.
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.
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 for, and have you confirmed that the device is detected at that address?
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 to confirm that it is responding correctly at that address?
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.
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 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
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?
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.
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.