4

All,

I'm working to develop a piece of hardware that allows me to control 1000 outputs (servos) from a single output pin.

I'm using pigpio on a Raspberry Pi B3 with python. I'm also using an array of 74HC4051 multiplexers. I've created a board that contains 9 multiplexers and allows me to use the multiplexers to control up to 64 outputs.

I'm noticing an issue when testing real-time refresh rates for the servos.

When executing a program that randomly selects a value and sets all servos to that value before executing the next iteration of the loop, I'm unable to get reliable servo positions without adding a 0.05 second delay between each output selection.

Simple math tells me updating 1000 objects would take 50 seconds. If I decrease the amount of time that passes between driving each servo, this results in inconsistent positions, or some servos failing to be updated at all.

The datasheet for the multiplexer doesn't seem to indicate that it's incapable of switching fast enough, which leads me to believe that it could have something to do with the PWM/pigpio and things that are happening in that library with regard to how much time the servo needs to accurately update. The servo speed is specified as .1 second. I think that value is the speed it takes to reach the specified position once receiving a signal.

Where can I begin testing for constraints in this system so that I can speed up that horrible refresh rate? With a 0.05 second delay I'm able to update 1100 servos in 55 seconds. Is my only option better hardware? Open to any ideas.

Thanks in advance.

user2355051
  • 153
  • 5

1 Answers1

2

I'm working to develop a piece of hardware that allows me to control 1000 outputs (servos) from a single output pin.

Do you accept 2 pins? If yes, you can consider PCA9685 - 992 servos with only two pins!

PCA9685 can drive servos and LEDs. I am using it to drive DC motors.

dual PCA9685

I have been trying to use 8 MCP23017 to drive 16 x 8 = 128 devices. But I2c is intermittently unstable, even I use short wiring, less than 30cm, and I2C buffers and extenders. My lesson learnt is that it is better to use distributed processing, using more Rpis working in parallel.

octal mcp23017

BTW - I see you are using HC4051 to demux 8 analog channels. That is a weird method to drive servos! Can you show me a link how to do it?

Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685 $15

AdaFruit PCA9865 Tutorial

Driving servo motors with the Arduino Servo library is pretty easy, but each 
one consumes a precious pin - not to mention some Arduino processing power.  
The Adafruit 16-Channel 12-bit PWM/Servo Driver will drive up to 16 servos over 
I2C with only 2 pins.  The on-board PWM controller will drive all 16 channels
simultaneously with no additional Arduino processing overhead.  What's more, 
you can chain up to 62 of them to control up to 992 servos - all with the same 2 
pins!

The Adafruit PWM/Servo Driver is the perfect solution for any project that 
requires a lot of servos.
tlfong01
  • 4,847
  • 3
  • 12
  • 24