Status of my servo controller project

Been a while, but I finally had time to work on it, and I now have a breadboard prototyype fully functional, with completed software.

A little different than my original design, this one now has 2 relays per turnout, one that turns off the frog power, and one that sets the polarity. Soo even touchy turnouts like old Walthers/Shinohara can work with no special mechanical alignment of the relay. When an input is received, first the frog power is cut off, then the servo moves to position, then the frog polarity is set, the LED indicators are set, and the frog power is applied. No chance of a short.

There are also remote lock and remote move inputs, these will come from my sort-of CMRI node boards when I get those designed.

Position is saved by writing to the microcontroller’s EEPROM. Writes are spread out so that by the time any position hits the datasheet recommendation of 100K writes, withg normal usage it will be more than 50 years from now. So I’m not worried.

You can leave off parts you don’t need. If you don;t need frog polarity, leave off the relays. if you just need polarity but not the power control, you can leave out the one relay. If you don;t need remote control (I plan to use the same circuit for my yard) you can leave off the connections and protection resistors for the remote inputs. Or no buttons, you can leave off the components associated with the buttons.

I will be demonstrating the prototype this Friday night and Saturday at the Reading Modelers Meet. While the focus of the show is on prortpye modeling, the guy running it said to bring my stuff. I doubt too many will be interested, but I will be there anyway. He said something about a clinic next year - perhaps I will have the PCB for this circuit plus at least a protoype working for my ‘sort of’ CMRI nodes that will drive the turnouts, signals, and read block detectors.

Interesting. So am I correct in assuming by using the two relays no microswitches are required? Would that mean the only required adjustment would be servo throw and servo throw adjustment is in the software?

Yup, and depending on the mounting, there may be little reason to adjust the throw - certainly not for each and every unit, once you figure out a value that works.

There is a commercial product that also uses the double relay system. They offer it as an option - you can get their unit with no relay (use a microswitch, or a Frog Juicer), one relay (most DCC friendly turnouts truly only need a single relay, as the point rails at least are electrically tied to the adjacent stock rail and so never have opposite polarity from the stock rail they are touching), or two relays, working as mine do, where power is completely removed before movement starts, then the polarity is set after movement stops, and finally power is restored. The older non-DCC friendly Shinohara turnouts are the ones that most need this, because both point rails are the same polarity, and the same polarity as the frog, so if the frog polarity changes before the point rails movbe, there’s a short, or if the point rails finish mocing before the polarity changes, there’s a short.

I had the extra outputs, so i added the feature. Removing it does ntoo free up enough IO pins to make each board control 3 servos, so I figured why not. If you don’t need it, you can leave off the relay, drive transistor, and resistor.

–Randy

Randy

I have a servo question for you. To maintain rail contact to insure the moving rail is close enough to prevent a wheel from climbing the point and derailing the servo needs to apply slight pressure against the rail. I’m using the Tower Pro 90 servos with a UNO driver and Atlas Custom Line turnouts. The servo doesn’t draw the same amount of current at the end of activation. The servo idle current varies from 4ma to 13ma on each activation from the UNO.

I’m worried about long term current draw heating up the servo motor. If I back off the slight end travel current to 0 the rail points can shift a bit with the vibration from moving locomotives enough to catch a wheel flange.

What am I doing wrong?

Mel

My Mod

You aren’t doing anything wrong. The onl way to get a servo to 0 current draw is to cut the power off completely (Servo.disconnect() in Arduino does not cut the power, just the signal). Ordinarily a servo always draws some power as it maintains position. How much depends on how hard it has to keep pushing, up to the limit of the servo. I use those same servos - and they cna draw pretty much current if jammed up. Just try to gently force one out of position once it reaches the end of travel. They buzz loudly and current spikes way up. Not going to harm the Arduino, the power does not come from the signal line, and you should not power more than one servo from the Arduino’s on board regulator. If you’re only getting 4ma then they won’t heat up, and you’ve got that tweaked about as close to perfect as you can.

