Can't get PCA9685 servo driver to work

I've tried a couple times to get this module to work. Here is what I've done:

  • Tried 2 different servos (both of which I know work)
  • Tried 2 different PCA9685 modules
  • Tried powering the modules off both the VCC connector, and through the power block.
  • Tried both the Adafruit, and the HCPCA9685 drivers, unedited examples.

Ideas?

Provide a hand drawn circuit diagram(not Fritzing) of your connections and power supplies used and the code.
For starters though, those so-called power blocks are around 700mA max and not suitable for servos.

Hi,
Have you established that you have I2C communication?

Have you tried I2C scanner?

Have you got a 4K7 pullup resisitor on each of the two I2C wires?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

On your recommendation, I found a scanner here, and with the PCA module connected, it returned:

Scanning...
I2C device found at address 0x40  !
I2C device found at address 0x70  !
done

Scanning fails when I disconnect the PCA module.

This is the first time I've heard about this? No tutorials I've read/watched mention doing this.

Then all the tutorials you have read or watched have been absolute rubbish. Produced by people who don't know what they are doing. You wonder what other mistakes they have made.

Sadly there are a lot of people out there who think they are much better then they are. They also tend to miss out on power supply decoupling as well.

Also with regard to your photograph, a solderless bread board can't take the sort of current you can expect from two servos along the tracks / connections. That is not helping your cause.

Hi,
Can you please post your code?
Do you have a DMM?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

That is strange. I would only expect one device to be found. Most PCA9685 boards default to 0x40 I think.

I don't see anything else connected to the bus in your picture, so what's that device with the 0x70 address?

It looks like you aren't supplying logic power to the board. You have SCL and SDA (A4 and A5) connected but you only provide power to the servos. You ALSO have to connect Ground and +5V to the GND and VCC pins along the bottom.

Hi,
Can you please post a circuit diagram of your project, including power supplies, use a pen(cil) and paper and show an image of it would be fine.
Please do not use a Fritzy picture

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

I don't see a common 16-ch PCA9685 servo module in post#1.
Clickable weblink please.
Leo..

There's a lot for me to unpack here. I have a background in app development, but very limited exposure to electronics.

I'm aware the power module I'm using is underpowered, but I'm only using the platform to test functionality, and testing max 3 servos for the project. The 3 servos are the small SG90 ones, and are not under load, which rates them at 100mA each. We plan to connect the PCA module to a bigger supply when we move to bigger servos in the next phase.

I'm sure you're correct. It's disconcerting that this bit of info is omitted by so many if it is important. What is the outcome if they are left out?

I don't know how to answer the question. They both failed when I disconnected the SDA and SCL lines on the PCA module. But that does teach me something, that I can now associate the I2C address to the PCA module.

It's the vertically standing module. The image is from top down.

It's the default example code that came with the HCPCA9685 driver.

Yep, and this seems to have gotten it working. I had thought (obviously incorrectly) that the power received through the power block on the PCA would have sufficed, since it shares the same +5v and GND with the Arduino.

It looks like address 0x40 and 0x70 are both associated with the PCA module. But you only have 1 connected... it can't have both addresses at the same time, so I don't understand how this is happening.

Now you fixed that, does the scanner still see 2 devices?

EDIT: just noticed that the two pages I linked to contradict each other: 0x40 and 0x70 can't both be the default!

The laws of physics are notoriously unimpressed that you are doing "just a test", and so they carry on working in exactly the same way as if this were for real. It is not the first time we have seen this from a beginner. :slight_smile:

The Arduino Uno has internal pull up resistors. The data sheet says these can be anywhere between 30K and 60K. It is hard to make precise values of resistor on a chip. If you get an Arduino with 60K internal resistors then I suspect this is not enough in a lot of circuits. This value affects the rising edge of the signal. To such an extent that sometimes it doesn't get high enough to trigger the signal, or delays the signal so much that the actual data transfer rate is slowed. This is described in this PDF:-

2013-01-26_175209_I2C_-_Effects_of_Varying_Pullup_Resistors(1).pdf (339.0 KB)

Glad to here that.

The PCA9685 has 6 address lines so you would think that it can be in any one of 64 addresses. But the data sheet says:-

  • 6 hardware address pins allow 62 PCA9685 devices to be connected to the same I2C-bus.

But then goes on to say:-

There are a maximum of 64 possible programmable addresses using the 6 hardware address pins. Two of these addresses, Software Reset and LED All Call, cannot be used because their default power-up state is ON, leaving a maximum of 62 addresses. Using other reserved addresses, as well as any other subcall address, will reduce the total number of possible addresses even further.

The relationship between address is:-

So note you will see two addresses if you scan the device. One at 0x70 the LED All Call, and the other at what ever the Address lines say the device should be.

I think that document does a good job explaining the why of pull-ups, though I'm having to read it a few times to make sense of it.

Haha, yes, I know. But really, I'm keeping with small servos with no load, 100mA/ea, and nothing attached, to keep the draw under the specified maximum for the breadboard power supply (700mA), and not pulling power through the Arduino. If I do manage to kill an Arduino, it'll be lesson learned. I do appreciate the warnings.

Maybe, however it is a well know fact to many that motors/servos draw large chunks of current at startup which can create problems for newcomers and "slowcoders" alike.