Arduino based servo point motors and options for controlling electrofrog polarity

My new layout uses servos for point motors, which don't come with an obvious option for changing electrofrog frog polarity.
I came across two potential options for switching, so thought I'd try them both out.
#modeltrains #modelrailways

Пікірлер: 40

  • @paulhooper4599
    @paulhooper459910 ай бұрын

    Hi, Great video and I like the servo mounts. I use servos and arduinos on my OO gauge layout though rather stupidly forgot completely about frog power on live points so am probably going to have to lift them and re-do to include it now that the points are getting grubby in places and don't make such good contact. I have picked up a few learnings from my project that may be of help to others.. a) You'd be surprised how much peak power the layout requires. Servos are very reactive to power fluctuations, and I had no end of problems running some locos where the servos would suddenly start jittering around. Solution - power them on their own 5v bus, not from the Arduino, and power the layout with a decent switching power supply - I use a Mean Well capable of supplying plenty of amps at 12 volts. 12v to 5v units drop the voltage for servos, PCA9685's and IR sensors. 12v to Arduinos. b) Use servo driver(s) like the PCA9685 or another chip designed for the job, with I2C network back to the Arduino. Big reduction in wiring & load on the processor board. Again, power it separately. c) You can also use the PCA9685 to control LEDs, I have them for my mimic control panel to show point positions. Can control multiple LEDs. again with only 2 wires (I2C network). I also discovered you can use the PCA9685 for common anode bi-colour LEDs which I have on my semaphore signals (red/green), by conecting +5v pin to the anode, then each cathode to the PWM pins - set them high and no current can flow, drop them low and current flows hence lighting the led. d) Always connect the -ve (ground) pins together on all Arduinos and other boards (not your track bus) so that everything has the same potential and therefore 'understands' what 'low' means. e) Understand live frog points & how to wire them BEFORE fixing them down - I didn't ! My layout has been built on a budget, no money for expensive point motors & all the modules that go with DCC that you see all over KZread. By using secondhand Ebay track, cheap Arduino (clone) processors, TCRT5000 IR detectors (mounted type), 9g servos and lots of hours frustrating, coding/debugging/recoding you can have a really good, sophisticated looking layout with automated signals through block detection, signals linked to point positions, at a sensible price. My time cost nothing, and I have a real sense of achievement and have learned so much. Enjoy your modelling!

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    10 ай бұрын

    Thanks for the comment Paul, you're definitely approaching this thing with the same mindset as me! Sorry about the points. If you're like me, you don't mind doing time consuming things but having to do them twice is extremely frustrating! Regards, Chris

  • @hkmikey377
    @hkmikey377Ай бұрын

    Can you please let me know the spec of the relay board, so I can hunt for something similar here in NZ

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    Ай бұрын

    Hi Mike - it's an 8 channel 5V relay board - on UK eBay. this kind of thing. The 5v is referring to the input control voltage, not the voltage passing through the relays. Regards, Chris www.ebay.co.uk/itm/262499095094?itmmeta=01HZA727S5842BF7M89DJWRQFV&hash=item3d1e2a5236:g:NdsAAOSwnNBXb~mS&itmprp=enc%3AAQAJAAAA4M3Ni0stWM9k2%2B1iEVyyHCRHcfamEqyhXseLfIc2hMkY0UW1ojipUnUvyTjteR%2FKF8SOlefU0pMYbtOwsBwg7Y%2BZiL1FMvwVBJ%2F04RuhKig555LNqJWGM03MwH0rNleQ%2F7vj6C%2Bc7k00ZjVhRCKsvW3dA8s0BO2BIWSHPKl02wDiVAhXx52LC1bh5GOD6RtoRfSMmjzTWVh5Lzv46OD1JpHWBQjJwbd7bQAmSkMdfiOnXpzL14ZFpPXH11ElVTLbcF4LycFWcQD611%2F3Z4XTvZ8BDRUK%2BM7%2FWiUWp0lNI9Q7%7Ctkp%3ABFBM9PyIx_pj

  • @hkmikey377

    @hkmikey377

    Ай бұрын

    ​@@WirenwoodModelRailway Many thanks, most helpful. I'm still at the very beginning of my JMRI /Arduino journey, so your videos are very useful thanks!

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    Ай бұрын

    @@hkmikey377 Thanks Mike, that's very kind. Best wishes, Chris

  • @prav1n73
    @prav1n736 ай бұрын

    Hi @WirenwoodModelRailway I was exactly looking for this and glad that I found it. Thank you so much for showing the way to sue relays for frog polarity using PCA9685. Just wondering if I can use it with DCC++EX as it is or should there any code changes required. Please advise. Thanks

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    6 ай бұрын

    Hi! Thanks for the kind words. Since I made the video I've moved on to DCC+Ex myself, but as an interface from JMRI. Is that how you're using it? How are you communicating the requirement to switch turnout/ relay to the Arduino? Regards, Chris

  • @prav1n73

    @prav1n73

    6 ай бұрын

    @@WirenwoodModelRailway This is the part that I am still figuring it out and would be helpful if I can learn from you. I am planning to use DCC ++ EX Rail to control turnouts, signals etc. and wondering how can I use your code (except CMRI part).

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    6 ай бұрын

    Ok so you need some kind of connection. Whatever you're using to control your layout, in that you instruct it to change some points. It needs to know, when you do that, to send a message to whatever it is that's controlling your relay and, presumably, servo. Do you have that bit sussed yet?!

  • @bjack8264
    @bjack82642 жыл бұрын

    Great video. What code did you add to allow the PCA9685 to control the relays and which row of pins on the PCA9685 did you connect the relays to?

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    2 жыл бұрын

    Hi Brian! I did a bit of Googling and found that there is a command in the Adafruit library that allows you to switch a PWM pin fully on or fully off - pwm.setPWM(pin, 4096, 0); for on pwm.setPWM(pin, 0, 4096); for off I should do a git repo but for the time being I've pased my current code into a pastebin which you should be able to access. Let me know if you have any questions. For cabling I have the first 8 pin sets on the PWM board for servos and the second 8 for corresponding relays. So the relay for pin 0 will be on pin 8 (you'll see in the code, this means that I can say something like 'after changing the servo on pin i, set the relay on pin i+8) Then the relays are connected to the yellow PWM pins on the PWM board. And I use one of the black and red, ground and 5v pints on the last set of 8 pins on the PWM board (they're free because the relay connections only use the yellow pin) to power the relay board itself. If you're not sure just let me know and I'll get you some photos. pastebin.com/VMP5iuiE

  • @bjack8264

    @bjack8264

    2 жыл бұрын

    @@WirenwoodModelRailway Thanks very much for the info and code. Like yourself I am very keen to use the Arduino to control the points etc. I am just at the stage of installing all the servos on the lower level. I originally started the arduino set up over a year ago as a test bed and was using two megas one for the servo and sensors and one for the relays. If this one works I can probably reduce this to one Mega. Keeping the other as a spare! Brian

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    2 жыл бұрын

    @@bjack8264 Good luck Brian I'll watch with interest. The biggest problem I'm still having with the servos is them getting random rogue values that send them mad and make them jump out of their mounts. I'll work it out though!

  • @richardwilkinson6462
    @richardwilkinson646211 ай бұрын

    I also use servo motors and like you have a chock block in the power feed wires. However i've used red and black up to the chock block then both green wires from the block to the frog microswitch

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    11 ай бұрын

    Thanks Richard! I don't know where I'd be without chock blocks! Regards, Chris

  • @zekesamazingtrainsandmore.1163
    @zekesamazingtrainsandmore.11632 жыл бұрын

    I used to have electric points on my old layout. 😃

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    2 жыл бұрын

    Me too!

  • @markdebsauzzietravels
    @markdebsauzzietravels9 ай бұрын

    Hi Chris Great vid while I was watching I had a thought (sorry I'm no wizard) but with the micro switches you are just reversing polarity of of the track pos to neg right ? well your micro switch is already doing it ?, I'm not sure if I'm right but that's the way I look at it and there fore you could do away with the relays?, on another note get your servos to the right angle to stop the chatter or they may burn out, one thing I have seen is code for the arduino that stop power to them once they have move to there position which will also help this problem hope this helps Cheers Mark

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    9 ай бұрын

    Hi Mark - lots of good ideas in there. I do have a few issues with servos - the chatter is sometimes caused by some kind of electrical interference and is there no matter where they stop - they also can suffer from electrical 'spikes' too - especially when the track power is on and trains are moving. I've tried cutting the PWM signal when they complete moving but when they suffer the spikes it means they move out of position and, as the PWM is no longer active, they don't move back to where they should be and I end up with derailments. You're right about the microswitches too but I ended up preferring the relays. Microswitches were a little too unreliable for me and I've ended up taking most of even the feedback switches off my layout in the end. I totally accept though that this is my decision - the 'cheap' option - there are more expensive solutions out there that won't have these issues but I like a challenge! Thanks for the suggestions, regards, Chris

  • @markdebsauzzietravels

    @markdebsauzzietravels

    9 ай бұрын

    Morning Chris I'm one for doing things on the cheap and do like the arduino's but when I looked at all the points I may end up with I decided to go down the route of rewiring servo motors for direct pos and neg and then using a 2way momentary switch this just gives power to the servo for the movement and then off and 2 micro switches for polarity and light settings ( as of now it is a DC layout) in the future I'm looking at using the arduino for a DCC-EX settup, hope you sort out all the little problems the spikes sound like a real PITA keep it KISS Cheers Mark

  • @davidcook380
    @davidcook3802 жыл бұрын

    Great Video I am thinking of going down the Arduino route , I have no knowledge of Arduinos can you please advise me on the cheapest Arduino available to just do point changing and software required , Regards Dave

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    2 жыл бұрын

    Hi Dave - well, the cheapest suitable one is the Nano, but that's a bit limited with connections. So maybe start off with an Uno? That's middle of the road. A PCA9685 board to drive the servos and the servo motors themselves. You only need the Arduino IDE software, which is free. Little Wicket has done some very accessible step by step videos on how to get started with it all. Good luck!

  • @davidcook380

    @davidcook380

    2 жыл бұрын

    @@WirenwoodModelRailway Thanks very much Dave

  • @chriscox4023
    @chriscox40235 ай бұрын

    Would it not have been easier to it the assembly with the servo nearest the joist. All the adjustments would be easier to access

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    5 ай бұрын

    It's a good suggestion - but the servos attach on the other side of the mount, so damned if I do and damned if I don't - if the servo fails - and I buy cheap ones so they do - then I need to be in from the other side! Regards, Chris

  • @user-pl6ms8gw1n
    @user-pl6ms8gw1n5 ай бұрын

    where can i get the white bracket from please

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    5 ай бұрын

    Hi - they're available through membership of the MERG - www.merg.org.uk/ Regards, Chris

  • @daviddanhauer9301
    @daviddanhauer93016 ай бұрын

    Has anyone seen shorts on the frog by the relay firing too quickly? What can you do to delay this occurring?

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    6 ай бұрын

    Hi David - wouldn't there need to be something that's drawing power (loco, lit coach etc) on the frog for it to short? In which case I wouldn't recommend switching points while a train is still travelling over them! Regards, Chris

  • @daviddanhauer9301

    @daviddanhauer9301

    6 ай бұрын

    @@WirenwoodModelRailway To clarify, I am using Peco Electrofrog turnouts. On some of the turnouts, it seems the frog polarity is changing faster than movement of the turnout, therefore causing a short. Would a “delay” command in the programming help with this? I am concerned about slowing down the “loop” too much if I needed to add too many “delay”s in the programming.

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    6 ай бұрын

    I think actually this might suggest an issue with the wiring / installation of the turnout - the frog should be entirely isolated from the rest of your layout and powered only by the relay - if you're getting a short when changing, it suggests that at one end or the other you have continuity. Imagine the frog as an X (it's actually an X rather than the V it appears to be) at the top two points of the X you should have insulating rail joiners connecting it to the ongoing track. At the bottom of the X the two small connectors bridging the gap between the frog and the lower turnout should have been cut. If both are done, the frog will be entirely isolated from track at both ends and will not trigger a short when it's moved. Regards, Chris

  • @daviddanhauer9301

    @daviddanhauer9301

    6 ай бұрын

    @@WirenwoodModelRailwaySo the only way to make these work is to cut the connections in the turnout?

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    6 ай бұрын

    @daviddanhauer9301 well if you didn't cut those connectors off, the frog is actually powered through connection to the track and might not need to be separately powered, from your relay, at all. Try disconnecting the frog from the relay then take a multimeter to it and see if it's still powered!

  • @patrickwalker6039
    @patrickwalker60397 ай бұрын

    I was interested to see your use of servo motors. I have just started looking at the possibility of introducing Arduino control for my servos after having rejected this originally and made my own version of multiple servo testers to control my electrofrog points. I finally standardised the design, after having built several servo controllers of various design to operate 4 crossovers and about 10 points, and now have 4 other crossovers and 12 other points operated with automatic switching for the frogs using the same controllers I have made from my standardised plans. You can see some of my results here kzread.info/dash/bejne/mWaXypaumLrAidY.html Cheers Patrick

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    7 ай бұрын

    Thanks Patrick! I watched your video, you have very in-depth electronics knowledge! Regards, Chris

  • @donniee1934
    @donniee1934 Жыл бұрын

    Why couldn't you just use the auxiliary contacts on the tortoise switch machine? It has 2 n.o. and 2 n.c. sets of contacts.

  • @WirenwoodModelRailway

    @WirenwoodModelRailway

    Жыл бұрын

    Thanks for the suggestion! Unfortunately i don't have any tortoise motors! Regards, Chris