# Controlling multiple servos in a model railway

**URL:** <https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091>\
**Category:** Arduino\
**Created:** [6 January 2020 10:08 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091 "2020-01-06T10:08:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![David103562](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David103562](https://forum.core-electronics.com.au/u/David103562)\
**Post date:** [6 January 2020 10:08 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/1 "2020-01-06T10:08:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bryce](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/bryce/32/3631_2.png) [@Bryce](https://forum.core-electronics.com.au/u/Bryce)\
**Post date:** [6 January 2020 23:42 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/2 "2020-01-06T23:42:34Z")

</div>

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.

> **[Arduino Mega 2560 R3](https://core-electronics.com.au/arduino-mega-2560-r3.html)**
>
> The Arduino Mega 2560 is an update on the older Mega board and provides a 54 digital perfect for larger projects. If you've worked with the Arduino Uno, or other smaller Arduino boards, then you'll love the Mega 2560.

Bryce  
Core Electronics | Support

---

<div class="post-metadata">

**Author:** ![David103562](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David103562](https://forum.core-electronics.com.au/u/David103562)\
**Post date:** [7 January 2020 02:40 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/3 "2020-01-07T02:40:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bryce](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/bryce/32/3631_2.png) [@Bryce](https://forum.core-electronics.com.au/u/Bryce)\
**Post date:** [7 January 2020 05:46 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/4 "2020-01-07T05:46:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robin57159](https://avatars.discourse-cdn.com/v4/letter/r/cc9497/32.png) [@Robin57159](https://forum.core-electronics.com.au/u/Robin57159)\
**Post date:** [8 January 2020 06:07 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/5 "2020-01-08T06:07:30Z")

</div>

@David103562

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

> [@Using Mini Maestro 24-channel USB Servo Controller](https://forum.core-electronics.com.au/t/using-mini-maestro-24-channel-usb-servo-controller/6818):
>
> Let me state at the beginning that I’m not into electronics. I know a little but just enough to get me into trouble. My interest is in model railways. And I’d like to use servos to change the points/turnouts/switches (whatever you choose to call them) and change the polarity of the frog of the point. I’ve been investigating methods for controlling servos and, after watching the Pololu video, this controller seems to be a good choice. I was concerned that the board would require a permanent …

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

---

<div class="post-metadata">

**Author:** ![electron1979](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/electron1979/32/1941_2.png) [@electron1979](https://forum.core-electronics.com.au/u/electron1979)\
**Post date:** [10 June 2020 13:40 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/6 "2020-06-10T13:40:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![David103562](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David103562](https://forum.core-electronics.com.au/u/David103562)\
**Post date:** [11 June 2020 12:53 UTC](https://forum.core-electronics.com.au/t/controlling-multiple-servos-in-a-model-railway/7091/7 "2020-06-11T12:53:46Z")

</div>

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