!!

Not Registered?

Welcome!  Please register to view all of the new posts and forum boards - some of which are hidden to guests.  After registering and gaining 10 posts you will be able to sell and buy items on our N'porium.

If you have any problems registering, then please check your spam filter before emailing us.  Hotmail users seem to find their emails in the Junk folder.


Thanks for reading,
The NGF Staff.

Author Topic: Using track sensors with railmaster & Arduino  (Read 199 times)

0 Members and 1 Guest are viewing this topic.

Offline RMurphy195

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 125
  • Country: england
    • Awards
Using track sensors with railmaster & Arduino
« on: February 13, 2018, 09:33:34 pm »
I'm looking for a lead to information that will help me with this!

I've developed an Arduino program to run a shuttle, using home-made optical sensors to tell the Arduino when the train reaches particular parts of the track, to control stopping/starting of DC powered locos.

My main layout however is DCC controlled by Hornby elite, and I am now experimenting with Railmaster for train control.

I would like to build my sensors into my main layout to detect when the train reaches particular parts of the track, as with the shuttle, so they will need to be "read" by Railmaster via the elite.

Anybody give me a lead on how to set up the commuincation sensor - Elite so railmaster can pick them up ?
« Last Edit: February 13, 2018, 11:54:06 pm by Railwaygun, Reason: title expanded »

Offline Railwaygun

  • Moderator
  • Trade Count: (+2)
  • Full Member
  • ****
  • N Gauge Society Number: 21889
  • Posts: 3787
  • Country: gb
  • Gender: Male
  • Keen on Military Rail, Kato Unitrack, & Z21/DCC
    • Railwaygun, Armoured train and Military Railway group
    • Awards
Re: Using track sensors with railmaster & Arduino
« Reply #1 on: February 13, 2018, 11:56:41 pm »
perhaps an appeal on the Electronics /  Arduino group?

http://www.ngaugeforum.co.uk/SMFN/index.php?board=157.0

This has been a public service announcement
It may contain alternative facts

Caveat lector

The largest Railwaygun, Armoured Train & Military Rail group in the world!
https://groups.io/g/railwaygun/topics

My Military Rail Pinterest area
https://uk.pinterest.com/NDRobotnik/

Motto: Semper ubi, sub ubi

Offline njee20

  • Trade Count: (+4)
  • Full Member
  • ***
  • N Gauge Society Number: 22598
  • Posts: 3204
  • Country: gb
    • Awards
Re: Using track sensors with railmaster & Arduino
« Reply #2 on: February 14, 2018, 08:13:39 am »
Iím not 100% familiar with Railmaster, but I was under the impression itís designed solely for Hornbyís ecosystem, and while itíll talk to other accessory decoders, you need something that can talk to the Arduino, which is much tougher. The obvious candidate is JMRI, as itís free, but ITrain, Train Controller etc will likely do what you want too.

Offline Nigel Cliffe

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 494
  • Country: gb
    • Awards
Re: Using track sensors with railmaster & Arduino
« Reply #3 on: February 14, 2018, 09:40:19 am »
As per njee20.   Railmaster is "ask Hornby how to do it" because its a closed system.   For a shuttle, you'll find all you need in JMRI which is open source and widely supported.  The Elite does work with JMRI (though has issues, below).   

For any system (DCC command station and choice of computer software), you need to get your sensors onto some sort of data network to send messages to the computer.  The common ones are:  LocoNet, RSBus, S88, CBus, LCB, or a means of going directly into the computer.  The first three have been around a long time, and have commercial support as well as DIY designs.  All three can be built "stand alone", you don't need the support of your command station.    The latter two are: CBus is from UK hobby group MERG, good support, but completely DIY and kits.   LCB is the new NMRA standard for layout control, some support from a couple of US companies, but possibly too late to the table to get a lot of commercial traction.   

Or, if your requirements are fairly small (less than 30 input sensors), then a Raspberry PI computer (£30) and JMRI will do the job.  There are 30 "GPIO" pins on the Raspberry PI, and those can take binary inputs (such as sensors) and pass them to JMRI as sensor events.  (The PI is able to run JMRI really well).   Thus JMRI has the information.   
And, there is a DCC command station for the Arduino called "DCC++", which needs the Arduino processor and a H-bridge driver to run the layout.  Plug that into the PI (chuck out the Elite), and I think you may have a cheap solution. 


Now the Elite and why you'll replace it...    The Elite seems to suffer from a buffer problem.  If you send a sequence of accessory (turnout) instructions to it from a computer, the Elite will randomly drop one or more of those instructions.   It won't inform the computer of the full buffer.  Some time ago, I worked on a layout which used an Elite, and the only way I found around this was to introduce delays of more than a second between instructions from the computer.  Which makes some things terrible - changing a colour light signal will mean it goes through an incorrect state for more than a second until the sequence is completed,  turnout routes can take an age to setup.  In the end, we gave up, and substituted a different DCC system and left behind all those problems. 
   


