Hello, I have a QRB 1114 and have done a little experimenting with electrical tape on my wheels. I "thought" that I had this working before in a different setup, but maybe it was not working "correctly" before.
What should happen is every change from white to black on the wheel should generate a pulse which will be counted by the microcontroller. It does get counted, however, a lot of other crap gets counted too.
Some details : 1. Arduino D. 2. Black tape & white glossy tape which is enough to make a "change of signal" 3. QRB114 & a couple of resistors
I went for the simplest setup I could think of which is like this :
The sad part is - going over the boundary of white/black I get several "clicks", between 4 & 10. I suspect that the signal from the encoder is a little too raw, and as it goes through the state change on the micro-controller (0/1), a small amount of noise is changing the value of the uC several times.
Anyone have a similar issue? CTC mentioned a pull up resistor (I assume on the signal line), I also was thinking of using a LM324 to "Digitize" the analog signal into a cleaner version for the uC. like this (oh my god CTC is everywere!)
As usual, we’re trying to clean up a signal in the electronical domain. But let’s not forget we are dealing with an optical failure here. Signals should be cleaned up at the very source (where ever possible).
The underlying problem is (apparantly) that the photo transistor sees black and white at the same time. And it averages them out to a grey value. It would not do that if the “lens” were properly focussed on the surface. It would only “see” a very tiny spot of the surface.
I am not sure if this sensor has a lens to speak of, but the datasheet seems to suggest an optimal distance between sensor and surface. The most reflected light is sensed at distances between .120 and .150 inch.
Also worth trying: tuning the amount of light emitted by the LED. More need not be better, depending on the environment. The aim is to sense the white surface as the brightest reading possible, while reading the black surfaces as dark as possible. It’s all about exaggerating the contrast (as opposed to regular phhotography).
Clean up the source is a very worthy axiom. I have carefully positioned the sensor at .14 inches, in addition to moving it and taking readings at various distances since the manual is not always correct. .14 seems optimal for my device.
Materials I have done some experimentation with materials for the encoder. Here are some results:
Value in Volts
white electrical tape
black electrical tape
photo paper white
photo paper black
regular paper white
regular paper black
black wheel plastic
Wow, don’t use photo paper for encoders, the black reflects IR almost as well as the white ! The best combo at this point looks to be the black plastic of the wheel and white electrical tape.
Focal Region Another thing to consider would be the angle and direction of the boundary movement relative to the sensor. I could imagine the focal region not being symmetrical, which would lead to more “grey area” if the b/w boundary moves across in one direction versus another.
Ambient Light Ambient IR would be a source of noise too. I will look into creating some form of shielding.
Right now I can’t get a voltage lower than 2.3 on the white. Turns out this is the magic Grey zone - I have not found what the digital inputs of the Arduino expect, my assumption is that they are TTL like.
So I have parked the wheel on the white and can see the increment value RACING skyward ! (200,000 false clicks already!)
I have attempted to make my sensor work better by having higher contrast. White electrical tape was used, I sanded the plastic in the hopes of using dispersion in addition to absorption. I've tried to align and position the sensor, but at this point can not get more than ~2.4 V difference.
I'm thinking at this point I should try to pull down the voltage so LOW is not in the threshold range.
Oh, and I found this in a datasheet - "The area of optimum response approximates a circle .200" in diameter" - so that throws out the direction of boundary movement influence.
I wanted to recommend the Hamamatsu sensor, but it seems that both places I knew where to get it don’t have it anymore. Here is the link of the best place to look for it, perhaps they’ll get it back in stock:
I’ll be trying a similar encoder for one of my bots soon, so thanks for posting. I hope to learn from your troubles. ; j
I did have one idea. Since the size of the sensor response is approximately a 0.2 inch circle, try to place it so that it is at the widest part of the encoder stripes. See the picture below.
If your sensor is placed where it can overlap 2-3 stripes at a time (closer to the center of the circle), you may get confusing results. On the other hand, place the sensor where the width of the stripes are large compared to the sensor's optimal detection area, and it will spend more time one a single color.
I don’t think that is my issue as you can see the wheel & tape measure for scale. One thing that I have noticed is, your surface should be as close to a 90 degree plane as possible, or you will be loosing the ir reflection. My wheels taper slightly towards the edge, so I had to accommodate by positioning the sensor.
Also (news flash !) - after tearing apart my resistors which were inside heat shrink tube, i found they are 15K & 550 Ohm !
All the circuit designs I have seen so far have IR diode with a resistor @ 220 - not having 220 I’m going to try 150.
Uhmm... wow - that made a improvement. Now with black plastic I get 4.1 Volts which would be expected as more light is being reflected. With white tape I get a whopping 0.18 Volts !!! Just, tested it on the measuring thingy, so not sure of the noise or slope, but the end values are much more within the desirable TTL ranges ! (good news)