Photointerupter encoder help!
mhamen3
Posts: 69
Hey guys, so I'm trying to make an incremental, single disc, single photointerupter encoder to measure rpm. I've put a photointerupter and a buffer on a bread board and was able to get a +3.3v and 0v output. However, when I hook the circuit up to the actual photointerupter that is mounted to my bot I have problems. I can't seem to get the circuit to switch from high to low consistantly. I should note that the photointerupter is mounted remotely from my circuit through about 18 inches of small gauge wire. Attached is a crude drawing of my circuit, each line with a blue dot on it is a length of 18 inch small gauge wire.
Any help is much appreciated
.
Any help is much appreciated
.
Comments
-Phil
Measurement actually shows about 1.5V going into the LED.
BTW: An LED is a current device, you need a minimum voltage but it is the current that needs to be controlled. Never connect a diode or LED directly to a voltage without current limit or else it will try to draw the maximum current it can to the point of failure. Don't misread the datasheet, understand the device first.
-Phil
You may have already damaged the IR LED... try another and don't push the maximum current with 100% duty cycle, 30ma will do.
Here is a soft+hard solution if you want although I wouldn't bother to do so myself:
If you use a current limit resistor for the input to the Prop then when your software detects a high or a low it can set another output pin to that same state which when coupled through a resistor (say 100K) back into the sense input will push that input past the sense threshold achieving the desired hysteresis and delivering the equivalent functionality of and external schmitt trigger. A counter can also be set up to do this automatically.
Anyway, Schmitt triggers also come in single-gate packages such as SOT-23 packs etc.
Here's a app note for doing the Schmitt triggering with feedback:
-Phil
I've found that many IR LEDs aren't very efficient so that they need to be driven harder so 30ma max but anywhere from 10ma upwards as Phil mentioned. BTW, the resistor is calculated by subtracting the voltage drop of the IR LED (around 1.2V) from the supply voltage. So 100 ohms delivers around 38ma, not 50ma.
@Phil: thanks for the link, didn't know there was one.
EDIT: skip the schmitt triggers/hysteresis, I have never needed them
What is the anticipated frequency of your output pulses when run from your bot? Have you tried turning the shaft slowly by hand to see if that makes a difference?
-Phil
-Phil
You show a pull-up design, so if it is hard/rare to see a low, that suggests stray light may be a problem, or your disc.is not opaque enough
Try different orientations, and disc offsets
The OPB610 specs say operating at 5mA If, it will give at least 1mA Ic ( ie a CTR of > 20% )
With 10k load and 3v3 supply, you will be ~ 170uA threshold, and 100 ohms drives at ~ 34mA.
I'd drop the drive current to 5mA and check again and increase the drive (and drop the load resistor at the same time) only if you need to overcome external light. (eg you could consider 20mA drive, and 560 - 1k load, if external light is an issue )
JMG, I really appreciate your response. I'll try your tips when I get home tonight. Just for clarity, are you refering the 10kohm resistor in my circuit as the load resistor?
when light reaches the transistor it will connect the trace to GND and you should see a 0 on input pin.
The Prop switch hard at 1/2 Vcc, so try 20k to 100k Ohm pull-up if the 10K is to strong of a pull-up.
I'll prefer a magnetic sensor, with at least two options depending on the mechanics involved.
1) Fix a small rare earth magnet to the shaft and use a hall effect switch (not sensor but a switch like Allegro's A110x family)
2) Use a cam sensor (like Melexis' MLX90217) with the small magnet glued to the sensor and place it near a part of the motor/system that rotates (must be a magnetic metal part). This one is even suited for automotive use.
Alex
Take a look at the datasheet for MLX90217, it's self-adjusting and 15°/tooth doesn't seem a big challenge for that chip, unless the disc is really small.
If you are set to build a disc and you can make it metallic, I'll give it a try. It all depends on your disc's design (to force a +/- 5mT flux variation on the sensor).
Just one more idea, if you can get any metallic protuberance upstream to the driving motor (or place a magnet there, like a small square one on the motor's shaft) and depending on your gear ratio maybe you can just have 1 pulse per motor revolution and it could be enough, only you know.
Alex
The bot is scratch built using resin casting. All molds were produced in my 14 sq ft closet.
my flickr documents the process a little better. Or check out my thread on the lynxmotion forum.
http://www.flickr.com/photos/marcbots/sets/72157631912836115/
http://lynxmotion.net/viewtopic.php?f=8&t=7256