QRD1114 on picaxe too slow for wheel encoder

I am trying to use QRD1114 in trying to encode wheel rotation. Even at the slow speed the QRD1114 can’t detect the dark and white strips on the wheel fast enough. My setup is like the one on HVW (>here<) with some changes on the circuit. I have 4.8V rechargeable battery for the V+, and I changed the resistor values to make it detect dark and white. The 10kohm to 420ohm and 330ohm to 220ohm. It sends a high when white is in front and low on black but its too slow. Is everything wrong? Can I make it work with 4.8V rechargeable battery? help please…

Sounds like some circuit

Sounds like some circuit weirdness. The QRD1114, if wired as the HVW circuit, shoud be sending a low when over white, and a high when over black. That is with a 10k resistor on the photodetector, the detector should be conducting and giving a 0.4 volt reading when getting a reflection from the white stripe since the reading is taken between the resistor and the phototransistor. THe 0.4 reading is from the Vce saturation rating in the electrical charecteristics, which would occur when the transistor is “coupled” ie: detecting a reflection from the LED and conducting. While conducting, most of the 4.8 volts would be dropped across the 10k resistor and a low would be seen at the signal point taken between the resistor and phototrans. Note also that the “coupling” is rated with the sensor located 0.05" from the surface, that is just a hair over a millimeter from the reflecting surface.

I’d honestly go back to a 10k on the phototrans and use a 220 or maybe even a 180 ohm on the LED, making sure tha sensor was as close as possible to the surface being measured.

Im really new to electronics

Im really new to electronics but i think i know what your saying. With the HVW circuit as a guide I tried changing the values till it works and stop changing if something works <sounds like newbie? :). So I end up with the setup on my first post which is really wierd.

I will try to change back the 10k on the phototrans and 220/180 ohm for LED. I’ll post what will happen. And also I think the sensor should be 5mm away from the surface it’s detecting.

5 mm is way too far away,
5 mm is way too far away, according to the datasheet from HVW. The Electrical/Optical charecteristics on page 2 state normal readings taken at 0.050" or 50 thousandths of an inch. That is just a bit over 1 mm. On page 3 figure 5 it shows a collector current peak compared to distance at between 20 to 30 mils, or 30 to 40, which converts to be 0.762 mm to 1 mm.

That’s damn close!! so i

That’s damn close!! so i really need to put it less than 1mm. Damn! thats worse than my grandmom reading! I tried it this afternoon and its working with 10k and 220 ohm resistor on 4.8V. But is there a chance that the test if there is a change is done before the servo even finished the ‘pulsout’ command? I also think ‘pulsout 1, 75’ is too wide that the sensor passes 1.5 reflective surface after one ‘pulsout’. Is my assumptions wrong?

 

Am i better off on on/off toy motor than a servo with this sensor?

 

Thanks robologist!

 

I don’t see how the sensor
I don’t see how the sensor could tell the robot if any change happened while either pulsing the servos or going through that pause statement either. I think it could be read if something called interrupts were used, but don’t think that is available on the PICAxe. Using motors instead of servos might help out, as you’ve thought.

Don’t forget to consider
Don’t forget to consider that the Debug command really slows down the program execution…

use sertxd instead
use sertxd instead

Oh! never knew debug slows
Oh! never knew debug slows the program down. Thanks totoroyamada!

I don’t know what sertxd
I don’t know what sertxd does. I might need to read that. thanks captaintuna!

I agree with the debug…
The sensor is fine – the picaxe is too slow! This setup of encoders will not work while using debug. Period. Instead, as a test, have your wheel start and then stop after one revolution of counts. With a little piece of tape at this point, you can be sure it is stopping at the same point, everytime.

easier way to do it…

I really don’t understand the need for the pulses. I would just leave the IR LED on all the time. The code is simply:

Read your input

if it’s black, let bit=0

read your input

if its white and bit=0 then count (if it used to be black and now it’s white, go ahead and count)