I'm working on a small project, among sensing other stuff, i'm trying to get the speed of a motorcycle, based on the number of turns of the front wheel. To do this, i've managed to put my hands on a small bicycle speedometer, chopped the magnet / sensor and connected it to an arduino mega (i believe it's a hall sensor, but who knows, the thing is heavily packed in plastic, with only 2 wires coming out) The arduino 5+v goes to the sensor, and the input goes to pin 18(wich should be an interrupt if i'm not wrong) and is tied to ground via a 3.9k. Everytime the magnet reaches the sensor, i'm getting an interrupt. So far so good. I'll try to add more detail: /Not necessarily useful stuff Refreshing the speed in the screen every 500 ms sounds great to me, so i'm counting how many times the interrupt gets triggered in that amount of time. I've measured the wheel circumference, and it's 1.88 meters. So, let's say i count 3 turns in 500ms, then this should be something like: 3 turns * 1.88 mts = 5.64 mts If in 500 ms the wheel does 3 turns, then in 3600000(1hour) it would be...21600 turns... based on that, i can assume speed. / End of blablah Well, the problem actually is that the wheel circumference is too big, and the speedometer "resolution" is really poor, it jumps from 0 to 13 to 27 to 40, and so on... I know adding more magnets would give me more accuracy, but i had to debounce the sensor, because it was giving me two readings every time the magnet was passing by. From some basic(random) calculations, i've used 50 ms as debouncing. If the last pulse was read at least 50 ms ago, it's counted, if not, i discard it (do nothing). Adding more magnets means less time between pulses, wich could be impossible to debounce. Searching different methods, i've found an optic mouse-like sensor. I'm thinking on using the brake disc to count revolutions, using the small refrigeration holes. But i'll have to deal with interference from the sun, cars headlights, road water. rain, and lots more... I've seen rotary encoders, but i'm not sure i can mount that, and price here in my country is a bit too high. Can it be mounted as the old bike generators? (a little wheel spinning with the main wheel) Maybe using one of those little electric engines from toy cars? can it be measured somewhat proportional to the number of turns? Is there a better method of doing this? It doesn't need to be 1km accurate, but the more, the merrier :D I can add more detail, but might be even more confusing. Any idea helps!
Thanks in advance!