No video

Routing Control for Your Model Railroad Layout with Arduino

  Рет қаралды 26,712

Ron's Trains N Things

Ron's Trains N Things

Күн бұрын

In this video I will demonstrate a process for routing control for your model railroad layout with Arduino. I needed a means to throw multiple switches to set routes through a hidden staging yard. I built a system for this using an Arduino Uno and a relay board. Let me show you how I did it.
✅ Want to get more RTNT? Consider becoming a channel member. Click the “Join” button or use this link to learn more: / @ronstrainsnthings
✅ Visit our sponsor, Midwest Model Railroad: www.midwestmodelrr.com
17331 E US Highway 40, Suite 107
Independence, MO 64055
(816) 399-5226
🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽
✅ RTNT Amazon Page: www.amazon.com/shop/ronstrain...
✅ Amazon Pick of the Week: Arduino: amzn.to/3UdJRqS
8 Relay Board: amzn.to/3eRFf9H
(NOTE: The above are Amazon affiliate links: I make a small commission from any purchased made through these links.)
✅ Save 10% on all regularly priced items from Micro-Mark: The Small Tool Specialists. Use promo code RTRAINS upon checkout. www.micromark.com/
(NOTE: The above link is an affiliate link. I receive a commission from all purchases made through this link. Exclusions: This offer cannot be combined with any other offers, not applicable to Pre-Orders, Digitrax, SoundTraxx, or 3D items, applicable to merchandise price only, shipping and handling fees not included, gift cards, or eGift certificates.)
✅ Find fantastic foam cutting tools and adhesives from Hot Wire Foam Factory at: hotwirefoamfactory.com/home.p...
(NOTE: The above link is an affiliate link. I make a small commission from any purchases made through this link.)
✅ Get RTNT merch at the RTNT Company Store: teespring.com/stores/rtnt-com...
🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽
Contents:
0:00 Intro
1:40 Components
2:10 Concept
3:15 Wiring
13:07 Arduino Sketch
18:55 Demonstration
🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽
🔸 Contact me via email: ronstrainsnthings@gmail.com
🔸 Join the Ron's Railfans community on Facebook: / ronsrailfans
🔸 Follow on Instagram: / rtrains
🔸 For more about my layout, the Texas Colorado & Western Railway, check out / tcwry
🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽
Credits:
🤘 Theme Song: "Extremes" by the Lemming Shepherds
Exzel Music Publishing (freemusicpublicdomain.com)
Licensed under Creative Commons: By Attribution 3.0
creativecommons.org/licenses/b...

