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.
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.
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 👍
@@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 :)
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.
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.
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.
@@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.
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.
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).
@@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
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?
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.
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 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.
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?
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".
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?
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.
@@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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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
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.
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 )
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.
I have to tell you...that was a very well Scripted tutorial... bookmarking this.
Thank You!
Thanks 👍 😊
Brilliant. Now that winter is coming I plan on implementing this into my RR.
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.
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 👍
@@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 :)
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
Hi thank you for your videos there really informative and I’m enjoying working through them
Cheers Kevin 👍
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.
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).
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.
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.
@@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.
Extreme well done, lots of great information!!
Thanks Bryan 👍
Great videos 👍 very informative and will help a lot. Thank you!
Thanks Edward 👍
This is a very informative tutorial, nicely presented.👍
Thanks, much appreciated 👍
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.
Doh, did it again. Using a version of the SensorScan script that wasn't modified
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).
@@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
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?
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.
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.
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.
@@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.
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?
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".
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?
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.
@@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.
The sensors are reflective. Why are they not reflecting off the loco ?
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.
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.
OK got it. Read all the posts below!!
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.
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.
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.
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.
@@LittleWicketRailway Thank you a lot.
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.
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.
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
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.
@@LittleWicketRailway thanks Rob.
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.
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.
Some useful information here: model-railroad-hobbyist.com/node/35506
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
@@LittleWicketRailway Fantastic news! Thanks for sharing it
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
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.
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 )
Yes it can. I've got the DCC++ on one USB connection and the CMRI stuff (sensors, servos, etc.) on another USB connection 👍
Thank you