Model train location on the track.

Thread Starter

RyanD

Joined Jan 14, 2010
30
So I have a DC train powered by an arduino moving around the track. I'd like to be able to tell where the train is so I can change speed and what not depending on other factors. The accuracy doesn't have to be dead on, for example I could have a market every few feet which would be fine enough. Any ideas on how to best do this so it's cheap? I looked into rfid but I'm not sure it would read quick enough if the train was moving fast. I thought about using IR and having the train read unique codes around the track but there might be reflection issues. I found a nice RGB sensor that I could use to read colors signs or led around the track but I'm not sure how well that would work either. I'm looking for some creative ideas. :)
 

takao21203

Joined Apr 28, 2012
3,702
trains dont move so fast i think you can send a few bits with 2 inductors you just need to make the airgap small. Use some small cheap Arduino clone for the senders.

Its kindof similar to a IR remote control- just the range is much smaller.

If your train moves 1m/sec, it moves just 1mm in a millisecond.

There are large 1W RF inductors, and much smaller 1/4W kinds, both have a dogbone type core inside.

I played with these inductors some day, using NE555 and a small speaker, holding them close together, I got audible effects. Not sure if it works without amplification but its not so difficult either.
 

takao21203

Joined Apr 28, 2012
3,702
you need something more short range. You dont need modulation on a HF carrier just direct transformer coupling. These modules are kindof slow actually.

Or use a few IR diodes repeating if you are scared by the inductors. If you have a few cm covered, in the time you need to read the few bits, its like your train isnt moving at all.
 

djsfantasi

Joined Apr 11, 2010
9,156
One way is to put insulated gaps into the rails, creating "blocks". Then, put a train detection circuit in line with each blocks power feed. The circuit would detect current through the ails. Hence you'd know where the train was in general. Smaller blocks mean more accuracy. You might use small blocks around a station.

A similar concept breaks the track into blocks, but used a photo.transistor or LDR between the rails, which detects when the train covers it.

There are books on the subject. A hobby shop or online store would carry "How to Wire Your Model Railroad".
 

Thread Starter

RyanD

Joined Jan 14, 2010
30
One way is to put insulated gaps into the rails, creating "blocks". Then, put a train detection circuit in line with each blocks power feed. The circuit would detect current through the ails. Hence you'd know where the train was in general. Smaller blocks mean more accuracy. You might use small blocks around a station.

A similar concept breaks the track into blocks, but used a photo.transistor or LDR between the rails, which detects when the train covers it.

There are books on the subject. A hobby shop or online store would carry "How to Wire Your Model Railroad".
What about knowing when there are multiple trains on the same track? This is why I think the train has to have the knowledge and not the track. I could use that to trigger another detector like the IR so it only fires when the train is near to limit cross talk with the ir.
 

ebeowulf17

Joined Aug 12, 2014
3,307
Hall effect sensors (analog signal proportional to field strength) and switches are pretty easy to work with. You could have patterns of magnets (different spacing, reversing polarity, etc) signify key reference points like the start or after any junction, then have individual magnets as regular intervals everywhere else. As the train moved it would read the magnets it passed (north pole, none, or south pole.) If it read a known pattern, it would know exactly where it was, and it could count pulses to gauge distance traveled between key landmarks. Magnets and hall sensors are cheap. Depending on how many uniquely identifiable locations you need, strings of binary code magnets might get a little out of hand. But if you could get away with a very few defined reference points and just use evenly spaced single magnet pulses for distance everywhere else, it might work.

Mostly I just love magnets and any excuse to play with them. Also lasers.
 

Thread Starter

RyanD

Joined Jan 14, 2010
30
Hall effect sensors (analog signal proportional to field strength) and switches are pretty easy to work with. You could have patterns of magnets (different spacing, reversing polarity, etc) signify key reference points like the start or after any junction, then have individual magnets as regular intervals everywhere else. As the train moved it would read the magnets it passed (north pole, none, or south pole.) If it read a known pattern, it would know exactly where it was, and it could count pulses to gauge distance traveled between key landmarks. Magnets and hall sensors are cheap. Depending on how many uniquely identifiable locations you need, strings of binary code magnets might get a little out of hand. But if you could get away with a very few defined reference points and just use evenly spaced single magnet pulses for distance everywhere else, it might work.

Mostly I just love magnets and any excuse to play with them. Also lasers.
Interesting. :) I could probably put a hall sensor (http://www.mouser.com/ds/2/405/drv5033-373174.pdf) on the bottom of the train and put the magnets in the ground under the track. Depending how how close they open and shut I could put multiple on the track. At the very least this is a good proximity indication to trigger other things (signals) or to scan using another method (IR). What if I just put the magnet on the track when I wanted the IR to fire and use the IR to transmit the data so I have more options?
 

GopherT

Joined Nov 23, 2012
8,009
Would that scan quick enough? Here is an idea of the typical speed.


I would love to use rfid but I'm not sure it would scan quick enough either.
I had read your post last night and then stumbled upon the barcode reader this morning - it just made me laugh that all of these commercial/industrial devices are available for us DIY types. I also knew that railroads use bar-code readers in their yards to report car locations. I have no idea if you can read a moving car. If the grocery store is any indication of reliability on bar-code reading, I would guess, no. They have a hard enough time reading a stationary soup can.
 

RichardO

Joined May 4, 2013
2,270
I also knew that railroads use bar-code readers in their yards to report car locations. I have no idea if you can read a moving car. If the grocery store is any indication of reliability on bar-code reading, I would guess, no. They have a hard enough time reading a stationary soup can.
The color bar-codes were a bust. They were abandoned because they were not reliable when dirty. I don't know what the present technology is but I am guessing that it is an RFID sort of thing since I don't see bar-codes on rail cars anymore.
 

Thread Starter

RyanD

Joined Jan 14, 2010
30
So I got a few rfid buttons and a reader, I'll test that out as it seems to have the most flexibility if it works. Thanks.
 
Top