Easy Model Train Automation with an Arduino: Stopping and Starting a locomotive

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 เม.ย. 2024
  • SUBSCRIBE TO BE ELIGIBLE FOR THE 10,000 SUBSCRIBER GIVEAWAY SPONSORED BY TRAINWORLD!
    Check out our sponsor!
    www.trainworld.com
    Entry video
    • 10,000 Subscriber Give...
    Check out my Etsy Store!
    www.etsy.com/shop/DIYandDigit...
    Check out Building 4!
    www.etsy.com/listing/81375658...
    Today we are doing a little bit of layout automation with arduinos. This will work with both DC and DCC. We will be making a model train stop and start automatically once a sensor is tripped using an arduino, a relay, and an infrared sensor.
    Download Sketch
    drive.google.com/file/d/10alY...
    Arduino IDE
    www.arduino.cc/en/main/software
    Arduino UNO
    amzn.to/2NjCe1e
    Relay
    amzn.to/2NkPDGd
    Sensor
    amzn.to/2CuQ4vp
    Samaritan’s Purse
    www.samaritanspurse.org/
    Camera Used
    amzn.to/2X87yWR
    Support the channel with some Merchandise!
    teespring.com/shop/diy-digita...
    You can contact me at diyanddigitalrr@gmail.com
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 82

  • @gamepad3173
    @gamepad3173 ปีที่แล้ว +5

    Hey there Jimmy this is exactly what I've been looking for my G scale garden railroad as I want my passenger and freight trains to stopping and going to and from various stations. while at the yards I'd want shunter locomotives to be moving around cars to create either long freight or long passenger trains.

  • @AGY_MTN_RR
    @AGY_MTN_RR 3 ปีที่แล้ว

    Great video Jimmy. I bought a sensor/reverser to do something just like that. Very cool. Keep up the great work.

  • @PCGuru1958
    @PCGuru1958 3 ปีที่แล้ว +2

    Hi Jimmy this project is just what i have been looking for it works very well i run N Scale Kato i have inbeded the sensor in the rails and works well as a non DCC system it solves one of the things i have been looking . thank you i have been watching your video for almost 2 years having health issues your channel it so practical and you made things easy thanks again Greg

  • @davidsayer354
    @davidsayer354 3 ปีที่แล้ว +1

    Sweet Arduino case!!! Definitely interested in procuring!

  • @TechBuild
    @TechBuild 3 ปีที่แล้ว +2

    Cool project! Great to see more people getting interested in #ModelRailroadAutomation.

  • @railwayjade
    @railwayjade 3 ปีที่แล้ว +3

    So cool! Love the Arduino vids!

  • @Kiro0ollos
    @Kiro0ollos 3 ปีที่แล้ว

    This is amazing, Jimmy! 😍

  • @davidwayneprins
    @davidwayneprins 3 ปีที่แล้ว +1

    I think this gives me the groundwork for something I had been beating my head against the wall to try to figure out: using Arduino to control a trolley car. Think of the Lionel ones that reversed course when they hit a bumper but with a delay to simulate loading and unloaded of passengers at a station..

  • @johnnyrobertson5971
    @johnnyrobertson5971 3 ปีที่แล้ว

    Love it and very well done on the instructional teaching. Love anything doing with Arduino. You really do some great video’s and thanks g F or sharing!!

  • @caitlainmccarren2286
    @caitlainmccarren2286 3 ปีที่แล้ว

    Excellent presentation of the Arduino switch. Not certain why I'd need one, but when I do I'll know where to find the how-to.

  • @dave3301
    @dave3301 3 ปีที่แล้ว

    Fantastic, Love the ideal, Thanks for sharing

  • @oceancity1042
    @oceancity1042 3 ปีที่แล้ว

    Very informative. Have just purchased my arduino. Raring to get started. Regards Robert

  • @melkitson
    @melkitson 2 ปีที่แล้ว

    So simple and yet it has been keeping me awake at nights trying to work out how to do something similar to this. I assume this would work equally well on dcc or analogue?

  • @michaelcorner7938
    @michaelcorner7938 2 ปีที่แล้ว

    Great video, I'm thinking of using it on a OO gauge layout where I have crossings to hold off one engine while another is passing through.

  • @malnadgowda_inusa3734
    @malnadgowda_inusa3734 8 หลายเดือนก่อน

    Instead of relay you could probably use MOSFET. It will help you stop train slowly and then start slowly.

  • @maxlindstrom5435
    @maxlindstrom5435 3 ปีที่แล้ว

    I use this to stop train rushing in to the stations. But I start trains again with a push button, when it's clear to enter :)
    For beginners this small projects is good, you will learn Aarduino little by little and get results at once :)

  • @olivierdamiron7279
    @olivierdamiron7279 ปีที่แล้ว +1

    That is so awesome. Simple, elegant automation. I was wondering what it would take to bring another level of refinement: Gradual speed up and slow down for each step. I would assume we would need different hardware to achieve this. Relay are ON/OFF devices, wondering if there is something we could use that an arduino could modulate without going full blown DCC, maybe interfacing RC speed controllers (ESCs). Super cool stuff, love your channel, this is my daily Train NetFix!👌

  • @brucewinstanley6113
    @brucewinstanley6113 9 วันที่ผ่านมา

    I would like that Arduino holder.

  • @lgrfbs
    @lgrfbs 3 ปีที่แล้ว

    Nice video.
    Next step is the relay control a ABC module for stop/star the loco.

  • @peterkrause5187
    @peterkrause5187 3 ปีที่แล้ว

    Hi Jimmy.
    Excellent tutorial! 😊
    Thank you.
    Is there any to slow the train rather than abrubt top?
    I have a dc layout.

  • @andymok7945
    @andymok7945 10 หลายเดือนก่อน +1

    Nice stuff. For such simple project, you might consider using a smaller micro system like the ESP8266 or ESP32 and use EPSHome for the coding.

  • @RonsTrainsNThings
    @RonsTrainsNThings 3 ปีที่แล้ว +1

    Hi Jimmy. I'm not big into automating trains on my own layout, but Something like this would be awesome for traction modeling, especially if you also reversed directions when you stopped.

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว +1

      I actually want to use this combined with a few other things to model a light rail/subway line.

  • @davidrichter5539
    @davidrichter5539 11 หลายเดือนก่อน

    Simple and effective, couldn't someone write a program without delay and with millis? I would be very grateful.

  • @zinethar
    @zinethar 3 ปีที่แล้ว

    Another cool arduino video that I'm sure I will find a use for. Any progress on that modern gas station use were working on? I want one!

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว

      Still working on it. One of my 3D printers is temporarily down so I am working a bit slowly.

  • @ngongoc7103
    @ngongoc7103 3 ปีที่แล้ว +1

    So great, i'm running DCC, please give me wiring diagram of system.Thank you so much

  • @GalenA1722
    @GalenA1722 7 หลายเดือนก่อน

    What are those types of trains called????

  • @TempoVideo
    @TempoVideo 3 ปีที่แล้ว

    Yo. Literally about to buy some components for this (or a variation of it!).
    Did you make the Uni mount/case available to download?

  • @johnsneedma
    @johnsneedma 3 ปีที่แล้ว

    So if a trolley had 6 stops... do the wires need their own pin on the arduino and line in program or can they be soldered into one circuit? Just planning ahead for a continuous one way loop around three city blocks. Possibly adding another track and stops in the opposite way.

  • @kge420
    @kge420 3 ปีที่แล้ว

    I’m currently using a 2650 and motor shield running DCC++ through jmri. All is working fine. If I were to do this project will I need another arduino?
    Thanks for making these interesting videos.

    • @ariegt
      @ariegt 3 ปีที่แล้ว

      No , and you can also push down DCC to zero ( in x-time ) instead of a relay

  • @dennisedgar3430
    @dennisedgar3430 11 หลายเดือนก่อน

    I have a “wallwart” that delivers 6.1V DC. Will this be OK for the system?

  • @falco1379
    @falco1379 3 ปีที่แล้ว

    Can you make a smooth stop / start with a motorshield?

  • @sushildamle3449
    @sushildamle3449 2 ปีที่แล้ว

    Thanks for short but detailed explanation. I just wanted to know what is the voltage supplied to rail track? My HO scale model train loco needs 12VDC having two motors each. How much external power supply I will have to give to 5VDC Relay module single channel for the loco to run / stop? Will 12VDC adapter 1Amp is suitable for this? If not please give the details. Many thanks.

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  2 ปีที่แล้ว

      Without seeing your setup, I would guess your track voltage is anywhere between 12 and 16 volts. The relay just needs to be wired on your track power feeder. It interrupts your existing track power versus actually supplying it. The relay itself is powered by the arduino and is independent of track power

  • @johnbennett6870
    @johnbennett6870 2 ปีที่แล้ว

    How many feet you have use a other contract for power

  • @No_no83
    @No_no83 18 วันที่ผ่านมา

    Is this train a dcc or a standard Dc?
    Thank you in advance

  • @palodurodons
    @palodurodons 2 หลายเดือนก่อน

    hi, in this video at around 5:30, you state "we're going to put the power leads into our relay... the one coming from the track goes in the left connect". I assume you mean this is the positive current connector going to the track enabling power on and off. Then you state "the one coming from the power bus goes in the middle". I assume that is the ground (or common). Are my assumptions correct ?

  • @edwardaudet8367
    @edwardaudet8367 3 ปีที่แล้ว

    Jimmy, can this project be used on dcc and dc. I run both types not all at once, I have dcc days and dc days. When my grandsons come over they take over the layout and love Dcc.
    I have looked at all your Arduino projects. I tried a few but put them on moni pros. Itest them on Uno's but build them on mini pros.

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว +1

      This project works simply cuts power to a section of track. So theoretically it should work just fine on DC.

  • @rinjk3a
    @rinjk3a 3 ปีที่แล้ว

    Jimmy, How much for an Arduino case for my DCC++ basestation? Josh

  • @CM-ARM
    @CM-ARM 3 ปีที่แล้ว

    Jimmy the wiring I can do the writing of the code my door is open for you. I just don't understand. I have never attempted before.

  • @TheSwitchList
    @TheSwitchList 3 ปีที่แล้ว

    Jimmy - curious why you used an analog input for the sensor? I would have thought you would use a digital input (INPUT_PULLUP) and then just checked for HIGH or LOW? Either way works fine - I was just surprised to see you use an anolog input for a incoming signal that is digital. Thanks for another interesting Arduino project video. -Rick

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว

      I've just always done it that way. I've thought about changing it but I worry about the wayward 0, or 1. The analog input gives my system some room for error.

    • @ariegt
      @ariegt 3 ปีที่แล้ว +1

      @@DIYDigitalRailroad hi., use a 10k resister to the 3.3v/5v positive to pull up your digital input and use if digitalRead LOW for sensing and save your analog / pwm pins for nicer usage . Good luck

  • @betsysummers2227
    @betsysummers2227 3 ปีที่แล้ว +2

    I would be i interested in your Uno case.

  • @TDMan-de6jv
    @TDMan-de6jv ปีที่แล้ว

    How can your solder onto the track ?

  • @asaprocky8195
    @asaprocky8195 ปีที่แล้ว

    The sensor is plugged into A0 (int A0), but the sketch loop is checking int valA1 .... Typo, but it ran?

  • @canadianlocomotivelogistic
    @canadianlocomotivelogistic 2 ปีที่แล้ว

    What is the IR detector you use?

  • @norfolksouthernblackspired8167
    @norfolksouthernblackspired8167 3 ปีที่แล้ว

    Hey Jimmy! Awesome vid. I have a complete Noob question. I’m my train is running via DCC and the relay stops the train, will it start again at the same speed it stopped with?

    • @ariegt
      @ariegt 3 ปีที่แล้ว

      just unplug the wire to the rails and reconnect to try

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว

      Yes it will. In order to control with a slowing down or a speeding up, you would have to slowly increase and decrease the resistance on the rail

    • @ariegt
      @ariegt 3 ปีที่แล้ว

      @@DIYDigitalRailroad it is much better and more controlable to use PWM control , it goes way down to a loco crawl and with enough torque-power of the motor. Try a L298N H- bridge motor driver for Arduino it works perfect for 2 segments of rails. You can also do the DCC stuff with this module. So it wil work for normal DC and DCC mixed for 2 rails. I like this way with at least 2 sensors each the same distance from the center spot . This way it works from 2 directions and it is works better with signalling so the arduino knows the direction and travel points

  • @amolchopade7649
    @amolchopade7649 10 หลายเดือนก่อน

    Is it n scale model train?

  • @duylong78
    @duylong78 3 ปีที่แล้ว +1

    So cool, please give me diagram connect to rail, thanks you so much

  • @oceancity1042
    @oceancity1042 3 ปีที่แล้ว +1

    Hi Having this some additional thought. A signal placed to give the train a reason to stop and then on changing from red to green it would then restart would be pretty neat , is this easy to achieve with Arduino programming ?

    • @swyntopia
      @swyntopia 2 ปีที่แล้ว +1

      Very simple.
      Best with LED.
      5V-->resistor ( about 200 Ohm )-->red LED-->Arduino one digital output.
      Arduino digital output ( may be the same, and even the same as for the relay )-->green LED-->resistor-->Gnd.
      Add the new output in the scetch above, copy the logic and change the Pin Nr. into the new output for the LED-->done.
      Sorry, I´m no native english speaker, I can´t explain better.

  • @swyntopia
    @swyntopia 2 ปีที่แล้ว

    basic for beginners, :-)
    Very useful for them.
    What´s about reed relais, and magnet below the train ?
    Would that not be cheaper ?
    Ok, I understand-->in case of more than 1 train, every train must get an own magnet, that´s a disadvantage....isn´it ?

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  2 ปีที่แล้ว

      I think a complex automation setup is going to involve a combination of several detection methods including reed switches as you said, infrared sensors, and current sensing.

  • @IndyMAB1964
    @IndyMAB1964 3 ปีที่แล้ว

    I would be interested in the Arduino Uno case as well. It is tall enough to encase the Arduino and the Power Shell board for the DCC++ configuration? I checked the Etsy store and don't see those listed. Do you have them somewhere else?

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว +1

      So right now I do not have the printing capacity to print my buildings and the arduino cases. I am hoping to change that soon.

    • @IndyMAB1964
      @IndyMAB1964 3 ปีที่แล้ว

      @@DIYDigitalRailroad Any idea how much you'll charge for those?

  • @zikusuniverse6548
    @zikusuniverse6548 ปีที่แล้ว

    can i make the train at home

  • @penem7632
    @penem7632 5 หลายเดือนก่อน

    sooo like, where do i buy the rails??? are there special rails for this??? where do i buy the train it self??? are there special trains for it????

  • @1babysag
    @1babysag 3 ปีที่แล้ว

    I think the idea is interesting but I am not an electrician and all of those wires and programming guarantees that I will not do it right. Can’t I just buy plug and play for all of these things?

  • @cousinvinny7990
    @cousinvinny7990 3 ปีที่แล้ว

    question why are the sensors used different from the ones you have linked to?

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว

      I accidentally dumped out my entire parts bin. The only one I could find after that was the 4 pin one. It works the same.

    • @Peabody1929
      @Peabody1929 3 ปีที่แล้ว

      @@DIYDigitalRailroad There are 3 and 4 pin versions of the sensor on Amazon. The 3 pin version has only a digital output. The 4 pin version adds analog output. The analog output can be used to adjust for ambient light falling on the IR sensor.

  • @daveygivens735
    @daveygivens735 ปีที่แล้ว

    Fantastic info but TBH I'm not a coder and watching you plug in command-line entries leaves me in the dust. Is there such a thing as canned Arduino code or maybe a GUI for dumb people like me?

  • @n-scaleunionpacificevansto6569
    @n-scaleunionpacificevansto6569 3 ปีที่แล้ว

    How do you know where to plug all of those wires into the power strip and into the various components? Does all of this come with written instructions saying where to plug the wires in? And are there written instructions explaining how to program all of this? None of this seems to be very intuitive. ...Roy

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 ปีที่แล้ว +2

      Hey Roy. Luckily Arduinos and their components were designed for learning. All the positives are labeled "+", "5V", or "VCC". The negatives are labeled "-" or "GND". The inputs and output are typically labeled "IN" and "OUT" or something similar. There is a learning curve and I am considering doing a second arduino basics series.

    • @n-scaleunionpacificevansto6569
      @n-scaleunionpacificevansto6569 3 ปีที่แล้ว

      DIY & Digital Railroad Thanks, Jimmy. Like most new things, arduinos intimidate me, but I am willing to learn. ...Roy

  • @JohnAdams-su3tt
    @JohnAdams-su3tt 3 ปีที่แล้ว

    You sure don’t need an Adrino to do something that simple!

  • @sonysnapper
    @sonysnapper 3 ปีที่แล้ว

    Ok, now put this in the Block Signal process to stop and start on the signal state.

  • @IBOFSGUBK
    @IBOFSGUBK 3 ปีที่แล้ว

    Is there some way to use the Arduino to slow the train down before it stops to add realism? I have a G scale train layout in the garden and it just does not look right when it skids to a halt.

    • @ariegt
      @ariegt 3 ปีที่แล้ว +1

      take a look at a arduino L298N Motor driver and take 2 sensors

    • @IBOFSGUBK
      @IBOFSGUBK 3 ปีที่แล้ว

      @@ariegt Great thank you ,I'll look into that.

  • @allenbarnes7202
    @allenbarnes7202 3 ปีที่แล้ว

    I don't use it, still running a D.C. railroad

  • @ken0272
    @ken0272 2 ปีที่แล้ว

    Great, in the old days we did the same thing with a bimetallic strip....which will still work after a EMP nuclear bomb blast, bye the way. ; )