Arduino Block Signal for Model Trains

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ค. 2018
  • In this video. I show you how I build a circuit for an Arduino Block Signal, and then I show you the programming for it. There will be a BONUS video tomorrow that shows you how I apply the techniques I show you here to my layout.
    GOOGLE DOC WITH ARDUINO PROGRAM SKETCH
    docs.google.com/document/d/17...
    ARDUINO SOFTWARE DOWNLOAD
    www.arduino.cc/en/Main/Software?
    VIDEO SEGMENTS AND TIMES
    Introduction to Arduino 0:59
    Overview of Parts 2:45
    Setting up the test circuit 6:13
    Writing the Program 13:26
    Uploading Program to Arduino 35:12
    Testing the Arduino 37:22
    Using the Serial Monitor to Tweak the program 38:59
    AFFILIATED LINKS TO PARTS USED
    ARDUINO STARTER KIT
    amzn.to/2xhv4SE
    INFRARED SENSORS
    amzn.to/2QuKKuv
    ADDITIONAL WIRES (OPTIONAL; COMES WITH STARTER KIT)
    amzn.to/2xhMhLL
    ADDITIONAL LEDs (OPTIONAL; COMES WITH STARTER KIT)
    amzn.to/2CU4t3S
    BREAD BOARD (OPTIONAL; COMES WITH STARTER KIT)
    amzn.to/2NbHJBt
    BLOCK SIGNAL (N Scale)
    amzn.to/2CVm0J0
    BLOCK SIGNAL (HO Scale)
    amzn.to/2xga3I5
    DC POWER SUPPLY (FOR AFTER PROGRAMMING)
    amzn.to/2xaq3Mb
  • แนวปฏิบัติและการใช้ชีวิต

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

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

    Lots of good information. I would recomend on adding a resistor in series with the leds to protect the output ports from over current.

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

      This is an excellent point. Thank you for sharing. I am actually putting out a bonus video tomorrow that explains my wiring setup. Luckily most signals including the ones that I have linked have a built in resistor on the common anode, and I say how important this is on the actual wiring of the signal.

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

      @@DIYDigitalRailroadthe great part about Arduino is the self current limiting of the outputs. A resistor will dim the LED's slightly which is good in some applications but is not necessary.

  • @shadownet4597
    @shadownet4597 5 ปีที่แล้ว

    Great idea for use on a DC layout. I'll be keeping this video aside for when I start mine.

  • @TechBuild
    @TechBuild 5 ปีที่แล้ว

    Good quality video with details about everything shown. Keep up your work!

  • @cprtrain
    @cprtrain 5 ปีที่แล้ว

    Great video. I love what you are doing here and hope to use arduinos on my layout. Keep posting this stuff.

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

    Great demonstration Jimmy, thank you for the code and the links. I'll use them when I am ready to buy those items.

  • @Ax89
    @Ax89 5 ปีที่แล้ว

    This is the video that got me interested into using Arduino, so thank you for that. (Software is hard and many people just cannot understand it. As a software guy, I did find some of the programming explanations somewhat comical.)

  • @banglacaterer8219
    @banglacaterer8219 5 ปีที่แล้ว

    respected sir, your tutorial or teaching on signal of train this particular circuit as well as programme which is so clear in terms of video,connection, sound, all required components ..your typing of program or sketch amazing so clear video technically never ever seen before and any lay person can understand and your sketch and your each word...god always bless you make same way video and i recommend youtube people please look after such nice people who are so good to contribute or share their knowledge to the people who needs.....tnx sir ...i again bless you...and god bless you ...waiting for more video on simple metro rail with adafruit arduino shield and driver like L298N hope you understand ...but make very simple with forward and backward movement with one or two signal ...

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

    Nice video Jimmy. As a person who is lucky to know how to turn a computer, this video will help in the reconstruction of my layout. Thank you

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

    Amazing!! got this working and on a NANO Thank you for all that you do!!!

  • @captainbaldo3987
    @captainbaldo3987 5 ปีที่แล้ว

    Lot's of good information. With easy to follow instructions. 👌 Appreciate it. 👍👍.

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

    good to see someone to do this, i did not know about this.

  • @JoeG-firehousewhiskey
    @JoeG-firehousewhiskey 5 ปีที่แล้ว

    Another great video, thanks for the very useful information, keep up the good work

  • @dacuzzz
    @dacuzzz 5 ปีที่แล้ว

    that was a great "How To" video Jimmy... thanks for sharing your knowledge with us... vinny

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

      Thanks, Vinny! I need to give you another shoutout on my videos. Your live streams are great tutorials and they're awesome community building videos too!

    • @dacuzzz
      @dacuzzz 5 ปีที่แล้ว

      thanks Jimmy.. i appreciate your kind words... vinny

  • @jayzo
    @jayzo 4 ปีที่แล้ว +4

    This doubles up as a fairly decent beginner tutorial for Arduino coding.
    A few tips for people who wish to try this:
    - Save the common anode pin in your code by using a 100 Ohm resistor to connect the Anodes directly to the 5V pin. Make sure you use a resistor otherwise you'll destroy the LEDs and crash the Arduino (I've done that too many times, mostly by pure accident)
    - The editor is trying to add indentation to your code, use it as it'll help you if you miss a bracket or semicolon which is something even seasoned programmers can do. Right click on the code and choose Auto Format, if the very last closing } curly brace has spaces before it, you've missed one. Imagine the indents as a step, for every step in you take you take one back out.
    - If you can think of an alternative way of doing something, try it. Programming is about problem solving, and just like real life there's many scenarios where there's alternative methods, even if they're radically different.

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

    A good and comprehensive video, one thing to note though: You could almost certainly hook the sensors up as a digital input, especially given the contrast in analogue readings (ie: 1017 is an almost guaranteed logic 1 and 34 is an almost guaranteed logic '0') which in turn may allow more sensors to be connected to the Arduino

    • @realkyhick5662
      @realkyhick5662 4 ปีที่แล้ว

      That's right. These sensors are not designed to provide analog outputs. The outputs are digital, either 5v or 0v.

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

    Great video, well explained - thank you. I did put resistors in place though but not sure if this is necessary.

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

    I’ll have to dust off and polish up my coding skills! 35 years in the IT business and I only learned COBOL and Pick Basic. I did dabble in Visual Basic a bit, but never in C or C++. Haven’t written a single line of code since I retired over 9 years ago. Looks like this old dog must learn some new tricks.

  • @darrenoleary5952
    @darrenoleary5952 4 ปีที่แล้ว

    It's a small thing, but adding the following int variables and values at the beginning of the sketch saves on time having to run through the code to make adjustments to each of the if condition statements :
    int senseMin = ###;
    int senseMax = ###;
    Set the ### to the min and max of the sensor's values that you see in the Serial Monitor window and change the valA1 and valA2 conditions to senseMin and senseMax respectively.
    Basically it becomes a set and forget situation and if you need to make adjustments to these values, just make them in one location rather than 8 different locations.
    I found that these values needed to be changed from the original code values depending on the quality of light in the area of the sensors.

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

    Cool.. thanks for sharing and keep up the great work.. Lance

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

      Thank you! I really enjoy doing these arduino projects.

  • @josephtannenbaum8696
    @josephtannenbaum8696 4 ปีที่แล้ว

    Great tutorial

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

    wow just what i have been trying to do will you be expanding this to include distant and multi blocks so the uno's talk with each other for multiple signals like yellow caution aproach a red (stop) signal? keen to see that and working it out on my lay out Thanks For Your great tutorial and video BRAVO

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

    Great instructional video.
    Rather than using the IR sensors for detection, can detection be done by monitoring the resistance drawn by the train in a section of the track instead?

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

    Great video !

  • @viktortoghia6066
    @viktortoghia6066 5 ปีที่แล้ว

    Hello. Im new to this arduino stuff. Thank you for the great video.
    It works great. Can this be doubled in the program to run an other set of sensors and output to 2 more lights?

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

    Good tutorial and interesting. I however would use an interrupt time delay instead of delay(xx); The reason being is you could miss another sensor while the Arduino is stuck in the delay routine. Just food for thought.

  • @williamptterson3047
    @williamptterson3047 5 ปีที่แล้ว

    Just blew my mind! I would need arduino for dummies.

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

    I'm creating switch throwers using these products. Not hard but a little time consuming when you set up the first one. Once you made a few, they go quick.

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

    Hello Jimmy, first must say your videos are great and love them. I am very new to Arduino and have a question for you and it is I run double main line track and want to know if there is a change in the programing of the Arduino for one direction travel. Thank you.

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

    Your videos are very professional, informative and easy to follow. I admire and really appreciate your hard work. BUT I have one small suggestion. The back ground music is to loud and distracting. Also using music that is more calming and relaxing would also help. I know part of my problem with the background music is do to aging and tinnitus now that I'm in my mid sixty's. Thanks and keep up the excellent work!!!

  • @stephenpearce3815
    @stephenpearce3815 4 ปีที่แล้ว

    Thank you for the video. I am just starting to investigate Arduino modules. Could this be expanded to trigger asymmetric breaking a well as operate the signal lights?

  • @timms83i
    @timms83i 5 ปีที่แล้ว

    Hi I really like your videos I have just ordered a starter pack and I am wondering can you run to signal blocked from one Arduino

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

    Hey Jimmy nice demonstration for basic block signalling, have you thought of multiplexing the program with the millis(); function so we can put a couple of blocks on an Arduino instead of one block per Arduino or is that too complicated.

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

    Excellent information as always! Does one add this sketch to the DCC++EX sketch or does one connect separate Arduino boards to control for signals (using a multiport USB hub)?

  • @wombat9999
    @wombat9999 4 ปีที่แล้ว

    Nice video. A few minor things (suggestions for future videos)...
    - This is really a microcontroller board, not a microcomputer. A (micro)computer has a CPU (Central Processing Unit, aka, microprocessor, aka, processor) in it. An Arduino board uses a microcontroller not a microprocessor. (Check out wikipedia or such for the differences between a microprocessor and a microcontroller.)
    - You call "{" and "}" brackets, but really they are braces. The "[" and "]" are brackets. This might sound like a minor point, but brackets and braces mean different things in programming, so it's best to get the terms correct up front.
    - When you're in the Arduino IDE, every now and then hit a ^T (control-T). This will cause the IDE to reformat the code and give proper indentation which will make the code more readable.
    Just some (hopefully) helpful clarifications and suggestions. :-)
    Keep up the good work!

  • @paulliuzzo1320
    @paulliuzzo1320 4 ปีที่แล้ว

    Fantastic video. I have 0 programming experience so I will watch this several times until I understand it, One question, do you need a seperate Arduino for each block? Thanks to you I think I will go to my local micro center and get some supplies to start experimenting with the Arduino system. thank you.

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

    Great video which was very close to what I was looking for. I have one problem. I have an Atlas signal with 4 wires (the usual red, yellow, green,and black) to run three LEDs. The trouble is that the common wire (black) seems to be the positive lead and the other three are the negative. Is there a way through code or wiring to reverse the common wire to the LEDs to work with this signal? It seems Atlas made this backward. I got this to work one LED at a time by swapping the common wire (which is the positive) with the individual colored wires (negative). So how would I make a common positive lead with separate negative leads. I know that's backward but that's what I have to work with. Thanks for the tutorial!

  • @jvanamb
    @jvanamb 5 ปีที่แล้ว

    Great Arduino info. Very Good visuals, however, could you do a video, even a power point would be fine, with close-up examples of all those special figures you regularly in the programming scripts.
    Thanks Jim

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

      I've actually had several people request this. I've been considering it. Until I can get to it I would check out arduino's website www.arduino.cc/reference/en/ This has always been a great help to me.

  • @dineshdolamawatha3768
    @dineshdolamawatha3768 4 ปีที่แล้ว

    Hi Jimmy I love your work very easy to understand, I'm new to Arduino not good at sketching at all. is it possible to make the LED light to go Green - Yellow -Red and then green? would you be able to help with the sketch? I have tried but not good.

  • @ShivamPal-eq9fu
    @ShivamPal-eq9fu 5 ปีที่แล้ว

    Awesome video..
    But i want that if the first ir sensor senses the motion again after triping the signal red then it also change the signal to green...what should i do ???...

  • @alanlarsson5126
    @alanlarsson5126 5 ปีที่แล้ว

    Great vidio and description. I only have 1 nitpick... the positive power on the LED detector boards is actually labeled VCC not CC....That is actually a standard label on all Arduino boards for the regulated voltage supply voltage. I even zoomed on the image on Amazon and confirmed.. VCC not CC

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

      Alan Larsson Thank you for that. I guess my eyes aren't ask good as I thought! Haha!

  • @BrandonBascom
    @BrandonBascom 4 ปีที่แล้ว

    Could you use QRE1113 line sensor breakouts from SparkFun Electronics? They seem to fit over the blind screw holes of KATO track perfectly.

  • @LS3Jack
    @LS3Jack 5 ปีที่แล้ว

    Great information, really enjoy your Aruino projects. One question, why did u use pin 8 for power, could you use 5V from the breadboard? --Jack

  • @tomcarr1050
    @tomcarr1050 5 ปีที่แล้ว

    very good video Jimmy...this is something i want to include on my layout...I think I will be using nanos for my signaling, is there a way to get the block detectors to talk to jmri...Thank You for sharing Tom

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

      Thank you Tom! There is some way, and I have tried to figure it out in the past, but failed. I have only tried on DCC++. If it helps. I was able to see the arduino on JMRI, but I wasn't getting any meaningful signal. I added a line of code so that one of the digital pins to send a "HIGH" signal when the signal showed red and wired it to my base station.

  • @ricz6994
    @ricz6994 5 ปีที่แล้ว

    Jimmy, can you show us how the block signal can be modified to allow the layout to take on an ABS system? One block relating to the next two, etc.

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

    Also Jimmy from the @DIY and Digital Railroad do you have a video on block control with arduino? So I can stop using the DTDP switches..

  • @stevegwardify
    @stevegwardify 4 ปีที่แล้ว

    Greetings from England, great video. Can you tell me what the music is called used in your video....

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

    I was showing a friend today the signals and code. He made a comment of what would happen if the train started triggering the sensor from green to red but after it passed the sensor and needed to back up would the light stay red. Can the code be changed to go back to green after it backs up passed the sensor. Do you have any insight into this. Thanks! I did get this to work on an Arduino pro mini. Good Instruction and video.

  • @themaina-track-tion3723
    @themaina-track-tion3723 5 ปีที่แล้ว

    Jimmy, this is really a great introduction. I am loving this. Do you have anything in your program to consider the length of the train going through the block? As you showed it is great if it is just a locomotive going through the block, but if you have a train, is it the loco or the last car that triggers that the block is now clear? I wouldn't want the block cleared if the last half of the train is still running through it. Thanks for your tutorials. -Mike

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

      Hey Mike, So the last car will trigger that the block is clear in this program, I was getting false positives with this program with longer trains, so I did an improvement video where I modified the code to make it work better. Here is that video th-cam.com/video/Ljf4Ad_sxMA/w-d-xo.html

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

    I am not new to model railroading but very new to Arduino. I have watched numerous videos and have acquired the needed parts. I am using the UNO with a breadboard and Arduino IR sensors. My LED's are a micro bi-color RED/GREEN with 3-wire lead. My question is how to wire these LED's and program the unit. Is there a video for that? Anything you can help with is appreciated. Thank you!

  • @bobu8739
    @bobu8739 5 ปีที่แล้ว

    Hi Jimmy, great video and exactly what I am looking for. One question: How do you expand the signal control for multiple blocks? In the video you mentioned that you will be working on that. Any ETA on the video. Thanks.

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

      I have been working on this for quite awhile, Once I have it bulletproof. I will share it!

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

      @@DIYDigitalRailroad Eagerly waiting for the same. Thanks in advance.

  • @jimschug5528
    @jimschug5528 4 ปีที่แล้ว

    I am going to have one Arduino at each of my signals. For this example, we are at an interlocking with a 3 color over 3 color signal, facing one direction. I have all six analog inputs and one digital input monitoring things like block occupancy detectors and switch point positions. The inputs will be Hi or Lo or 5V or 0V. There is no default state. I want to be able to set six outputs to the LEDs depending on the states of the seven inputs. Is this simply a bunch of IF, Then loops or is there more involved?

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

    Jimmy, how would the sketch change if you were using bicolor LEDs ?
    This would require both the red and green to light at the same time

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

      I figured it out. I’ll post the sketch

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

    Hey jimmy, love your channel. Very informative. Been model railroading for 40 years plus. My question to you is.....could I just simply swap the ir sensors for reed switches without changing any of the programming? Mind you I have updated my system with you all the way to the current sensor mode. Too many blocks, too much wiring and programming. Any response would be great. Model railroading is fun!

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

      Hey Kenny! Yes as long as the sensor can register the train, this can work. It originally used photoresistors.

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

    Jimmy Great Video. I am thankful to you. I learned a lot. May I please request you some clarification on a traffic light that uses a common ground. How would I incorporate that into this program. Any insight is greatly appreciated. Thanks Rahul

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

      BTW I know you mention it in the end but I am not clear. Thanks again.

  • @hiddencanyonnscalerailway6927
    @hiddencanyonnscalerailway6927 5 ปีที่แล้ว

    Thanks Jimmy. I am working with Arduino now to add block signals for my main and branchlines. I am also using Kato unitrack for my layout. The two lines cross with a double crossover. I can get the signals to work for each track with separate identical sketches, but I am having difficulty combining the signals to work independently in the same sketch using one Arduino. I know it will work with separate Arduinos, but then the crossover signals may not function. I am still learning the coding and have spent a great deal of time researching. I am not even trying to set the signals to work for crossovers yet. I need to get them to work for thru traffic first. Two questions:(1) have you tried using the signals for a turnout yet? (2) did you write the original code presented, or can you point to where you got it? Feel free to email reply if you would prefer. thanks, and looking forward to more how-to videos from you - they are great! Ben (2beng3@gmail.com)

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

      +Hidden Canyon N Scale Railway I have not tried turnout signalling, but naturally it is on my list and with Kato i could use some sort of voltage detection. I did write the code after watching quite a few tutorials on arduino "switch" programming. I will shoot you an email later this week. A crossover signal may be easier than we think.

  • @nickhale2900
    @nickhale2900 5 ปีที่แล้ว

    Hi Jimmy, have you written a sketch for IR sensors being used as occupancy detectors on hidden sidings triggering a single LED.

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

      I haven't done that yet, but that's a great idea!

    • @realkyhick5662
      @realkyhick5662 4 ปีที่แล้ว

      Actually, the sensors can do this by themselves without needing an Arduino. Just connect an LED in series with a 330-ohm resistor to the output pin, and use a 5V power supply to connect to the Vcc and GND pins.

  • @jcsmith725
    @jcsmith725 4 ปีที่แล้ว

    Is there a video that shows actually how to incorporate it into the layout? I want to see how you mount the infrared detector on / in the track and what the wiring looks like when it's functional on your layout. Thanks.

  • @danburger65
    @danburger65 4 ปีที่แล้ว

    Hi there..Great video. I am trying to get this to work on a Mega 2560 and am confused about the digital pins for the leds. On my board the digital side is labelled with 22-52, so I tried using those but modifying the sketch but that didnt work. The I tried to used the pins 3,5,6 on the PWM side, that also didnt work.. I am getting the sensors to work (I think), because when i wave over them the leds on the sensor light up. But my signal leds never light up. Any thoughts? Thanks

    • @danburger65
      @danburger65 4 ปีที่แล้ว

      I see what I did wrong, it does go into the PWM side, but I had the common positive out of analog instead of digital. Thanks!

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

    Very good blow by blow account, just needs some comments in the code

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

      That's a great suggestion. I will have to add those in to my code this evening.

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

    want to have buildings lighted up as train goes by and stay on for 5-10 seconds after train passes. Using HO scale. Thanks

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

    I am particularly interested in the multiple arduino solution.

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

    Can I use magnetic reed switch rather than IR sensor?

  • @dj51
    @dj51 5 ปีที่แล้ว

    The three light signals I have utilize a common cathode. I am puzzled as to how to modify the wiring to make this work. Does pin 8 always have to output positive? Thanks

    • @realkyhick5662
      @realkyhick5662 4 ปีที่แล้ว

      Pin 8 is actually not needed. You could simply tie it to the positive power supply, i.e. Vcc or +5v. With your common cathode signals, you would instead connect the common connection from the LED's to GND instead, and reverse the HIGH and LOW values in the sketch. Haven't tried this out personally, but my knowledge of LED wiring and positive logic says this should work. Try it out.

  • @sergiorocha2036
    @sergiorocha2036 5 ปีที่แล้ว

    Great, thank you. I just don't understand why no use 5v pin to led, instead of digital pin 8.

    • @danp2779
      @danp2779 5 ปีที่แล้ว

      Could've used either (or just the positive rail on the board) but it may come into play on a layout, rather than on a table)

    • @realkyhick5662
      @realkyhick5662 4 ปีที่แล้ว

      I was wondering the same thing. Use Vcc or +5v instead of an output pin always set to high. Might be good to put a 330-ohm resistor between the signal and Vcc/5v, though.

  • @brianmunce5817
    @brianmunce5817 5 ปีที่แล้ว

    Hi, instead of initialising the signal at green, I would like to set it according to a turnout setting ahead of the signal i.e red if against or green if for. Do you have any suggestions for this? I use a Cobalt switch motor on the turnout and switch it from a control panel.

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

      I would have to research the Cobalt switch motor to see it's outputs since I've never used one. I am currently working on an arduino based turnout controller and I plan to to do a tutorial including that soon!

    • @brianmunce5817
      @brianmunce5817 5 ปีที่แล้ว

      @@DIYDigitalRailroad Thanks for your reply. The Cobalt switch motor has outputs for signalling at 5.0 volts. I already use this to control the signal. I want to incorporate your sketch to work as well as the point motor.

    • @brianmunce5817
      @brianmunce5817 5 ปีที่แล้ว

      Cobalt's web site is "www.dccconcepts.com/product-category/the-cobalt-collection/cobalt-point-motors/cobalt-classic-omega/". I hope this will help you.

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

    NOOB question does this work with DC or is this for DCC only? I dont see any reason it wouldnt work with DC if using infrared sensors to detect the trains in the block.

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

    Very new to Arduino and I love this idea. However, I am getting this error. Exit status 1 Use of enum 'SIGNALSTATES' without previous declaration.
    Any idea what this means?

  • @DustinsNScaleRailroad
    @DustinsNScaleRailroad 5 ปีที่แล้ว

    I have a quick noob question: Do you need a separate Arduino for each block, or can you use multiple block signals on one, as long as i have the space on the analog and digital sides and I declare the inputs and outputs correctly? So let's say I have a signal set for a crossing of two lines in one spot, and at the turn-outs from a siding to the main line nearby, would I need separate Arduinos, or could I set the same one to control the infrared sensors at multiple spots?

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

      The way that I am designing the system is to have one arduino per block. It would take some recoding, but you could do multiple blocks with an arduino, especially with a mega

    • @DustinsNScaleRailroad
      @DustinsNScaleRailroad 5 ปีที่แล้ว

      @@DIYDigitalRailroad thanks for clarifying. One other question. Do you just use the bread board and LEDs for programming and testing before hooking in the final block signal? Or are installing the bread board too?

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

    My signals are common negative. Is there a different sketch for these?

  • @Navarrete993
    @Navarrete993 5 ปีที่แล้ว

    Can one arsuino run multiple blocks?

  • @rodjames3106
    @rodjames3106 5 ปีที่แล้ว

    I am unable to purchase the infrared sensors from Amazon because I live in Australia. Is there an alternative model that I could use?

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

      I would search for "Arduino infrared sensor" on eBay or Amazon. Most of them come from China, so you'll probably get them quicker than I do haha!

    • @brianmunce5817
      @brianmunce5817 5 ปีที่แล้ว

      Jaycar sell them CAT.NO: XC4524

    • @darrenoleary5952
      @darrenoleary5952 4 ปีที่แล้ว

      ​@@brianmunce5817 I tried these myself and couldn't get them working as their frequency interfered with each other, even if i placed something between them so as to clearly separate them.
      I also had too much problems adjusting the dual potentionmeters as there was no documentation as to which one as which - frequency and distance. Purchased new sensors and didnt adjust them, but still had issues with them.
      I ended up finding the same IR sensors used in the video on eBay and they work exactly as shown.
      A lot cheaper too. Got a pack of 10 for $12 with free postage. Jaycar's were $8ea in comparison.

  • @TheOriginalBadger
    @TheOriginalBadger 5 ปีที่แล้ว

    Could you control multiple block signals using a mega 2560? Or a NANO I/O Expansion Sensor Shield ?

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

      You could certainly do that, though it would limit the number of blocks that you could have. I am actually designing a system that has either and arduino UNO or nano in control of each block, and they are connected to the next block's arduino for signaling. It's still in the prototyping phase, but once I get it working properly, I will begin a video series on it.

    • @TheOriginalBadger
      @TheOriginalBadger 5 ปีที่แล้ว

      Why would it limit the number of blocks? Say you have 20 blocks. Instead of 20 Unos, or even 20 nanos, you could just have 2 megas, couldn't you? Simply from a cost perspective, I think I would go with a nano for each block. Is it necessary to have the boards connected? Because when the train trips the sensor, its going to activate the signal anyway. As it passes from block to block, the next signal is going to be activated by the sensor for that block.
      Also....you use the Vin and the GND on the board to provide power to the sensors. Could they just be wired straight to the layouts bus lines? Sorry if I'm being annoying...but I like and want to use this system, but only heard about it for the first time 3 days ago! lol

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

      It could definitely be a cost effective way to do multiple blocks. The main problems I can see is that the program would become a lot more complicated since your controlling multiple blocks simultaneously. It is a reason for me to buy a Mega to give it a whirl! Haha!

  • @TheOriginalBadger
    @TheOriginalBadger 5 ปีที่แล้ว

    Jimmy....I know you have only just started doing arduino videos, but there is one thing I am having trouble finding anything on, which I am wondering if you will be touching on....and that is, reverse loops. Can arduino be used to automatically switch the polarity in a reverse loop?

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

      Hmmm....if a detection method for the polarity shift can me made for the arduino, then it's just a matter of figuring out the code. You could probably use a couple relays on the DCC Bus line to reverse the polarity of the track if you electrically isolate the loop. I'll have to work on it.

    • @TheOriginalBadger
      @TheOriginalBadger 5 ปีที่แล้ว

      Asked this question on the DCC++ group on Facebook....it seems there are quite a few people looking forward to a solution to this issue. :)

    • @patelrailways6253
      @patelrailways6253 5 ปีที่แล้ว

      You can do that by adding DPDT switch and routing the power supply thtough it. You can find it at : th-cam.com/video/LlhMDeGeXbE/w-d-xo.html
      If you have any question, put it there in comment.

  • @dennischerry4545
    @dennischerry4545 5 ปีที่แล้ว

    Very nice presentation.
    one comment is a Arduino is not a computer, it is a micro controller. Also am interested in bidirectional blocks. i know this will take time. Are you going to show how to connected several blocks together?

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

      +Dennis Cherry Thank you! You are correct. I am actually working on connecting multiple Arduinos together, having one per block, and having them talk to eachother. Its a little complicated, but its something that I've always wanted.

    • @dennischerry4545
      @dennischerry4545 5 ปีที่แล้ว

      Great: Are you going to also add automatic Bi-directional control of trains. I knw that will be a lot. How are you going to stop trains, I have an idea for that if interested.

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

      I'm thinking of putting relays in the power supply and connecting them to insulated track sections. That way if a block is not clear, then it will cut power to the track. I would love to hear your idea. I think you have my email already.

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

    Hey jimmy! So my signals that I have are incandescent bulbs and I’m trying to run them instead of the LED’s but I think the voltage is to low for the bulbs. Is there a way to rectify this?

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

      Hey Joel, The easiest way to handle incandescent bulbs would be to have the arduino control relays that turn the bulbs on and off. It would only take some minor code changes.

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

      @@DIYDigitalRailroad that sounds great! But at the moment I’m confused as to what kinds of relays I should use? DPDT? SPST? Do I need more than one relay, maybe one per incandescent bulb?

  • @doddsy2978
    @doddsy2978 5 ปีที่แล้ว

    In the UK (Real World), at least, the yellow would persist until the block in advance had been vacated ( rather than timed. I should like to implement this and am thinking that there are sufficient I/O connections on an Arduino to implement this. Being a programming Biff, I am not to sure how to proceed, I am thinking that another pair of sensors (maybe even sharing one between the two blocks). Anyway, I guess my question is... Would you be interested in assisting?

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

      That's how we do it in the states as well. I have been working on a multiple block signal system for quite some time. I can get it working, but I need to make the code bulletproof before I do a tutorial on it.

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

    Hi jimmy can you add more signals to the same program

    • @ajsettlemyer3646
      @ajsettlemyer3646 5 ปีที่แล้ว

      That's what I wanted to do. I bought Nano's and I think I should be able to run two sets of signals off of each Nano, seems like a lot of overkill to me.

    • @darrenoleary5952
      @darrenoleary5952 4 ปีที่แล้ว

      @@ajsettlemyer3646 Whether you use one or multiple nanos, it doesnt matter, just don't use the Delay command as this halts all running code until the specified delay time has lapsed. Use the millis() function instead.
      This allows you to run other code while the millis() function is running.

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

    What happens if the train stops in a block, reverses direction and exits the block?

  • @VestedUTuber
    @VestedUTuber 4 ปีที่แล้ว

    It's cool, but I'm a little skeptical on how practical this is unless you're doing more than just controlling signals and trains with it - for example, implementing "approach" signals, simulating inertia or automatically routing trains based on RFID chips on each individual train, or even using DCC++ to control trains via DCC. But for a basic analog layout, wouldn't it just be better to use relay switches?

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

      Since this video was produced, I have created a multiblock signal system check it out here! th-cam.com/video/Pe2-wL3BeW8/w-d-xo.html

  • @rodjames3106
    @rodjames3106 5 ปีที่แล้ว

    I have a copy error message “sensePin1 was not declared in this scope” do you lnow what this means?

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

      This typically denotes a spelling or syntax error. Make sure everything matches perfectly.

  • @ajsettlemyer3646
    @ajsettlemyer3646 5 ปีที่แล้ว

    I tried copy/paste your code from google docs into the program and it's giving me an error on every line after 19 with a 302/240 error. After some investigation it appears that it didn't copy/paste the correct line breaks for each command line. Do you know of a way around this?
    Great Video btw.
    AJ

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

      hmmm.... I am trying to replicate the issue and I am not having any luck. If you can save the sketch and email it to me I can try to resolve the issue. diyanddigitalrr@gmail.com

    • @ajsettlemyer3646
      @ajsettlemyer3646 5 ปีที่แล้ว

      I got it. Just had to go through the script to remove line breaks.

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

      That's great to hear!

  • @TheOriginalBadger
    @TheOriginalBadger 5 ปีที่แล้ว

    Jimmy....I typed the code EXACTLY as you did...
    switch(signalState)
    {
    case ST_GREEN:
    signalgreen(valA1, valA2);
    break;
    but the compiler keeps giving me the error "signalgreen was not declared in this scope." I expect I will get the same result for red1, red2 and yellow.
    What have I done wrong?

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

      I have run into this error before. Here s a link to the complete program in a google document. You should be able to copy paste this into your program and it will work no problem. I just tested it and it verifies. If you still have problems, then we can figure out how I can take a look at your code and see if I can find the error.
      Here is the google doc with the program
      docs.google.com/document/d/17X1YCJ4sxMR2iaQI1IyyVEyZbd03v0nbQzZD5ZpVcwc/edit?usp=sharing

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

      Ok I was just able to replicate the error. I traced it to this section as the culprit
      "void signalgreen(int valA1, int valA2){
      digitalWrite(GREEN,LOW);
      digitalWrite(RED,HIGH);
      digitalWrite(YELLOW,HIGH);
      digitalWrite(POWER,HIGH);"
      Make sure that when you type signalgreen in this section of code that it matches perfectly. even a single capitatized letter will cause the error.

    • @TheOriginalBadger
      @TheOriginalBadger 5 ปีที่แล้ว

      I don't know why yours works, and mine doesn't, given that it is exactly the same code! But anyway, thanks for that. Maybe I can edit it to what I want without it throwing a conniption fit.

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

      @@TheOriginalBadger send me an email. diyanddigitalrr@gmail.com we'll get this working.

  • @teadyconnolly9590
    @teadyconnolly9590 5 ปีที่แล้ว

    Hi Jimmy excellent video well done on the videos you have made I have really enjoyed and just trying to find out how to get in contact with you please I am trying to get in contact with you please Jimmy

  • @frankneher9192
    @frankneher9192 5 ปีที่แล้ว

    I wish the code you type was a bigger font so I could read it.

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

    I have a problem with the LEDs flashing. How can I solve it?

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

      I would have to see the code you are using. You can email me at ddrrcommunity@gmail.com

  • @donhouse4792
    @donhouse4792 5 ปีที่แล้ว

    program will not clear, declaration of 'setup' as array of void keeps coming up ,can't get by that , any advice, Dondo

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

      copying the sketch from the Google doc? sometimes it can do weird things with that. try copying the sketch into a basic text editor then copying over to the arduino IDE.

  • @joseraya3867
    @joseraya3867 5 ปีที่แล้ว

    I copy and pasted your code the the only light that works id the Green LED I see the IR sensors flashing when I cover them but no LED chages

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

      The first thing I would check is the IR sensor connection. It may be receiving power but may not be hooked up correctly. My email is diyanddigitalrr@gmail.com Send me some pics and I can help diagnose.

    • @joseraya3867
      @joseraya3867 5 ปีที่แล้ว

      @@DIYDigitalRailroad I ended up changing the value from 500 to 250 and it seem to do the trick. Thanks for the help.

  • @rodjames3106
    @rodjames3106 5 ปีที่แล้ว

    Error comment; expected initialiser before “Serial”

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

      This is typcially a missing piece of arduino code that is necessary. I will try to replicate the error and get back to you.

  • @TechTune
    @TechTune 5 ปีที่แล้ว

    Nice clone!

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

    Such a shame you haven't updated this to a ncebd20 video for this sketch

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

      Actually...... th-cam.com/video/XOKfErP_ixE/w-d-xo.html

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

      @@DIYDigitalRailroad nope thats for a multi block system not a single signal like the video above

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

      @@cousinvinny7990 Yes it is for the multiblock. The cool thing is that the code is written in a way that will work for the single signal as well. You wire it up the same and just leave out the parts that involve connecting to other blocks. I can certainly do a single block code write up though.

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

    Very clear, calm information - but please lose th background music. It makes it very difficult to concentrate on what you are saying.

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

    You don't need background music.

  • @1701Wren
    @1701Wren 4 ปีที่แล้ว

    Technically it's a cheap Chinese clone not an actual Arduino Uno!
    An actual Arduino has "Arduino" on it
    Sorry to be nitpicky