QTI sensor (Ir) part #28108 - changing to digital
John Kauffman
Posts: 653
I am working with the QTI Line Follower AppKit (part 28108) but using it off the Boe-Bot as a simple detector of an object present / not at a fixed distance. I need to know how often the object appears / disappears per minute. The changes are now about 4 times per second and after testing will go up to ~40 Hz.
I think COUNT is the right command, but requires a digital signal (1-0-1) on the input pin. There is a circuit and text on page 2 of the instructions that indicate the output can be changed from analog to digital by adding a 10k resistor across the red and white legs.
* No resistor (analog):
When I use the simple program from the instructions I get beautiful analog results flipping between 250 with object to 2,5000 with no object.
DO
HIGH 3
RCTIME 3,1,timenow
DEBUG DEC4 timenow,CR
PAUSE 100
LOOP
* With Resistor (shold be digital)
When I add the resistor to the circuit the same code results are all zero, regarldess of object.
An RCTIME circuit doesn't seem right with a digital input, so I wrote the code below. But the results are always zero with resistor, always 1 without the resistor. Presence or absence of object has no effect.
PIN3 PIN 3
DO
DEBUG BIN1 PIN3,CR
PAUSE 100
LOOP
To test again, I pull the resistor out and switch to the RCTIME circuit and results go back to the nice analog values of 250 / 2,500.
Any suggestions for getting the QTI to behave as a digital device?
I think COUNT is the right command, but requires a digital signal (1-0-1) on the input pin. There is a circuit and text on page 2 of the instructions that indicate the output can be changed from analog to digital by adding a 10k resistor across the red and white legs.
* No resistor (analog):
When I use the simple program from the instructions I get beautiful analog results flipping between 250 with object to 2,5000 with no object.
DO
HIGH 3
RCTIME 3,1,timenow
DEBUG DEC4 timenow,CR
PAUSE 100
LOOP
* With Resistor (shold be digital)
When I add the resistor to the circuit the same code results are all zero, regarldess of object.
An RCTIME circuit doesn't seem right with a digital input, so I wrote the code below. But the results are always zero with resistor, always 1 without the resistor. Presence or absence of object has no effect.
PIN3 PIN 3
DO
DEBUG BIN1 PIN3,CR
PAUSE 100
LOOP
To test again, I pull the resistor out and switch to the RCTIME circuit and results go back to the nice analog values of 250 / 2,500.
Any suggestions for getting the QTI to behave as a digital device?
Comments
Look at the sample program in the documentation. You'll notice that you have to charge the capacitor first to Vdd by setting the I/O pin to output high before changing it to input mode to sample its state. The program uses PAUSE 0 to create a short delay.
I see there is a ver 2.0 on the website with a completely different approach to the digital.
I'll give that a try.