Model Railway Sensors & Detection Part 2 - Train Detection and Automation with IR Sensors

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

Komentáře • 61

  • @TrashMan2008
    @TrashMan2008 Před 12 dny

    WOW, This has been been such a learning experience and I don’t understand EVERYTHING but WOW THAT is simply amazing what can be done. I would really like to try something like that because I’m building a portion of the layout that simply goes back and forth from the station platform and out to sit (as the operator walks to the other end and get the train moving again). Thank you so much. Still seems hard with a lot of jargon I don’t understand LOL.

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

    I have to tell you...that was a very well Scripted tutorial... bookmarking this.
    Thank You!

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

    Brilliant. Now that winter is coming I plan on implementing this into my RR.

  • @thelittlewesternmodelrailway

    I'm going through your technology series and I'm loving it! I'm coming back to the hobby after some time and as I have an IT background this Arduino tech is right up my street! (also cost being low is a bonus) I think I will follow your video's instructions while setting up my shunting layout in regards to DCC++, Block Detection and servos for points and signals.
    These tutorials have been great! Thank you.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 2 lety +1

      Thanks and welcome back to the hobby! 😀 If you're going down the DCC++ base station route then check out DCC++EX. It's an upgraded version, but I've not got round to making a video on it yet. Stay in touch, let know how you're getting on 👍

    • @thelittlewesternmodelrailway
      @thelittlewesternmodelrailway Před 2 lety

      @@LittleWicketRailway I’ll do just that Thanks! Currently watching your mimic panel video. I might need to rethink power source for it as I have several points and signals on a smallish layout. I’ll be posting updates regularly on my channel once officially started :)

  • @jambuttymine
    @jambuttymine Před 11 měsíci

    Just what I was looking for, although I would like to do the same thing on the Arduino Nano ( I have plenty of them)
    Many Thanks

  • @kevinburt3075
    @kevinburt3075 Před 2 lety +1

    Hi thank you for your videos there really informative and I’m enjoying working through them

  • @peterulvestad6418
    @peterulvestad6418 Před 2 lety +1

    The JMRI sample scripts have always been included in the JMRI download so there is no need to go back to the JMRI website to download. They are located in the Jython folder of the JMRI install. Once you make changes to the script you should copy it to a new location as an update will overwrite it. I suggest your JMRI users folder.

    • @peterulvestad6418
      @peterulvestad6418 Před 2 lety

      If you do want to download a script from the website, just right click and you should see an option like 'Save link as' (varies depending on browser).

  • @modelrailwaytheeasyway9743

    Just got around to using this and so impressed with this simple script and having used python for other projects I am looking at expanding this for now. I am still working on the block detection setup but so far I think my soldering is not that good as the first Merg senor doesn’t seem to work for me. Bit of head scratching required to find the issue. I also decided to keep the arduinos separate as I will need a lot of infra red sensors. I am also using the larger 5mm infrared sensors which are picking up the locomotives up no problems and they are running on 5 volts.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety +1

      If you're good with scripts then you can do pretty much anything in JMRI, they're really powerful.
      The MERG forum may be able to help troubleshoot your sensor issue.

    • @modelrailwaytheeasyway9743
      @modelrailwaytheeasyway9743 Před 3 lety

      @@LittleWicketRailway well turned out I had not put the link wire in so was a ground issue. Now to get making the rest up. And so happy with the script have now got the trains stopping at the different stations on route. Thanks for getting me started on this journey.

  • @bryansmith1303
    @bryansmith1303 Před 2 lety +1

    Extreme well done, lots of great information!!

  • @edwardwaltonbespoke5817
    @edwardwaltonbespoke5817 Před 3 lety +1

    Great videos 👍 very informative and will help a lot. Thank you!

  • @RobA500
    @RobA500 Před 3 lety +1

    This is a very informative tutorial, nicely presented.👍

  • @56NeilWatson
    @56NeilWatson Před 3 lety +1

    Hi Rob, thanks again for a great tutorial. Have kind of got it working with just one fly in the ointment, I have set my sensors to 'inactive' which the script appears to need but once the train has activated the sensor it stays in the 'active ' state and messes the script up. I have kind of done a workaround for the moment ..... changing the state back to inactive manually. I will have to look into sensors a bit deeper. Thanks for all your hard work.

    • @56NeilWatson
      @56NeilWatson Před 3 lety +1

      Doh, did it again. Using a version of the SensorScan script that wasn't modified

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety +1

      Hi Neil, having to run the script is probably the worst part of the sensor hub. Take a look at my latest video which combines the sensors and the servos, but the big benefit is that you no longer need the script because everything works via the CMRI connection (czcams.com/video/OkXG3mfY6PE/video.html).

    • @56NeilWatson
      @56NeilWatson Před 3 lety

      @@LittleWicketRailway I also found that Python is tetchy about indentation of the code.
      I've seen your new video but only cursory. Will try and give it my full attention soon. I've managed to get the IR sensors with the back and forth running quite well. Thanks again

  • @SuperSpuddo
    @SuperSpuddo Před rokem

    Thank you for your efforts with this. I found it easy to follow and have successfully controlled my points. I would prefer to use a panel of switches to individually control points but the coding is beyond me. Can you help please?

  • @boblug4028
    @boblug4028 Před rokem

    This is really good. One question though. Why not run everything through arduino. The mega you have has plenty of inputs to control the loco and many many inputs. You could daisy chain sensors also i2c for many more or just groups, points or signals for example.

  • @luiscorreia671
    @luiscorreia671 Před 3 lety +2

    Thank you very mutch. it helps a lot mainly when I'm returning to this hobby after 40 years of stop. Quite different now. I would like to know if you are using 2 diferent arduinos - 1 for loco control and 1 for sensors control - and how do you interconnect them.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety

      Hi Luis! Yes, I'm using one Arduino for the DCC++ base station to run the locomotives and then there is another Arduino reading the sensors.

    • @luiscorreia671
      @luiscorreia671 Před 3 lety

      @@LittleWicketRailway Thanks, your videos are very interesting. I've already bought the Dual Channel DC Motor Driver. After making this work i'll go for the sensors.

  • @daveroberts5342
    @daveroberts5342 Před 2 lety +1

    Rob,
    I would like to install IR sensors across the rails at an angle so as not to be interrupted by the space between cars.
    Are you aware of a sensor tht comsists of the 2 leds thru small tubes like straws that can be placed across the rails and feed back to the sensor thru a bit of extended wiring? I am not fond of the idea of soldering bits of wire to the bulbs and then back to the pads on the sensor as the solder pads are very small and can be easily lifted. Or I can look for 3mm sensors that protrude at the end of the sensor unit and point them up thru the bench work between sleepers.
    Can we put a delay in JMRI on the sensor channel so that the status does not drop out between cars?
    thanks
    Bob S - Cleveland, OH
    What are your thoughts on this?

    • @LittleWicketRailway
      @LittleWicketRailway  Před rokem

      Hi Bob, I 3D print "gates" like the ones you describe for 3mm LEDs. I desolder them from the sensor and extend the wires under the track. Not aware of anything commercially that does this, but I'm sure it can be built without 3D printing.
      You can add a "debounce" time to a sensor in JMRI so that it will hold a detection for a set time to stop "flickering".

  • @TravelinginMiniature
    @TravelinginMiniature Před 4 lety +1

    Thanks for the well explained tutorial on automating your layout. I would be interested other projects using the part 1 set up. Like stopping at a station, driving signals, filling up at a water tank, etc. Have you looked at RFID to identify your locos?

    • @LittleWicketRailway
      @LittleWicketRailway  Před 4 lety +1

      Thanks James. Check out the video on servos (pt3) for examples of driving semaphore signals. In the near future I'll be posting a video bringing together DCC++, the sensor hub and servos to semi-automate the test layout using JMRI dispatcher and fully automate the test layout by writing a script.
      RFID isn't something that I've properly looked into yet, but I am aware of it and it's something that I'm interested in. McKinley Railway have put some RFID technology in place and are using it to track their wagons I believe, I recently watched their video on that, but it wasn't really a tutorial on how to do it.

    • @TravelinginMiniature
      @TravelinginMiniature Před 4 lety +1

      @@LittleWicketRailway thanks so much for the response. I just came across your channel (I subscribed) and making my way through the tech videos. I will be using your recommendations to at least control routes and signals and animation.
      Love the production quality, your English accent (It's sometimes hard for us tanks to understand Brita but yours is easy to understand), the simplified explanations. I wish more JMRI and Arduino videos were as well explained.

  • @farmerdave7965
    @farmerdave7965 Před 3 lety +3

    The sensors are reflective. Why are they not reflecting off the loco ?

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety +1

      Good question, because the loco is black and its surface isn't reflective enough to the return the IR wave back to the sensors. If you were using a white (or lighter colour) loco then you could get rid of the reflective gate and just have them activate as the train passed.
      Normally I would mount these sensors under the board, facing up at the underside of the locos. These are almost always black so I have to attach small pieces of reflective tape.

  • @Hugocat100
    @Hugocat100 Před rokem

    Hi, just looked at three of your videos, 2 on the Sensors and the one on Automation. Excellent thank you I have been wanting to look at both Ardunios and automation for some time but haven't found such excellent tutorials, all the others go way over my head. Couple of questions: The Model-Railroad-Hobbyist blog site seems to have changed since your video. I have downloaded "Sensor_Chanel_Rev2" is that OK? do I need any other downloads from that source? Also can I use my NCE Power Cab instead of your Arduino built controller? Thanks.

    • @Hugocat100
      @Hugocat100 Před rokem

      OK got it. Read all the posts below!!

  • @Fletchermedialtd
    @Fletchermedialtd Před 2 lety +1

    This is a great tutorial. Can you tell me if the script would work (or would I require changes to the code) with a ESU cab control system that was set up with JMRI? Just starting and there is a ton to understand.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 2 lety

      Hi, this would work alongside other control system in JMRI. JMRI can handle multiple connections. Please take a look at the CMRI series, if you like this then I think you might find that interesting.

  • @anatoliidudko7029
    @anatoliidudko7029 Před 3 lety +1

    Hello, great video as usual. But I do not quite understand where is your dcc command station and how its interconnected to the Arduino with IR sensors. As I see i am not the only one who is questioning this part. Can you please give more details on how do they connected together? Thank you.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety +1

      Hi Anatolii, the DCC++ system is connected to the computer on one USB port, the sensor hub is on another USB connection and servos are connected on another USB port. Everything is then coordinated via the JMRI software. Since making this I have combined the sensors and servos onto a single Arduino, but the DCC++ system is still a separate Ardunio with its own USB connection.

    • @anatoliidudko7029
      @anatoliidudko7029 Před 3 lety +1

      @@LittleWicketRailway Thank you a lot.

  • @Golkun1
    @Golkun1 Před 3 lety +1

    It's best to kill the script when the loco is in the 10s pause state. Otherwise you have to stop it with the throttle.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety

      Yes, if you killed the script whilst the train was moving it would continue moving until it received another command.
      You could build something into the script to turn the shuttle on and off. Maybe the script only works when a "sensor" is active. That sensor could be a click button in panel pro or a physical switch attached to the sensor hub. Scripts are very powerful and flexible.

  • @colintelfer2756
    @colintelfer2756 Před 2 lety +1

    Hi Rob, I have been following your dcc videos with interest as the last time i had a model railway was in the days of DC. Just a query being a novice on the JMRI and arduino approach, i have set up a base station following your video using a uno arduino with a motor shield which i have set up in JMRI. The sensor hub video is using a mega arduino, how does this tie in with the uno which is used to control the locomotives on the layout? Does the mega arduino plug into a different usb port on the same PC and the control is all through the JMRI software talking to the two arduino boards? Sorry if i hve repeater some of the queries below, i did wonder if it was possible to use a micro reed switch (sensor) which is triggered by a small Neodymium magnet what do you think? only thing is i am unsure how it would be configured on the arduino with being a novice.
    Thanks in advance for any help pointers/ advice.
    Regards
    Colin

    • @LittleWicketRailway
      @LittleWicketRailway  Před 2 lety +1

      Hi Colin! Yes, easiest way is to use 2 USB connections on your computer, one for the DCC control and one for the sensors/outputs. I've heard that DCC++Ex might allow you to combine the DCC++Ex controller and sensors into a single package, but I've not tried yet.
      You can definitely use a reed switch as a sensor. Connect this to the signal pin and either the GND or VCC pin on the Arduino depending on whether the signal pin is pull up/pull down. Maybe experiment with a normal push switch and see if you can get that working first. Anything that create a digital output can be easily used as a sensor. Analogue output is harder to use, but still possible.

    • @colintelfer2756
      @colintelfer2756 Před 2 lety

      @@LittleWicketRailway thanks Rob.

  • @paulwillis866
    @paulwillis866 Před 3 lety +1

    Hi.. Great video thank you. Very clear.
    I am just getting going with N gauge and DCC++. I only have 2 USB ports on my laptop - one for my mouse and one for DCC++ Ardhuino. Will the sensor hub work via a USB expander port?
    Do you know if 3mm end-on sensors are available? Those on the side will be difficult to fix under the board.
    Many thanks.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety

      Hi Paul,
      I've not used a USB hub, but it's something I'm likely to try in the near future as I hope to switch from using a laptop to using a tablet which only has a single USB port. I would assume this is possible as long as COM ports can be assigned and allocated in JMRI. If I do it then I'll let you know for sure.
      Check out TCRT5000 sensors, I think these have 3mm LEDs. They come with a little plastic holder around both LEDs, but this easily comes off if you need it to. The LEDs fit easily between OO gauge sleepers, not sure if they would fit between N gauge sleepers or whether you'd need to trim/remove a sleeper.

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety

      Some useful information here: model-railroad-hobbyist.com/node/35506

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety

      Hi Paul, I've just connected a powered USB hub with an additional 4 USB ports and it's all working fine. Windows has allocated the same COM ports to the boards that it did when they were connected directly. This is the hub that I've used: www.amazon.co.uk/gp/product/B07KFDFT4D/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&psc=1

    • @paulwillis866
      @paulwillis866 Před 3 lety

      @@LittleWicketRailway Fantastic news! Thanks for sharing it

  • @oceancity1042
    @oceancity1042 Před 3 lety +1

    Can you clarify , how is power to the tracks supplied ? Is it through the arduino connected to the sensor shield? You turn it on thro JMRI but do not make it clear - please clarify.
    Thank you

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety

      Hi! I power the track using the DCC++ base station which is connected to JMRI. The sensor system is on another Arduino also connected to JMRI using another type of connection.

    • @oceancity1042
      @oceancity1042 Před 3 lety

      Hi,
      From you response , am I correct to understand JMRI can recognise inputs from more than 1 USB connection ( ie one from the base station and one from the sensor hub )

    • @LittleWicketRailway
      @LittleWicketRailway  Před 3 lety +1

      Yes it can. I've got the DCC++ on one USB connection and the CMRI stuff (sensors, servos, etc.) on another USB connection 👍

    • @oceancity1042
      @oceancity1042 Před 3 lety

      Thank you