Offline RMurphy195

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 125
  • Country: england
    • Awards
Re: Using track sensors with railmaster & Arduino
« Reply #4 on: February 14, 2018, 04:51:02 pm »
Thanks all,but I don't want to talk to the arduino, raspberry pi or anyhting else, I am looking to put sensors on the Railmaster controlled track that Railmaster will recognise to enable reliable starting/stopping of trains where I want them to, not when railmaster says so! So I want to adapt my existing technology (the sensors) so that RM will recognise them, and this is the sort of resource that I was looking for a pointer to. Nigel's reply seems to tell me I'm barking up the wrong tree with RM - especially since my learning curve on this has shown I can't run multiple programs - ho hum. For now I have enough working to keep my grandson entertained.

The shuttle is (or rather will be) a separate layout controlled entirely by arduino, not using DCC - an interesting challenge involving a programming exercise and electronics learning curve! (this is the subject of my post here http://www.ngaugeforum.co.uk/SMFN/index.php?topic=40319.msg490099#msg490099

Thanks - Richard
« Last Edit: February 14, 2018, 05:02:26 pm by RMurphy195 »

Offline njee20

  • Trade Count: (+4)
  • Full Member
  • ***
  • N Gauge Society Number: 22598
  • Posts: 3204
  • Country: gb
    • Awards
Re: Using track sensors with railmaster & Arduino
« Reply #5 on: February 14, 2018, 05:55:08 pm »
Ignore Railmaster for a second, the issue you basically have is that you need your sensors to communicate on a DCC protocol, so that the signals can be interpreted by a computer (running some software for a purpose). Thatís where you have issues, RPi or Arduino are the obvious (and different) user Ďeditableí bits of hardware which will do what you want. The problem you then have is that Railmaster isnít designed to talk to either of those bits of hardware.

Itís not as straightforward as just adapting your sensors, you need an intermediary bit of hardware. Imagine it wasnít a sensor, but an LED. You canít take a single LED and get Railmaster (or any other software) to control it without a bit of hardware in the middle to send readable signals to the software.

I believe Railmaster will talk to some 3rd party accessory decoders, but I donít know in what protocol, from those Nigel lists above, but using Railmaster certainly complicates things no end. Using, for example JMRI, you interface your detectors via the Arduino and set that up as the hardware, then youíre away.

Offline DCCDave

  • Trade Count: (+4)
  • Full Member
  • ***
  • Posts: 813
  • Country: gb
    • Awards
Re: Using track sensors with railmaster & Arduino
« Reply #6 on: February 14, 2018, 05:55:42 pm »
Thanks all,but I don't want to talk to the arduino, raspberry pi or anyhting else, I am looking to put sensors on the Railmaster controlled track that Railmaster will recognise to enable reliable starting/stopping of trains where I want them to, not when railmaster says so! So I want to adapt my existing technology (the sensors) so that RM will recognise them, and this is the sort of resource that I was looking for a pointer to. Nigel's reply seems to tell me I'm barking up the wrong tree with RM - especially since my learning curve on this has shown I can't run multiple programs - ho hum. For now I have enough working to keep my grandson entertained.

The shuttle is (or rather will be) a separate layout controlled entirely by arduino, not using DCC - an interesting challenge involving a programming exercise and electronics learning curve! (this is the subject of my post here http://www.ngaugeforum.co.uk/SMFN/index.php?topic=40319.msg490099#msg490099


Richard,

I think you have missed the point here.

There needs to be communication between your sensors and the software you wish to use for control. On the rails the communication is one directional only unless you are using Railcomm or Digitrax transponding which the Hornby kit doesn't support. In order to communicate back to software you need a communications path apart from the rails which is what Nigel was referring to (LocoNet, RSBus, S88, CBus, LCB etc.). The Hornby kit supports (only) XpressNet, and a minimal subset of that protocol to boot. If what you are after is any level of reliability in computer automation then, in my experience, Hornby is not the place to start.

I'd really recommend you download JMRI and have a play with it, read the documentation and understand the requirements for reliable computer interaction with your railway. While personally I'm not a great fan of JMRI it is useful as a learning tool and the price is right (£0)! And if you really want to get to grips with DCC and computer control it's well worth building yourself a DCC++ system again very informative and not expensive if you source your components carefully. See these videos for all the information you need to put a DCC++ system together,

Cheers
Dave

 

Please Support Us!
May Goal: £55.00
Due Date: May 31
Total Receipts: £55.00
Below Goal: £0.00
Site Currency: GBP
100% 
May Donations


Advertise Here