Best Sensor for position?

I am designing a cart that moves on a rail. I need it to stop at certain intervals but it needs to be at exact locations. What would be a good sensor to use? I was thinking about some kind of IR sensors but I would need to have two of those to make sure the cart stopped between them, and the space between some intervals might be small so there will be overlap. I was also thinking about a hall effect sensor. My only concern is will the hall sensor pick up the magnetic field attached to soon? Any suggestions would help and maybe there are other things I can do that I am not aware of.

Hall effect sensors are cheap enough to buy a few and test. These things are used in high speed, high precision applications like car engine timing I think, so you should be ok.

If I remember when I get home tonight (0430 here, getting ready to head to work) I'll hook one up to the 'scope and see what the output does as the magnet approaches from the side.

If you get a typical threaded hall sensor (Eg then you can simply wind the sensor back a bit and it will make the pickup less sensitive.

I've played with those cheap hall sensors quite a bit and found that a gap of about 8mm with 6v+ (They don't perform consistently with 5v) will only trigger when the magnet is right under the sensor.

Thank you for the replies I will look into it. From what I have seen online the Arduino modules for hall effect sensors can be set to only react at certain Telsas.

You need to read the datasheet for the sensor and make sure you have a magnet that provides the required field yes... I recently bought some Neodymium Iron Boron (NdFeB) magnets which are so strong I can hardly tear them apart and they pull tools across the desk, Ninja style.

Don't limit yourself to "Arduino modules" as you call them: almost as easy, and probably a bit cheaper to get a loose sensor and wire it up. In fact you may find a loose sensor is easier to fit into your project.

Do look at the different types of Hall sensor though: some latch some don't some start at 2.5V and go towards 0 or 5 depending on the direction of the field.

I didn't get round to doing the tests I mentioned, but it's Saturday so I'll try today or tomorrow.

Have you considered the momentum of the cart? You may need to arrange some sort of brake.


I dont plan on it moving to fast and the weight it carries should stop it within an acceptable range. I dont need it to stop exactly at the spot but within a small range.