Model train location on the track.

Discussion in 'The Projects Forum' started by RyanD, Dec 19, 2014.

  1. RyanD

    Thread Starter Member

    Jan 14, 2010
    30
    0
    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. :)
     
  2. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    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.
     
  3. RyanD

    Thread Starter Member

    Jan 14, 2010
    30
    0
  4. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    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.
     
  5. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,793
    829
    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".
     
  6. RyanD

    Thread Starter Member

    Jan 14, 2010
    30
    0
    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.
     
  7. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    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.
     
  8. RyanD

    Thread Starter Member

    Jan 14, 2010
    30
    0
    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?
     
  9. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,984
    3,722
  10. RyanD

    Thread Starter Member

    Jan 14, 2010
    30
    0
    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.
     
  11. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,984
    3,722
    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.
     
  12. RichardO

    Well-Known Member

    May 4, 2013
    1,229
    382
    A Web camera mounted on the ceiling looking down at the track and some image recognition software? :D
     
  13. MrChips

    Moderator

    Oct 2, 2009
    12,418
    3,355
    Bar codes on the ground or on side walls and LED and photo sensor on the train.
     
  14. RichardO

    Well-Known Member

    May 4, 2013
    1,229
    382
    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.
     
  15. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    GopherT likes this.
  16. RyanD

    Thread Starter Member

    Jan 14, 2010
    30
    0
    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.
     
Loading...