The rest is all mechanical. The way you are pivoting the actuating wire, the distance between that fulcrum and the servo vs the distance between the fulcrum and the throwbar, and the thickness of the music wire used all determine just how hard you have to push the servo to maintain a good point/stock rail contact. I don;t use ver heavy wire, .032 was fine for Atlas turnouts through 4" of extruded foam plus cork roadbed on top. I could move the points and when I let them go they would snap against the stock rail, yet the servo was quiet. I used the Tam Valley controllers on that layout, and never had a problem with the servos heating up. Never measured the current draw. I had about 10, running on the track power bus of my Zephyr (rails were powered from a separate booster). Your current readings are well below what my prototype is drawing, at least according to my bench power supply. I get nearly 200ma just sitting there, no servos moving (and they aren;t physically hooked to anything either, just sitting on the bench). That’s with all relays de-energized as well. When the relays move it spikes higher - I had to set the current limit over 500ma to keep it from

I’m going to be using MEGA2560 R3 for my servo controllers. I’m using a UNO for testing. So you would say the max 13ma idle current shouldn’t hurt the servo motor. If I cut back the movement the servo it won’t reliably keep the points touching the rails. I played around with the fulcrum point to get the best throw arm ratio and centering. One out of three or so operations end up at 10 ma to 13ma on the CW end, the CCW end stays at about 4ma every time.

I guess I will let a servo sit at 13 ma at idle and see what happens.

You are correct about the high current, if I hold the actuator arm the current easily goes past one amp, they are pretty powerful for their size. Normal movement is under 30ma, servo speed doesn’t have any impact on the current.

By the way I bypass the Arduino regulators in all of my Arduinos, I power the processors with 5 volts from 8 amp DC to DC convertors powered from a 12 volt 30 amp switching power supply.

If the current is much higher in one direction, you probably can back off a little ont he high side and still have it push hard enough. It might be catching on the hole, so it’s just bending the wire and not actually putting any more pressure on the throwbar. I ran into that a few times when I didn;t have the hole cleaned out quite good enough, but since mine was through foam, it was easy enough to clean it out without taking everything apart. Next time it will be plywood, so not as easy to fix. I’d really like to just stick the servos right to the underside, on their sides, with no special mount, but the laser cut plywood mounts that Tam Valley has make it pretty easy and might be worth the cost. Or an excuse to get a laser cutter and make my own.

I have one I was using for testing that uses the old Tam Valley/Motrak resin mount, stuck right to the button of a Peco turnout. Without removing the spring, it needs hardly any servo movement to move the points. But that would require routing out a huge hole under every turnout to drop it all in from the top. I’d rather use some sort of mount that allows for a bit of an over center action, so it’s not the servo holding the points, but the springyness of the wire. Short servo throw and at the ends barely any force back on the servo unless you try to manually pull the points to the opposite side.

One thing - most of these servos can’t actually do the whole range allowed by the Servo library. I find most of them can only go about 15 to 165 tops, try to go any closer to 0 or 180 and they just stall and draw high current. Default values in my prototype at 40 to 140, and that’s actually too far for the directly mounted example I mentioned above. It never reaches either limit without buzzing loudly, so i quickly pulled it and connected a loose servo that could turn freely. Final numbers won’t come until I decide on a mount and mock it up with a real turnout.

&nbs

The Tower Pro servos are squirrelly between 0 and 10 so keeping the swing to 90° between 45 and 135 works the best for me. I’ve had pretty good luck using 90° bellcranks on my turnouts in the past.

One Tortoise operates all four sets of point rails on my Mel made double crossover.

My double crossover has worked flawlessly for several years with one Tortoise. A servo should work but I’m worried about the idle current, not a problem with a Tortoise. Maybe a larger servo would work better than a Tower Pro.

I’m going to experiment with a Mel mod Atlas turnout to see how much it takes to move the throw bar with the Peco type spring action.

You’ve posted that phrase before but this is the first time I’ve seen a picture.

I nominate you for MR Wizard of 2018.

Thank you Henry, if you would like to see more of my Wizardry here is a link to the construction of the Mel made double crossover.

http://melvineperry.blogspot.com/2012/06/june-25-2012-my-double-crossover.html

Back in the early 90s and again in the early 2000s I tried every manufactured code 83 double crossover made. The only one that would pass my large flange Rivarossi Cab Forwards without problems was the Fast Track and I found it to complicated (frog power) for what I wanted. The answer was to make my own. All my Cab Forwards would easily clear code 83 Atlas Custom Line Turnouts without any problems so I did it to it.

Mel

My Model Railroad

I still think you are OK current-wise. It’s hard to find specs on the 9G servos, but 14ma is nearly as low as a Tortoise, and the 4ma side is lower than any Tortoise will stall at. Given that the average operating current of the servo is somewhere around 400ma, with a peak of near 1A, 14ma is nothing.

