Routing Control for Your Model Railroad Layout with Arduino

Sdílet
Vložit
  • čas přidán 8. 09. 2024

Komentáře • 66

  • @RonsTrainsNThings
    @RonsTrainsNThings  Před 2 lety +2

    See the entire project of building and controlling this staging yard here: tinyurl.com/yc62dc88

  • @alessandrovignato7772
    @alessandrovignato7772 Před rokem +12

    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 Před rokem +3

      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 Před rokem +2

      @@peterwhiting6303 Use dpdt relay to avoid problem and half of the logic.

    • @peterwhiting6303
      @peterwhiting6303 Před rokem +2

      @@galenerickson7380 I use 2 i/o lines and mosfets with solenoid switches, so no relays.

    • @phyzzip
      @phyzzip Před rokem

      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 Před rokem

      @@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.

  • @jeffharbin3221
    @jeffharbin3221 Před rokem +1

    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  Před 6 měsíci

      Thank you. That is a real compliment since I am NO electronics expert and have to seriously think through the process myself.

  • @gvet47
    @gvet47 Před rokem +4

    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  Před rokem +1

      I designed such a bracket, which will be the subject of a future video.

  • @MrDksmall
    @MrDksmall Před rokem +8

    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.

  • @modelmantstewart1292
    @modelmantstewart1292 Před rokem +2

    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

  • @IMRROcom
    @IMRROcom Před rokem +2

    I'm fully enjoying your time back with us and your latest project.

  • @westwonic
    @westwonic Před rokem +1

    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.

  • @jhoodfysh
    @jhoodfysh Před rokem +1

    Very interesting build Ron. I am looking forward to seeing the finalized build.

  • @tomt9543
    @tomt9543 Před 6 měsíci +1

    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!

  • @TTownTrainFan
    @TTownTrainFan Před 11 měsíci +1

    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  Před 11 měsíci

      Yes, was good to meet you too. I need to get down and operate on your layout sometime.

  • @bobmay1515
    @bobmay1515 Před rokem +4

    Ron, NO is "normally open" and NC is "normally closed" in relay terminology

  • @JumbleLane
    @JumbleLane Před 6 měsíci

    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.

  • @manshedrailroad
    @manshedrailroad Před rokem +2

    Great job Ron! The Train Freak has some led turnout buttons that might be of interest to you.

  • @DIYDigitalRailroad
    @DIYDigitalRailroad Před rokem +2

    That's a fine looking arduino project!

  • @rjl110919581
    @rjl110919581 Před rokem +2

    thank you for sharing a great detailed video
    all great watching

  • @ronaldrondeau7870
    @ronaldrondeau7870 Před rokem +3

    That is a great project very interesting

  • @ModularRailroading
    @ModularRailroading Před rokem

    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.

  • @kevinheard8364
    @kevinheard8364 Před rokem +2

    Very informative; and so glad it is working for you

  • @542643131
    @542643131 Před rokem +2

    Good Job Very informative Ron thank you.

  • @randydobson1863
    @randydobson1863 Před rokem +2

    HELLO RON ITS IS RANDY AND I LIKE U VIDEO IS COOL RON THANKS FRIENDS RANDY

  • @williamflowersrailfannerpr3808

    Awesome Ron 👌 👏 👍

  • @music100vid
    @music100vid Před rokem

    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.

  • @craiginboro679
    @craiginboro679 Před 8 měsíci

    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.

  • @kurtstrains
    @kurtstrains Před rokem +2

    You can run both relays for a turnout with one arduino pin

  • @charleskreienheder4908

    Nugget has the exact same relay board set up to control the heaters/lights/fogger on his 🐍 tank. You remember Nugget right?

  • @terrymann9723
    @terrymann9723 Před 10 měsíci +1

    Awesome Video Ron! Where did you purchase the Ribbon Cable, and the buttons you used on the bread board?

    • @RonsTrainsNThings
      @RonsTrainsNThings  Před 10 měsíci

      All of the parts are available on Amazon.

    • @terrymann9723
      @terrymann9723 Před 9 měsíci

      @@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

  • @W7LDT
    @W7LDT Před rokem +3

    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  Před rokem +3

      I am building a new website that will include free resources including this sketch. Coming very soon.

  • @AbelG8781
    @AbelG8781 Před rokem +4

    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 🤣🤣

  • @terrymann9723
    @terrymann9723 Před 10 měsíci

    Awesome Video! Where did you purchase the ribbon cable and temporary buttons?

  • @malparks6263
    @malparks6263 Před rokem

    Hi Ron , Enjoy all your videos, where can I download the sketch for my Arduino.

  • @Conrail1731
    @Conrail1731 Před rokem +1

    Thanks for sharing the information but I think I hurt my brain ( just a small sprain but i'll recover) 🤣🤣😂😂🤷‍♂🤷‍♂

  • @rf64
    @rf64 Před 6 měsíci

    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.

  • @rickmiller595
    @rickmiller595 Před rokem

    Form C relays, NC/C/NO

  • @erniepike3902
    @erniepike3902 Před 3 měsíci

    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.

  • @trainfan92756
    @trainfan92756 Před rokem +1

    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

  • @jimmain2014
    @jimmain2014 Před rokem +1

    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 Před rokem

      One more thing, there is no chance of a short circuit happening since you are using only one relay. The resistors limit the current.

  • @ethanmcswain2700
    @ethanmcswain2700 Před 8 měsíci

    Is it possible to automate the shunting process too?

  • @HumancityJunction
    @HumancityJunction Před rokem +3

    Oh no, you said Arduino. :)
    Why Arduino over using Digitrax, NCE, DCC Concepts, etc... solutions?

    • @RonsTrainsNThings
      @RonsTrainsNThings  Před rokem +3

      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 Před rokem +2

      @@RonsTrainsNThings thanks for the response. I didn’t realize you were not using one of the main commercial products for locomotion control.

    • @RonsTrainsNThings
      @RonsTrainsNThings  Před rokem

      @@HumancityJunction No, I have an old MRC Prodigy Advanced² that has been upgraded a few times.

  • @jerrysmith1929
    @jerrysmith1929 Před rokem

    No doubt I'm showing my ignorance, but why not use LCC to do this?

  • @milkymoocowmoo
    @milkymoocowmoo Před rokem +1

    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.

  • @dgt42666
    @dgt42666 Před rokem +2

    likehow you did it any chance of downloading code

    • @RonsTrainsNThings
      @RonsTrainsNThings  Před rokem +4

      I am working on a new website which will include some free resources including this sketch. Coming very soon.

  • @mikehowey4869
    @mikehowey4869 Před rokem

    Way to technical for me.It's interesting watching and listening to how you accomplished all of it though.

  • @TekgraFX101
    @TekgraFX101 Před 7 měsíci

    Normal on is not the proper phrase