You can buy inexpensive switches with levers and wheels that will switch on and off when the train passes by. You might find these at a hardware store or Radio Shack or other electronics specialty store. They are essentially just a long metal spring with a wheel on the end connected to a switch which you can bolt to the side of the track and it will switch as the train passes by. It may rob your train of some of its energy to push the switch as it goes by. A frictionless alternative is to have a light source (LED) and a detector on the other side which triggers a relay which powers up your electromagnet. But this can cost more money in parts, but electronics is always getting cheaper.
Here are some pictures of mini switches:
A warning about electromagnets -- they resist being powered up and being powered down. There will be some delay in getting an electromagnet powered up, depending on how strong your battery is and how big the magnet is (if it is a small magnet you donít have to worry, but with big trains it is a concern). Also important is switching off an electromagnet when you no longer need it. The energy stored in the electromagnet will end up in a spark in your switch as you break the circuit. Again, this not a problem for a small magnet, but for a big one, this can be devastating.
I recommend going to an electronics supply store and having fun!
Another thing to remember is that your train will NOT levitate stably with just some fixed magnets on and near it, unless youíre using some superconductors in your design. You will need some sort of switches just to keep it levitating, not just to move it forward. Iíve heard that the German maglev trains actually hang down from the rails. When they start to fall too much the current in the electromagnets is increased to pull them back. If they start to get pulled too high, the current is decreased.
good luck on your tough project.
(republished on 08/02/06)