To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.trainsOpen lugnet.trains in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Trains / 19973
19972  |  19974
Subject: 
RCX Train Sensor
Newsgroups: 
lugnet.org.ca.rtltoronto, lugnet.trains
Date: 
Fri, 2 May 2003 22:35:20 GMT
Viewed: 
200 times
  
I was languishing at home today with a cold, and I got to thinking about
running trains with an RCX.  I've been dreaming of having one or two
trains automated to pull into a station, wait, pull out again, etc.  But
all this hinges on having the RCX know when the train is in the station.

In the past I've tried light sensors and touch sensors, but they were
usually unreliable, bulky, or both.  Unfortunately, an unreliable sensor
usually leads to a derailment, and that caused me to avoid the whole
issue.

Today I thought of using a magnet to detect a train.  Guess what?  It
works like a charm.

The sensor uses only Lego parts, fits in a 6x8x2 volume, and nestles
snugly under a straight track.

http://www.brickshelf.com/gallery/jeffe/Train/TrainSensor/trainsensor3.jpg
http://www.brickshelf.com/gallery/jeffe/Train/TrainSensor/trainsensor1.jpg

The principle is simple:  a freely rotating magnet is placed in front of
the LED of a light sensor.  It casts a shadow onto a white brick in a
light-proof box.  The sensor detects the shadow, which varies (in my
case) from a reading of 32 (horizontal) to 43 (vertical).  A second,
fixed magnet positioned a short distance from the sensor magnet causes
the sensor magnet to revert to horizontal after a train passes.

http://www.brickshelf.com/gallery/jeffe/Train/TrainSensor/trainsensor2.jpg

The sensor readily detects a pair of coupled magnets (between a pair of
coupled cars), or a fixed magnet attached beneath a car.  If you remove
the second magnet from the sensor, it will also detect a single,
uncoupled magnet, or a train motor, but doesn't neatly reset to
horizontal each time. (The second magnet, in the configuration I've
built, overpowers uncoupled magnets or motors.)

I wrote a quick NQC program to use the sensor.  When armed, a trigger
light value (say, >36) turns off the track.  When the train is
restarted, it waits until the sensor has been below trigger level for 2
seconds before rearming - this allows a train of any length to pull out
over the sensor at any reasonable speed before rearming.

I've had a single train running around an oval on the floor for a good
half hour now, stopping for 5 seconds every second loop.

Obviously, the usual control problems exist even with this sensor:
Trains take a finite amount of distance to stop (usually about 20-30
studs), and this varies with train length, nearby curves, points, etc.
If you want rock-solid behaviour, you should probably mount two sensors
a short distance apart, and begin to slow a train as it passes over the
first sensor, stopping it when it reaches the second.

At any rate, I hope this proves useful!

Jeff Elliott



Message has 6 Replies:
  Re: RCX Train Sensor
 
(...) this. Althought, since the train station is on your side I don't really need to do anything. :-) Derek (22 years ago, 3-May-03, to lugnet.org.ca.rtltoronto, lugnet.trains)
  Re: RCX Train Sensor
 
"Jeff Elliott" <jeffe@telepres.com> wrote in message news:3EB2F2A8.4CCBC6...res.com... (...) Iain (22 years ago, 3-May-03, to lugnet.org.ca.rtltoronto, lugnet.trains)
  Re: RCX Train Sensor
 
(...) <snip> Hi Jeff, I'm not sure if you want to keep it a "100% lego" solution, but if not I think a reedcontact for magnetic detection might be simpler (and a lot smaller!). I dont know how well that would tie in with an RCX though. I have no (...) (22 years ago, 4-May-03, to lugnet.org.ca.rtltoronto, lugnet.trains)
  Re: RCX Train Sensor
 
(...) I solved the unreliable light sensor problem [1], although my version still sticks out two studs from the tracks on one side, and five out on the other. Also there's an extra wire, due to shining a light bulb at the sensor. But we just ran a (...) (22 years ago, 5-May-03, to lugnet.org.ca.rtltoronto, lugnet.trains)
  Re: RCX Train Sensor
 
(...) Jeff, I'll admit that as a train thing I had minimal interest, but for some reason the idea percolated in my brain and I cant help but try to figure out some sort of robot application for this. Chris Why do solar calculators have an off (...) (22 years ago, 5-May-03, to lugnet.org.ca.rtltoronto)
  Re: RCX Train Sensor
 
In lugnet.org.ca.rtltoronto, Jeff Elliott writes: <snip some description> (...) Jeff, great work! I have managed an automated working layout of one loop with parallel siding and two alternating running trains. The two trains run in opposite (...) (22 years ago, 6-May-03, to lugnet.org.ca.rtltoronto, lugnet.trains)

19 Messages in This Thread:







Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR