Arduino Uno counter & missing tooth locator.

Hello & Greetings,
I am seeking some advice & some information.

Imagine that there are say 20 magnets that are all in a line they are all equally spaced from each other. They are stuck soundly into a metal toothed rack
Bar one missing magnet say some where in the middle of the rack.

The rack travels backwards & forwards linearly.
There is a hall sensor that is placed near the racks teeth so that as soon as one of the magnets travels past the sensor then it detects its movement going past it in either direction.

Now all that the sensor & Arduino have to do is to detect & then light an LED as the missing tooth sails by past the sensor in either direction.

1 Is it fair to call this kind of lay out a string or possibly an array?
2 If Zero is the start point then what would one call the area where the missing magnet is located.
3 I would of thought that time & magnet detect are the important points to concentrate on.
4 Would velocity be a part of the equation.
5 The number of magnets are an important part of the equation though.

Any help & advice that you fine people can throw at me would be very much appreciated.

Thank you

Think you will find plenty of guidance if you serch on "arduino tachometer", similar principles.

Good morning Ricky,
Thank you for your reply.
I will check out your advice over morning coffee.

And post my thoughts & concerns later

Thank you.


This sounds like just the sort of project where a short experimental program will tell you a great deal - and perhaps focus your thoughts onto a specific question.

You may find some ideas in Planning and Implementing a Program - including about timing.


Any help & advice that you fine people can throw at me would be very much appreciated.

Does the rack always travel at the same speed ?