Go Down

Topic: 16-channel/12-bit PWM i2c expander led+servo (Read 79 times) previous topic - next topic


I have a clone of the adafruit pwm expander for i2c bus and I note that they seem to use different libraries for running servos vs. fading leds. Can these boards do both simultaneously?

I have a need to move one servo back and forth while fading multiple leds (independently) on other channels. I'm just wondering if I have to hook the servo out some other way and just do leds on the expander.


This library is all you need need for both servos and LEDs. Set the frequency and then set the duty cycle (per pin) for both servo control and led fading.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla


Jul 21, 2019, 11:35 pm Last Edit: Jul 21, 2019, 11:38 pm by Grumpy_Mike
Can these boards do both simultaneously?
No they can't. It is fundamental to how the chip works. The solution is that the LEDs need to be inverted if they are to be run with a chip setup for servos. It is the fading up and down that has discontinues at the end.

I explain this in my Mulder article in the MagPi https://www.raspberrypi.org/magpi/issues/38/

It is for the Raspberry Pi and in Python but the same applies for the Arduino and C++. The numbers you put in the chip's registers are the same. And the schematic is identical if you wanted to make the same thing for an Arduino.

Forget libraries and just talk to the chip.

Go Up