Science Fair Project

I am using electromagnets to propel a car around a track. Thinking I can use hall sensors to detect the approaching train car, I need to then send an electrical pulse to the electromagnets to push the train. Need advice on setting up a system capable of reading input from a sensor and powering a magnet. Not sure what board or boards to use, and not sure how to send 12 volt DC power to a specific magnet. I have looked about the sight, but am still very unsure what I need. Any help would be greatly appreciated.

Hi matt02510,

Welcome to the forum! This project sounds fascinating. I’m sure you will find a lot of help here, but first we’ll need some more detail on your plan:

  • Do you have the electromagnets yet? How many?
  • How are they controlled?
  • Specifically what types of sensor will you use?
  • Are you making your own sensors?
  • Will you need one sensor per magnet?

There are many online resources for sensors (I’ve used

There are also a number of available relay boards ( for example) that can be used to control high current draw items such as your magnets.


Yes, good project idea. It would work on the same principal as 'rail guns' use so you might search on that to get the fundamentals down. Tricky part will be building the magnets, and figuring out how many you will need to cover the 'track'. Probably a couple of strong neodymium magnets mounted in the back and/or front of the car would help also give better hall-effect switch sensor sensitivity and help with the pushing and/or pulling propulsion via the electromagnets also. Turning a 12vdc magnet on and off is no different then powering a 12 volt relay or solenoid as they are both basically electromagnets. Just wire an output pin to a switching transistor, there are many example circuits in the playground section.

Good luck;


I have 8 electromagnets already, they will work, and they require 12 volts of DC current. The magnet will be controlled by some kind of a board but that is what I need help with. This is the sensor I was planing to use, but have to purchased them yet: I will need 4 sensors (one sensor per "station", two electromagnets per "station"). So again, I am not sure how to read the hall sensors, and send 12 volts those magnets at that specific station. I also do no understand electronics that well, where would I find a transistor, how would I make sure it can power my magnets, and how do I incorporate them into the system? Thank you.

? When I follow the link, it takes me to a page with a number of products (I didn't see a hall sensor) and I'm not sure which item you meant. You might want to double check it.

Anyway, I think a hall sensor works just like any other on/off switch, but is triggered by a magnet. This should be fairly straight forward. I'm not sure what you are asking. Are you asking how to read a generic switch? Or something more specific to a hall sensor?

The 8 magnets can be independently controlled either by relays or transistors. I suggest relays because you are driving them with 12v and will need a separate power supply for them. (Although transistors would work too.) I like the clicking sound of relays. Are you going to control both station magnets together or independently? I.e., will you need 8 relays or only 4?


I will only need 4 relays, I think, the two magnets at one of the stations will be powered at the same time. To clarify, I am not sure what to actually plug the sensors into, or what to plug the magnets into. Also, what is a relay exactly and how does it work? The link works on my page, not sure why it is not working on yours? Thanks.

There are a number of good tutorials on the site ( that can help you understand switches, relays, and general programming techniques.

Also - google is your friend! I've found a lot of good information that way.

Enjoy! Keep us posted on your progress!