–Randy

I missed stated the current, the servo idle current its self is 14 ma and with slight pressure on the actuator increases the 14ma (no signal) by an additional 4ma CCW and 13ma CW.

Mel

My Model Railroad
http://melvineperry.blogspot.com/

Bakersfield, California

I’m beginning to realize that aging is not for wimps.

Randy:

Great progress!

Dave

wouldn’t the servo be more likely to hold it position w/o being powered/pulsed if the endpoints are near their extremes?

any back pressure would NOT be tangential, causing the arm to rotate

even if 0-180 deg travel is not possible, anything near the extremes may be enough

That’s sort of the idea of figuring a mount that goes over center. Although I’m not sure even that is needed, actually. Before I hooked up all of the Tam Valley Singlet controllers on my old layout, I would just reach under and turn the servo by hand. Even with no power applied there was no issue keeping the points tight enough. You definitely don’t need to go a full 0-180 to get to a point where the back pressure is pushing the servo further in the direction of travel instead of resisting it.

–Randy

That’s perhaps the one downside of Mel’s one motor for 4 sets of points approach - it has to be all in pretty good adjustment to get them to all equally move. With a Tortoise, it makes sense, they aren’t cheap. But considering 4 servos are still cheaper than one Tortoise, each could be individually powered without all the complex mechanical design.

Randy

That’s what I have in mind, but . . . . I can’t help hearing “if it ain’t broke don’t fix it” rattling around in my skull.

That’s been with me all my life and I believe I’ll stick with it replacing switch machines. My intent is to only switch to servo control on an as needed basis as the 30 year old Atlas turnouts or under table #65s quit. I’ve been doing my Peco conversion for a couple of years and they most likely will be working when I’m not here anymore.

For now my plan is to come up with a mount similar to my Peco conversion using servos that can just drop in from the top. My knees and back crapped out several years ago so crawling under is a no go.

That’s a lot like the one I put together just to test, the servo is stuck right to the bottom of the turnout like a Peco switch motor. Not sure if I want to go that way or not - since my layout will be new, I think I’d rather drill a hole than cut out a big opening to fit a Peco motor/servo from the top. Two layouts ago it was also foam, and I mounted my Tortoises from the top, but the last one, while also foam, I mounted the servos on the bottom and just drilled a hole. This time it will be plywood, so I’m leaning towards the bottom mount.

–Randy

Being stuck in my chair I got out a Tower Pro SG 90 and a code 83 Atlas Custom Line #6 along with my digital calipers and this is what I come up with.

I was aiming at 90° servo swing so that it can have a realistic slow movement. I haven’t tried the design yet but normally if it works on my CAD it works when I build it.

It still requires a 2” hole but that’s a bunch easier on my knees than crawling under, shucks I can’t even walk today without pain let alone crawl.

EDIT:

I found an error, the throw arm moves down in the center position .1". A keeper at the pivot point and a slot on the actuator arm would fix it.

Mel

Actually it was a rather easy fix by cutting the servo travel to 53°. I wanted more swing but this should work pretty good.

By adding a couple of lever action micro switches to the side of the servo that the actuator could trip they could power the frog if needed as well as position indicators.

Mel

My Model Railroad

With less travel, you just need to use smaller steps, I don’t know how you are doing the servo move, but I use the Metro library to do multiple timing dependent things all at the same time - check for button presses, move the servos, check for remote inputs. You create a Metro object for each item, setting the delay in milliseconds, and then in the main loop you just check each metro object with an if. Makes it easy peasey to do multiple things without all sorts of variables and checking against millis(). And you get automatic debounce of the buttons, since it only checks the state once per however many microseconds you configure it for. For my servos, right now I have it set to move a specified increment every 50 milliseconds. The the following code in the loop checks for the servo and either moves it or, if it is at the end position, sets the LEDs and other variables, and then writes the EEPROM.

if (servo1Metro.check() == 1) { // Servo 1 movement control
// Move interval for Servo 1
if (servo1move) {
// Servo is moving)
if (servo1pos <= servo1min || servo1pos >= servo1max) {
// if we reached the end of travel
if (servo1dir == 1) {
// reverse
sw1nstate=LOW;
sw1rstate=HIGH;
sw1frstate = HIGH;
sw1prstate = LOW;
servo1pos = servo1max;
servo1move = false;