Routing Control for Your Model Railroad Layout with Arduino

Поделиться
HTML-код
  • Опубликовано: 1 дек 2024

Комментарии • 66

  • @RonsTrainsNThings
    @RonsTrainsNThings  2 года назад +2

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

  • @alessandrovignato7772
    @alessandrovignato7772 2 года назад +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 2 года назад +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 2 года назад +2

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

    • @peterwhiting6303
      @peterwhiting6303 2 года назад +2

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

    • @phyzzip
      @phyzzip 2 года назад

      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 2 года назад

      @@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 2 года назад +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  9 месяцев назад

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

  • @modelmantstewart1292
    @modelmantstewart1292 Год назад +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 2 года назад +2

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

  • @gvet47
    @gvet47 2 года назад +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  2 года назад +1

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

  • @MrDksmall
    @MrDksmall 2 года назад +9

    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.

  • @westwonic
    @westwonic Год назад +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 2 года назад +1

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

  • @JumbleLane
    @JumbleLane 9 месяцев назад

    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.

  • @DIYDigitalRailroad
    @DIYDigitalRailroad 2 года назад +2

    That's a fine looking arduino project!

  • @TTownTrainFan
    @TTownTrainFan Год назад +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  Год назад

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

  • @manshedrailroad
    @manshedrailroad 2 года назад +2

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

  • @tomt9543
    @tomt9543 9 месяцев назад +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!

  • @rjl110919581
    @rjl110919581 2 года назад +2

    thank you for sharing a great detailed video
    all great watching

  • @542643131
    @542643131 2 года назад +2

    Good Job Very informative Ron thank you.

  • @williamflowersrailfannerpr3808
    @williamflowersrailfannerpr3808 2 года назад +2

    Awesome Ron 👌 👏 👍

  • @kevinheard8364
    @kevinheard8364 2 года назад +2

    Very informative; and so glad it is working for you

  • @ronaldrondeau7870
    @ronaldrondeau7870 2 года назад +3

    That is a great project very interesting

  • @randydobson1863
    @randydobson1863 2 года назад +2

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

  • @ModularRailroading
    @ModularRailroading 2 года назад

    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.

  • @bobmay1515
    @bobmay1515 2 года назад +4

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

  • @music100vid
    @music100vid 2 года назад

    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.

  • @terrymann9723
    @terrymann9723 Год назад +1

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

    • @RonsTrainsNThings
      @RonsTrainsNThings  Год назад

      All of the parts are available on Amazon.

    • @terrymann9723
      @terrymann9723 Год назад

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

  • @terrymann9723
    @terrymann9723 Год назад

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

  • @W7LDT
    @W7LDT 2 года назад +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  2 года назад +3

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

  • @charleskreienheder4908
    @charleskreienheder4908 2 года назад

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

  • @malparks6263
    @malparks6263 Год назад

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

  • @erniepike3902
    @erniepike3902 6 месяцев назад

    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.

  • @ethanmcswain2700
    @ethanmcswain2700 11 месяцев назад

    Is it possible to automate the shunting process too?

  • @rf64
    @rf64 9 месяцев назад

    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.

  • @trainfan92756
    @trainfan92756 2 года назад +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

  • @craiginboro679
    @craiginboro679 11 месяцев назад

    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 2 года назад +2

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

  • @jerrysmith1929
    @jerrysmith1929 2 года назад

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

  • @HumancityJunction
    @HumancityJunction 2 года назад +3

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

    • @RonsTrainsNThings
      @RonsTrainsNThings  2 года назад +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 2 года назад +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  2 года назад

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

  • @dgt42666
    @dgt42666 2 года назад +2

    likehow you did it any chance of downloading code

    • @RonsTrainsNThings
      @RonsTrainsNThings  2 года назад +4

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

  • @jimmain2014
    @jimmain2014 2 года назад +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 2 года назад

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

  • @AbelG8781
    @AbelG8781 2 года назад +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 🤣🤣

  • @rickmiller595
    @rickmiller595 2 года назад

    Form C relays, NC/C/NO

  • @milkymoocowmoo
    @milkymoocowmoo 2 года назад +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.

  • @Conrail1731
    @Conrail1731 2 года назад +1

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

  • @mikehowey4869
    @mikehowey4869 2 года назад

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

  • @TekgraFX101
    @TekgraFX101 10 месяцев назад

    Normal on is not the proper phrase