Пікірлер: 66
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
See the entire project of building and controlling this staging yard here: tinyurl.com/yc62dc88
@MrDksmall
@MrDksmall Жыл бұрын
Your use of the term “normally on” could be confusing to some. The relay contacts are “normally open” (NO) and “normally closed” (NC). Normally open is not the same as normally on.
@IMRROcom
@IMRROcom Жыл бұрын
I'm fully enjoying your time back with us and your latest project.
@modelmantstewart1292
@modelmantstewart1292 Жыл бұрын
Hey Ron your right it's about as clear as mud it's amazing to me how much you go through now day to run a train layouts great video and thank you for sharing
@alessandrovignato7772
@alessandrovignato7772 Жыл бұрын
Hi Ron, just a suggestion: by wiring the relays as you did, short circuits can happen. For example, if R1 is on and R2 off the green wire will be connected to both red and black, and blue will short circuit aswell. This can be dangerous and can happen if, for example, you make a small coding mistake. I suggest you to rewire the relays, so that every relay controls the polarity of one wire. It is really easy to do: connect black and red to the outer connectors (NC and NO) and keep the green wire in the middle. This way, the green wire can either be connected to the black or blue one but not both at the same time. Then use the next relay to do the same for the blue wire. In the end it will look like this: red/green/black and red/blue/black. This way no short circuit can happen and I think it is much safer. If there is any error in the coding, both switch leads will have the same polarization and nothing will happen. It is much safer! Cheers
@peterwhiting6303
@peterwhiting6303 Жыл бұрын
He's correct. Infact, your code shorts out the signals every time you make a change. The relays are switched sequentially so for a few microseconds the red and black are shorted together. Having said that, arduino's ( and newer ESP32s etc ) are a great resource. I use them to switch points, signal between sections, control decoupling ramps, drive crossing gates, lights, drive semaphor signals and at the heart of my PCM power supplies.
@galenerickson7380
@galenerickson7380 Жыл бұрын
@@peterwhiting6303 Use dpdt relay to avoid problem and half of the logic.
@peterwhiting6303
@peterwhiting6303 Жыл бұрын
@@galenerickson7380 I use 2 i/o lines and mosfets with solenoid switches, so no relays.
@phyzzip
@phyzzip Жыл бұрын
I'm not even done the video and that issue is making me twitchy. Regarding someone else saying use DPDT (double post, double throw) relays. Yes, but keep in mind the relay module he's using (should) have the appropriate protection to keep the relays from frying the Arduino. So replacement relays need that as well, one can't just drop in a relay on its own.
@alessandrovignato7772
@alessandrovignato7772 Жыл бұрын
@@phyzzip yeah, I am disappointed he did not address this issue at all. It is outright dangerous if other people try this and do not have much experience with electronics.
@jhoodfysh
@jhoodfysh Жыл бұрын
Very interesting build Ron. I am looking forward to seeing the finalized build.
@westwonic
@westwonic Жыл бұрын
I bought an arduino starter set over a year ago for exactly this purpose, but have not had time to start. I am familiar with wiring of relays as my turnout frogs are controlled that way. Great to see your method, and I would really appreciate a look at your sketch. Thanks from the UK, and well done, a really good presentation.
@jeffharbin3221
@jeffharbin3221 Жыл бұрын
Really enjoyed your video describing relay controls. I am an electronic repairman working for the local steel mill now for 31 years. Your hard work describing how relay control and wiring them to match the design was amazingly simple to follow. Most instructional material start with the blue print side of the whole picture and move into the actual wiring content later. I was really amazed how clear you kept your message to us the viewer and not confuse yourself ! Outstanding job sir ! Looking forward to more of your videos
@RonsTrainsNThings
@RonsTrainsNThings 5 ай бұрын
Thank you. That is a real compliment since I am NO electronics expert and have to seriously think through the process myself.
@kevinheard8364
@kevinheard8364 Жыл бұрын
Very informative; and so glad it is working for you
@TTownTrainFan
@TTownTrainFan 10 ай бұрын
Great to meet you in person at the Texas Express Ron! This was a very informative video - I am working on EXACTLY this (lining routes into my staging and classification yards via direct Arduino control rather than sending DCC commands). SUBBED! 🙂
@RonsTrainsNThings
@RonsTrainsNThings 10 ай бұрын
Yes, was good to meet you too. I need to get down and operate on your layout sometime.
@gvet47
@gvet47 Жыл бұрын
I have used the Arduino to control multiple servos. Actually seen a 3D printed mounting to use a servo for throwing rail switches that looked to be a cheap alternative. That relay bank looks like a solution to controlling my small metal mill.
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
I designed such a bracket, which will be the subject of a future video.
@ModularRailroading
@ModularRailroading Жыл бұрын
Depending on the current draw of the tortoise switch machines you could also use a ULN2803A integrated circuit to control them from the Arduino. If you really wanted you could design a PCB in Kicad or a similar program that fits onto the Arduino directly and get a really compact setup. The IC mentioned above is also good for driving LEDs for building lights an similar use cases.
@rjl110919581
@rjl110919581 Жыл бұрын
thank you for sharing a great detailed video all great watching
@542643131
@542643131 Жыл бұрын
Good Job Very informative Ron thank you.
@tomt9543
@tomt9543 5 ай бұрын
Great video! Massive amount of info to convey here. Always enjoy your vids, and this one is no different, but I was out when the sketch thing appeared! Too much for this 64 yo brain to follow! But it will be massively helpful to many modelers! Keep up the great work!
@manshedrailroad
@manshedrailroad Жыл бұрын
Great job Ron! The Train Freak has some led turnout buttons that might be of interest to you.
@williamflowersrailfannerpr3808
@williamflowersrailfannerpr3808 Жыл бұрын
Awesome Ron 👌 👏 👍
@ronaldrondeau7870
@ronaldrondeau7870 Жыл бұрын
That is a great project very interesting
@music100vid
@music100vid Жыл бұрын
Thanks Ron for good ideas for making the control panel and using Ardurino to control the turnouts. I didn't see a button for the first turnout in the ladder, the one leading to the passing siding. It seems like you'd need a push button for that AND a separate one for the passing siding turnouts. Maybe I'm missing something. Anyway, thanks for showing us this cool project.
@bobmay1515
@bobmay1515 Жыл бұрын
Ron, NO is "normally open" and NC is "normally closed" in relay terminology
@DIYDigitalRailroad
@DIYDigitalRailroad Жыл бұрын
That's a fine looking arduino project!
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
Thanks, Jimmy.
@randydobson1863
@randydobson1863 Жыл бұрын
HELLO RON ITS IS RANDY AND I LIKE U VIDEO IS COOL RON THANKS FRIENDS RANDY
@JumbleLane
@JumbleLane 5 ай бұрын
Hi Ron, I appreciate that it has been a year since making this video. However, have you considered making the relay boards yourself. There is more than one reason why I suggest this. Firstly, your schematic while correct works ok, if a relay does not switch there is a situation where there would be a short. Your system relies on BOTH relays for each pair to operate together. If you replaced the relays for DPDT you would have one relay switching two lines and also you would only use half the relays. The common terminal of each pole would connect to + & - respectively and the motor to the NC of each pole. You would connect NC of one pole to the NO of the other pole on both poles. This way of doing things would also eliminate any problems in mis-coding an output and not firing both relays at the same time. Regards, Geoff.
@terrymann9723
@terrymann9723 8 ай бұрын
Awesome Video! Where did you purchase the ribbon cable and temporary buttons?
@malparks6263
@malparks6263 Жыл бұрын
Hi Ron , Enjoy all your videos, where can I download the sketch for my Arduino.
@larrytaylor7753
@larrytaylor7753 Жыл бұрын
Very interesting. I’ve written some Arduino Sketches. You got that one very clean. If a viewer wants to build a similar set of switches, can the sketch be downloaded?
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
I am building a new website that will include free resources including this sketch. Coming very soon.
@kurtstrains
@kurtstrains Жыл бұрын
You can run both relays for a turnout with one arduino pin
@ethanmcswain2700
@ethanmcswain2700 7 ай бұрын
Is it possible to automate the shunting process too?
@rickmiller595
@rickmiller595 Жыл бұрын
Form C relays, NC/C/NO
@trainfan92756
@trainfan92756 Жыл бұрын
Speaking of which how do i find a good switcher engine for my Layout cause I've looked on the Midwest model railroad website multiple times and i haven't been able to find anything
@charleskreienheder4908
@charleskreienheder4908 Жыл бұрын
Nugget has the exact same relay board set up to control the heaters/lights/fogger on his 🐍 tank. You remember Nugget right?
@rf64
@rf64 5 ай бұрын
Very Good . But where I can get a copy of the Arduino Sketch . I not in programming with Arduino but I start to try. So is it possible get the sketch ? Thank You for the help.
@terrymann9723
@terrymann9723 8 ай бұрын
Awesome Video Ron! Where did you purchase the Ribbon Cable, and the buttons you used on the bread board?
@RonsTrainsNThings
@RonsTrainsNThings 8 ай бұрын
All of the parts are available on Amazon.
@terrymann9723
@terrymann9723 8 ай бұрын
@@RonsTrainsNThings Is there a particular type? Do they come with clips? Do you happen to have links? This is all new to me, Thanks for the help
@AbelG8781
@AbelG8781 Жыл бұрын
Dang Ron, too technical for this 27 year old lol I'll stick with Walthers Layout control until my brain can process what I just watched 🤣🤣
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
🤣🤣🤣 It is easier than you think.
@craiginboro679
@craiginboro679 7 ай бұрын
Surely if you used the common of the relay as your output and you supplied the (NO) with+12v and the (NC) -12v from the ATX power supply then you would only need 1 relay instead of 2, you would need to control the voltage level after the output to control power levels.
@erniepike3902
@erniepike3902 2 ай бұрын
Im workingon Arduino code for crossover and wye interlockings and pannel board lights. I have yet to find a purpose build control that will control multiple switches in relation to each other.
@jerrysmith1929
@jerrysmith1929 Жыл бұрын
No doubt I'm showing my ignorance, but why not use LCC to do this?
@dgt42666
@dgt42666 Жыл бұрын
likehow you did it any chance of downloading code
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
I am working on a new website which will include some free resources including this sketch. Coming very soon.
@jimmain2014
@jimmain2014 Жыл бұрын
There is another way which will eliminate the second relay. What you need is the 12 supply and 2 1000 ohm 1/4 watt resistors for each tortoise. I can't draw pictures so use visualization. Draw a horizontal line for +12 volts. From that line attach one end of the 1000 ohm resistor to +12 and the other end to one of the motor leads on the tortoise and repeat for the other motor lead. Now run your wires from the tortoise to the outer leads of the relay. Finally run the return lead from the 12 volt power supply to the common or center lead of the relay. Now what happens is you are switching the +12 volt power from one tortoise motor lead to the other and the opposite lead is pulled to the +12 return. Energize the relay and it reverses the connections. The resistors limit the current to about 12 milliamps which is sufficient to run the motor . You can use the same circuit with a SPDT toggle switch.
@jimmain2014
@jimmain2014 Жыл бұрын
One more thing, there is no chance of a short circuit happening since you are using only one relay. The resistors limit the current.
@HumancityJunction
@HumancityJunction Жыл бұрын
Oh no, you said Arduino. :) Why Arduino over using Digitrax, NCE, DCC Concepts, etc... solutions?
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
A, because I don't have any of those systems. B, because I do NOT want to control them through my DCC system. C, because Arduino is a TON cheaper.
@HumancityJunction
@HumancityJunction Жыл бұрын
@@RonsTrainsNThings thanks for the response. I didn’t realize you were not using one of the main commercial products for locomotion control.
@RonsTrainsNThings
@RonsTrainsNThings Жыл бұрын
@@HumancityJunction No, I have an old MRC Prodigy Advanced² that has been upgraded a few times.
@Conrail1731
@Conrail1731 Жыл бұрын
Thanks for sharing the information but I think I hurt my brain ( just a small sprain but i'll recover) 🤣🤣😂😂🤷‍♂🤷‍♂
@milkymoocowmoo
@milkymoocowmoo Жыл бұрын
Ron, what is your thought process behind reading for a button press and then release? I think you are overcomplicating things! All you need is something like "if (digitalRead(button1) == LOW)" followed by your relay code, because even the briefest of presses is going to seem like eons to the Arduino (which is running such a simple loop many thousands of times/sec). Once the if statement condition has triggered (button1 has gone LOW) the Arduino is going to run the relay code to completion before it moves on, regardless of whether the button stops being pressed or not (which it won't be checking for anyway, it's busy executing the relay code). Whether the button *isn't* being pushed is irrelevant anyway, because the code isn't checking for that. All the Arduino knows is- button pushed -> put relays in x state. Additionally, there's no need for debounce here because each button is linked to a single state. If for example you had a turnout that flipped its position when a button was pushed, *that* would need debounce, because it's a toggle. Yes, the simplified if statement I described above would run several times each push owing to the Arduino's clock speed...but so what? On the first loop it sets your relays to the desired state, on the second loop it effectively does nothing because your relays are already in the desired state, and so on.
@mikehowey4869
@mikehowey4869 Жыл бұрын
Way to technical for me.It's interesting watching and listening to how you accomplished all of it though.
@TekgraFX101
@TekgraFX101 6 ай бұрын
Normal on is not the proper phrase
Easy Control Panel for Your Model Railroad Layout
9:44
Ron's Trains N Things
Рет қаралды 39 М.
Controlling Model Railroad Switches with Arduinos!
14:11
DIY and Digital Railroad
Рет қаралды 20 М.
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 29 МЛН
Behind the Scenes Basement Tour from RTNT
18:50
Ron's Trains N Things
Рет қаралды 14 М.
DCC++EX: A Cheap DIY DCC System?!?! This is a Model Railroad Game Changer
17:54
DIY and Digital Railroad
Рет қаралды 83 М.
Painting model railroad backdrops: Sky and Clouds
29:27
Alkem Studios
Рет қаралды 7 М.
Easy Inexpensive Video Monitor for a Model Railroad
6:57
Ron's Trains N Things
Рет қаралды 10 М.
SpaceX Finally Gives Out The BIG Starship News!
21:27
What about it!?
Рет қаралды 427 М.
Model Railroad Yards--Design for Operations
20:01
Ron's Trains N Things
Рет қаралды 243 М.
The Greenwich Meridian is in the wrong place
25:07
Stand-up Maths
Рет қаралды 599 М.
Model Railway Automation using JRMI Dispatcher and Simple Signal Logic
40:40
Little Wicket Railway
Рет қаралды 45 М.
Easy Arduino Current Sensing for Occupancy Detection
14:08
DIY and Digital Railroad
Рет қаралды 21 М.
The Clever Way to Count Tanks - Numberphile
16:45
Numberphile
Рет қаралды 821 М.