Contactless Tachometer on AVR. Part 1. Schematic
This new contactless tachometer - is the device based on an ATMEGA48 AVR micro controller from Atmel, and is able to measure very high RPMs, as well as very low ones. It is based on an IR (Infra Red) opto-couple to detect shaft rotation.
Principle of operation
The heart of this tachometer is an IR sensor, also called opto couple, which is a diode and photo diode in one package. This opto-couple will send IR beam on the shaft to detect it's rotation. For that purpose, a small reflective sticker is added on the shaft, so that each rotation of the shaft will cause a "pulse" of IR light to be reflected. Figure below shows a beam or IR light being sent to a rotating shaft having a reflective sticker on it.
After testing various equivalent products, we decided to you this one for some factors, the most relevant being :
So, to recap, using that opto couple we can count the time taken by the shaft to execute a complete revolution. Then, when you have that time information (let's call it T and let's assume T's using is seconds), the RPM is simply calculated as [60/T].
Getting useful data from the IR Opto-couple
To reduce cost and hardware complexity, and to increase system flexibility, we decided to connect the IR sensor directly to the ATMEGA micro controller, and let it do all the signal processing. This was difficult because the signals coming from the photo-diode are very noisy, and are constantly biased by the ambient light. So the challenge was to build a system that would automatically adapt to ambient light and also adapt to the distance from the shaft being measured.
Figure below shows an example of the analog signals we could read from the senor. All the noise around each high/low transition is
Beside the fact that the signal is noisy, at each transition between ON and OFF (ON being when the shaft rotates and the sensor "sees" the reflective sticker), a huge amount of oscillation occur causing the controller to be totally confused!
We wanted to use the comparator that is integrated in the ATMEGA48, but due to all those factors, it was not possible, we needed to process the analog signals before even trying to count the cycles.
The solution we found was to constantly estimate the average intensity, based on the maximum and minimum intensities retrieved from the sensor, then "create" a hysteresis around that average intensity.
This hysteresis will be used to prevent multiple cycles counts during noisy High/Low transitions.
Here is how it works in more details: when the noisy signal is raising from a low state (no IR reflection) to a high state (IR re flexion), the algorithm will only consider the signal to be high if it crosses the "rising hysteresis" level shown on the graph, and will only consider the signal to be low if crosses the "falling hysteresis" level. This will prevent most possibilities of having errors caused by the noisy signal.
The schematic below how simple it is. Notice that there is no potentiometer for the contrast adjustment. this would take too much place and it is not reliable to always have to adjust it, so instead we designed our own contrast regulation system based on a PWM generator and a low pass filter (R3, R4 and C2).
Notice that there is an additional interface (JP2) to allow the user to hook any additional sensor. JP1 is used for ISP programming of the micro controller. JP1 can also be used to transfer RPM data out of the device.
As you can see in the short video below, the sensor is located at the back, next to a red narrow-beam LED that glows to help you point the invisible IR sensor beam to the target shaft.
News on theme: