Hi everybody! How can I control 70 turnouts? I have the 70 servos but I guess there are limitations with the Arduino boards, though I know some servo driver boards can be hooked (at least that's the theory!) Is there any working example? Or, what do they use to control so many turnouts? Thanks! Robert
There are several companies that make servo controllers for turnouts. The vendor with which I am familiar is Tam Valley Depot. Their Octopus III Eight Servo Driver board controls eight turnout servos with either toggle or momentary switches. You would need nine Octopus III boards. You can add DCC control to the Octopus III if you wish. If you want DCC control built-in from the start you can use their QuadLN_S boards. Lots more info at the Tam Valley web site. - Jeff
There is a arduino based accessory decoder design by geoff bunza, that I use for all my turnouts. Each decoder can handle 17 servos (or 21 if you uses every pin) and the cost of a decoder can be as low as 5$. With these Decoders you can even use an external power supply for the servos, if the power requirement exceeds that of the decoder regulator. Good luck! Regards Kim
It is possible to control quite a few servos with a single Arduino if you add PCA9685 I2C PWM modules. Each module can control 16 servos, and you can daisy chain up to 62 modules. The modules do all of the timing so all the Arduino has to do is listen for commands and send out the changes to the PCA9685's. The modules can be had for less than $3 on EBAY.
I have just setup an arduino and a servo shield, i have 3d printed the holders and have tried one and it works great. Have also got serup from this for signals and panel lights. Just trying to figure out how to use with dcc++. The servo shield and mega 2560 can handle about 30 with my setup. Will post pics later today of what im doing but i think it is proving to be positive.
YES! success so far with my attempt at arduino controlled servos for turnouts. I am just posting a video to youtube showing what i have. Bobbyboy1962. Can i post the video here for all to see?
Just watched you videos on YouTube and was wondering if you have a link to the Arduino code you used and the mounts in thingyverse? Thanks Rob Sent from my iPhone using Tapatalk
Sorry no thingyverse. As for the code, I downloaded DCC++ project and modified it to read my panel and switchbard. There is another Arduino that runs the code thet operates the turnouts.
this is the thingiverse thing, use my remix for the base unit as it allows you to move the micro switch for better control. Servo Turnout Motor for Model Railroads by pturvill, published May 6, 2016 And this is the arduino sketch // MRH 6 Switched 6 Servos with Pushbuttons & LED Indicators // G. Bunza 2016 // #include <SoftwareServo.h> #define numpins 6 // Number of Servos SoftwareServo servo[numpins] ; int i,k,l; int pins [ ]= {23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46}; // Pushbutton/LED pins int spins [ ]= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22}; // Servo pins int sstart [ ]= {62,62,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57}; // Servo Start Positions int sstop [ ]= {83,83,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90}; // Servo Stop Positions boolean pinval [ ]= { true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true }; // Servo State // void setup() { for (i=0; i<numpins; i++) { servo.attach (spins); // Set up servo controls servo.write(sstart); // Set each servo to start position } pinMode(pins,OUTPUT); // Initialize PB/LED pins digitalWrite(pins,HIGH); } void loop() { SoftwareServo::refresh(); // Must Refresh the Internal Servo Control for (i=0; i<numpins; i++) { pinMode (pins,INPUT_PULLUP); if (digitalRead(pins)==LOW) { // Check if a Pushbutton is pressed pinval=!pinval; // Assume only one at a time if (pinval==true) servo.write(sstart); else servo.write(sstop); while (digitalRead(pins)==LOW) {SoftwareServo::refresh(); } // Wait until PB is released } pinMode(pins,OUTPUT); // Now go back to maintaining LEDs digitalWrite(pins,pinval[i]); } } [/i]
change the int SSTART and int SSTOP values to control the servo travel. I have these set at these numbers as a reference . 0 and 180 would be full swing and probably far to great for most servos.
Thanks for the code, it's been nearly 20 years since I've written any code and I've long since got rid of all my notes & books so I'm at a stage where I can modify a tweak existing code to suit my set up but I'm not able to write it from scratch yet. For anyone who's interested below is a subset of the code I've been playing with, I wasn't happy with the speed at which the servos moved so I've added a few loops with time delays o slowly step the servos across one degree at a time. #include <Servo.h> const int left = 45; const int right = 135; const int time_delay = 10; Servo turning1; int turning1position = left; void setup() { pinMode(6, INPUT); turning1.attach(A1); turning1.write(turning1position); } void loop() { if(digitalRead(6) == HIGH){ if(turning1position <= right){ turning1.write(turning0position); // write the next position to the servo delay(time_delay); turning0position++; } } if(digitalRead(6) == LOW){ if(turning1position >= left){ turning1.write(turning1position); // write the next position to the servo delay(time_delay); turning1position--; } } }