Sign in to follow this  
Duq

Commuting train using 2 RCX's

Recommended Posts

Most of our layouts run a loop, but this time we wanted a commuting train on a single track. After considering different solutions using control centres and various non-Lego parts I came up with this solution for two RCX bricks. At each end is a setup like this:

9070029033_50b313fec4.jpg

RCX Train Control by Duq, on Flickr

The track connector is attached to outputs A & B together using a 2x4 electric plate. Using two outputs allows more power for the track. The third output is used for the PF light. Only one input is used, the original Mindstorms light sensor. Halfway along the track I used some sellotape to insulate the two sides.

Hiding the light sensor under the platform makes it virtually invisible but the main advantage is that it's sheltered from ambient light. This makes the light trap very reliable. The trap at the other end of our track was not underneath a platform and as a result it failed when some sunlight lit up the room.

The structure of the program is simple; when it starts it runs the train inwards until the light sensor detects a drop. It then pauses for a few seconds and send the train out in the opposite direction. After running it for a few seconds (the time it takes to reach the sellotape plus a few seconds) and then reverses the direction again.

Before the direction is changed however the train will have crossed into the other section which was pulling the train in and waiting for the light sensor to be triggered. By the time this second section sends the train out again the first section is waiting for the train again.

The system ran quite reliably all day long. This setup has a lot of advantages. Because it uses a light sensor trains will stop at the end of the platform, no matter where in the train the motor is. The program on both sides is identical (although I had to adjust the light sensor threshold and running times because the sellotape wasn't exactly in the middle). You could use this setup for a stop along a line as well.

For the next show I want to add control of a switch so one train arrives in the station and another leaves.

Share this post


Link to post
Share on other sites

That's a really cool setup. Quite expensive to set up if you don't have that stuff laying around, I guess.

Share this post


Link to post
Share on other sites

Not too bad really. Used RCX will cost about €25 on Bricklink, light sensors are under a fiver. PF lights aren't expensive either and can be replaced with any other LED if necessary.

Share this post


Link to post
Share on other sites

Nice little job. When I built my light sensors I added a tube on the sensor end to reduce the impact of ambient light and another tube on the light source to reduce the unnecessarily illuminated area (details can be found here).

Now as for adjusting to changing lighting conditions, you could incorporate an auto calibration step in your program, e.g., sample the light sensor at the same time that you swap directions (since you assume the train must be far from the station at this instant). Then do an exponential filter with small influence of the current sample: new_set_point = p * old_set_point + (1-p) * (current_measurement - threshold). Make sure p is above 0.9 so that the occasional spurious measurement won't throw things off.

Share this post


Link to post
Share on other sites

That's an interesting idea. Why didn't I think of that?

Share this post


Link to post
Share on other sites

This is awesome Duq! How would it work with non-9v track and a PF-powered train? IR tower?

One could better use an NXT (2.0) with this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.