Does anyone know how to find out the angular speed of a motor [in RPM or Hz]? Which is the best sensor for that? I thought about using an accelerometer, but maybe there is an easier, more direct way to do it.
For POV you really need a rough idea of speed but an accurate pulse per revolution to set the start-point - magnet and hall sensor are pretty flexible the latter. The rough speed can be determined from the rotation period (assuming the speed doesn't vary rapidly).
Note there are two types of hall-sensor, analog out ones (rarer) and hall-switches with logic output (common, usually open-drain outputs though). Switches are normally the easiest for this kind of use, they will pick any reasonable magnet at shortish range and have built-in hysteresis (no debouncing needed) - they are made for commutating brushless motors, mainly.
But isn't it a little inconvenient connecting this encoder to the motor shaft?
MarkT:
For POV you really need a rough idea of speed but an accurate pulse per revolution to set the start-point - magnet and hall sensor are pretty flexible the latter. The rough speed can be determined from the rotation period (assuming the speed doesn't vary rapidly).
Note there are two types of hall-sensor, analog out ones (rarer) and hall-switches with logic output (common, usually open-drain outputs though). Switches are normally the easiest for this kind of use, they will pick any reasonable magnet at shortish range and have built-in hysteresis (no debouncing needed) - they are made for commutating brushless motors, mainly.
Maybe if I use several hall sensors I can get a good result. Thank you.
But isn't it a little inconvenient connecting this encoder to the motor shaft?
There are optical encoders, probably you even can hack your old PS/2 mouse, there are two encoders. All you have to do is attach a disk, cardboard will works just glue it to shaft. Than punch a hole in paper, so at one point an optocoupler's pair ( photodiode and LED ) would see each other through the hole. Electrical interface with optocoupler is pretty easy, dozens examples at SFE web site and in playground.
Following suggestions, I have used an opto switch to measure the angular speed of my dc motor. Everything worked just fine, except for a little detail.
I measure the speed and print it to the serial, using the following code:
It works just fine up to approximately 3000 RPM. At higher speeds (I tried ~ 6000 RPM), however, the printed values go crazy. If I remove the phrase I am printing ("Speed = X RPM"), and just print the speed value itself, it works again.
So, I suppose the time it takes for the arduino to print the phrase to the serial is messing with my measurement. Does anyone know whether it is possible to deal with this problem?
And just to note, at even higher speeds (~ 10000 RPM), it doesn't work at all, because the frequency of the motor interferes in the circuit (the values go crazy when the sensor just approaches the motor) , but I think this can be solved with a capacitor or a inductor.