Controlling multiple servos in a model railway

I plan to use servos to control the movement of model railway points (also known as turnouts and switches). After some investigation, I’ve settled on using an Arduino Uno to control the servos. I’ve now seen that a PCA9685 board will allow me to control 16 servos from the 1 Arduino Uno with just 2 connections between the 2 boards (plus 5v and GND).
But I need to use a SPST (or SPDT) switch to trigger the movement and I’d like to have some visual indication of position of the point using LEDS. To do that, I need to use 3 of the digital pins on the Uno limiting me to just 4 servos. Does anyone know of another board or shield that will expand the number of pins I have at my disposal so that I can take advantage of the PCA9685? I’ve been made aware of a Waveshare MCP23017 IO Expansion Board. Is this the only option?
Thanks
David

1 Like

Hey David,

Have you checked out a Raspberry Pi Mega? It’s got 54 Digital pins that should be able to perform both of your tasks simultaneously. Here’s a link to it.

Bryce
Core Electronics | Support

1 Like

Bryce, didn’t know there was a Raspberry Pi Mega - I presume you meant the Arduino Mega 2560? Yes, I’ve considered it. I thought it had 48 pins which would only give me 12 servos.

Hey David,

Haha my mistake. That is an Arduino Mega there’s no such thing as a Raspberry Pi Mega. Another potential option is to use a second Arduino Uno like you’re using currently and connect the two of them via serial so that a Master Arduino controls the motors and sends serial based commands to the slave which controls the lights according to the commands that it receives. This will add a little latency but it should be negligible.

All the best with your project!

Bryce
Core Electronics | Support

@David103562

You might be interested in this thread. (There are a couple of similar threads as well)

You may be able to contact the poster and see what his solution is.

Hi David,
With the PCA9685 you can change the I2C address. “62 of these on a single i2c bus, a total of 992 outputs”.

Hi Peter,
Thanks for the info. I’ve given up on the PCA9685 and moved on to an Arduino Mega.
Cheers