the sensor reads metal so the idea is putting a small gear and get the sensor to read a rotation as the number of empty spaces/ the spaces in the gear
That made very little sense. Please try again. Read the forum guide in the sticky post first.
You'll need to know the number of spaces in the gear and the part number of your sensor for starters.
Your program would be more reliable if you counted the teeth rather than the spaces between them. BUT, you count ONLY when the Hall effect sensor signal changes, not while it is on or while it is off.
The sensor reads metal/no metal only when you glue a small magnet on the back of the hall sensor.
Note that is must the correct type of hall sensor AND the magnet must be the correct way around.
If you use say an el-cheapo like a KY-003 hall sensor, then they are normally a 3144 which switches rail to rail.
You must have a pull up 10k resistor on the signal if you use just the bare hall sensor itself as they are open collector.
The KY-003 already has an LED connected so no need to add anything there plus it is a means of checking if it is switching on or not.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.