Page 1 of 1

NXT Train Controller

Posted: 02 Feb 2011, 16:26
by mindstormwizard
Hello!
I have a Lego 9v train, along with a 1.1 NXT. I would like to be cable to combine the 2 items so that the mindstorms works the train (or helps work it).
I have:
1. Used the NXT to power the train forward.
2. Make it run forward until the ultra-sonic (which is beside the track) senses it then the train stops, bang on at the station. Plays 1 sound-wait 10 seconds-Pay another sound then pull off.
3. (on a differnet program to #2.) Make it run forward. When the light sensor senses the level crossing goes down, timer of ~5 seconds starts, train gets through and the crossing comes back up again.

What I really want to be able to do is this: You press the forward button the train moves forward. You press the back button the train goes backward. So if the train was going top speed (forward) and I pressed the back button, the train would slow down one each press until stopped, then start reversing on each press and vice-verca. Also as it is running if the light or ultra-sonic it would do respectivly what I said on 2 and 3. At the same time the display shows what is happening, but that should be the easiest bit.

Displays work like this:
Forward-Forward Slowly/Average/Fast
Stop-Train Stoping/Train Stopped
Backward-Backward Slowly/Average/Fast
Station-Train stopping/Board the Train/Train Leaving
Crossing-Gates Down/Gates Up

I would be extreamly greatful if someone could help me here.
Thank You

Re: NXT Train Controller

Posted: 02 Feb 2011, 16:50
by h-g-t
Here is how one person did it. Just google nxt and train and you will get a few hits.

http://www.mocpages.com/moc.php/194146

Re: NXT Train Controller

Posted: 02 Feb 2011, 16:56
by mindstormwizard
thanks. it isn't really what I want. remembering that the station is a stop, whereas the crossing is an up/down with servo motors

Re: NXT Train Controller

Posted: 02 Feb 2011, 20:39
by spillerrec
I once mounted a RCX on a train and connected one of the motor output to the connector on top of the train engines (normally used for a lamp or similar). Then you could drive the train directly off the RCX power supply and if you have converter cables something similar should be possible with the NXT too.
But it is not really that useful since the RCX is too big and the NXT is even worse in that aspect...
Now that I'm thinking about it, you could just connect the cable from the tracks directly to the NXT instead of the normal power regulator. I don't know how much current is required or how it can affect the NXT though, do it on your own responsibility...
But trying to control the power-regulator is probably a better idea if you can get it to work properly.

All this is assuming you have the old 9V trains that are powered by the tracks. I don't quite know how the new ones work, but isn't it with IR? Then perhaps the 3rd party IR sensor could do the job...

Re: NXT Train Controller

Posted: 02 Feb 2011, 21:07
by mindstormwizard
I have craked it. The key was don't get the switches to do an either/or. Get them to work togethter, then analyze which was set off. I have added it to NXT Log for all of you interested, but they haven't approved of it yet. If you want to get updated when they do please "like" this facebook page which I have created.
http://www.facebook.com/pages/Mindstorm ... 324?v=wall