Tachometer based on OPB606A Reflective Object Sensor
tomcrawford
Posts: 1,129
in BASIC Stamp
So I have one of those thermoelectric fans for our wood stove and have wondered how fast it goes (I already knew it really doesn't move much air).
I used a OPB606A Reflective Object Sensor to detect a fan blade moving past a given point. Here is a link to the data sheet. It consists of an infrared LED and a phototransistor mounted together in an opaque housing. When it "sees" something reflective, the transistor turns on and drives the corresponding pin near ground. I had to use a Schmitt trigger (74LS14) to get good rise times (when the transistor turns off) because I had a fairly long RC time constant. Long wires with the signal adjacent to ground and a 20K pullup.
I implemented an circular buffer of 15 samples of 4 seconds each. Every four seconds, I compute the total of the samples, round it, and divide by two (two-bladed fan). This gives me the total of revolutions for the preceding 60 seconds (RPM).
I display the current RPM and maximum RPM on an 8-digit MAX7219 stick.
I used a OPB606A Reflective Object Sensor to detect a fan blade moving past a given point. Here is a link to the data sheet. It consists of an infrared LED and a phototransistor mounted together in an opaque housing. When it "sees" something reflective, the transistor turns on and drives the corresponding pin near ground. I had to use a Schmitt trigger (74LS14) to get good rise times (when the transistor turns off) because I had a fairly long RC time constant. Long wires with the signal adjacent to ground and a 20K pullup.
I implemented an circular buffer of 15 samples of 4 seconds each. Every four seconds, I compute the total of the samples, round it, and divide by two (two-bladed fan). This gives me the total of revolutions for the preceding 60 seconds (RPM).
I display the current RPM and maximum RPM on an 8-digit MAX7219 stick.
Comments
I'm sure you already know this, and it's probably not a factor with your setup at the speeds you're running. But for those who don't: although a Schmitt trigger yields good rise and fall times, it does not improve the response time of the phototransistor feeding its input. To improve the response time you can use a simple common-base transistor circuit.
The following circuit diagrams illustrate:
Circuit A is a typical common-collector opto hookup. Its response time suffers due to the phototransistor's Miller capacitance. To overcome the Miller effect, a PNP transistor can be added in a common-base configuration, as shown in Circuit B.
To test these circuits, I hooked up a transistor-output optocoupler, whose LED was driven by a Prop pin through a 1K resistor. Here's an actual output recorded on my 'scope from Circuit A. The yellow trace is the output from the Prop; the magenta trace, the output from the phototransistor:
Here's the output from Circuit B using the same stimulus:
As you can see, the output transitions from Circuit A barely register, due to the photransistor's slow response. By contrast, the output from Circuit B tracks the input much better.
-Phil