Should the LED state startup full on?

My PivotPi, connected to a Pi Zero, comes up with the leds full on; is this how it should be? Haven’t hooked up any servos yet, but a little concerned they might come up in some unexpected state…

Thanks, Dan

Hello @DanielMGessel

The LEDs do come on by default but will turn off as soon as you initialize the pivotpi .
Hope this helps!

Cleo

Are the LEDs inverted from the output? This seems to be the case based on sorting through the C code: the pc9685.c file sets the HW invert bit in the MODE2 register (I don’t know why) and then the logic for sending angle pulses in the pivotpi.c subtract from 4095, inverting again.

I’m just about done a full rewrite of the C code from that directory to control servos and the LEDs, and this seems to be the one gotchya. The only thing I don’t get is why the totem pole configuration is chosen vs open drain?

The only bummer about the negation would be the power saving mode would happen with the leds on (from the manual, power saving is gained by turning off the counters when the 9865 is set to full off) - though no real reason why full on couldn’t turn off the counters too.

I’ve written alot of code but done almost no electronics! :slight_smile:

Thanks, Dan

Hello @DanielMGessel
Yes the LEDs are inverted. I couldn’t tell you why but maybe @matt can?

LEDs are traditionally driven in an open drain configuration, and the PivotPi followed this precedent. There was discussion of changing them, but it was decided against for a couple reasons. For one, the drivers as written worked with the prototypes (changing it would break support for earlier hardware). Additionally, having them come on initially and then turn off at initialization could help with debugging a program or robot, where you could simply look at the PivotPi to determine if it has been configured yet.

As far as inverting the signal and then inverting the PWM values, as I recall this was due to the fact that the PCA9685 was otherwise incapable of turning the LEDs off fully. If I remember correctly, it can go from roughly 0.01 to 100%, or inverted, from roughly 99.99% to 0%. Being able to get down to exactly 0% is more important than being able to reach a full 100%. At exactly 0% the servos go into “no signal” or “float” mode, and the LEDs don’t have any glow.

My reading of the manual is that both full on and full off are special modes, programmed with 0x1000 in the on or off registers (respectively) so I detect and special case, putting 0x0000 in the other register pair. Knowing the leds are inverted, I’ll just subtract brightness from 1 for the leds before passing it on to my next layer of code.

Thanks!