Shop OBEX P1 Docs P2 Docs Learn Events
QTI sensor (Ir) part #28108 - changing to digital — Parallax Forums

QTI sensor (Ir) part #28108 - changing to digital

John KauffmanJohn Kauffman Posts: 653
edited 2011-03-29 19:58 in Accessories
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?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-29 11:23
    The documentation for the QTI module is very clear on how to use it as a digital sensor. You connect W to Vdd, B to Vss, and R to an I/O pin. The I/O pin will be high over a black line and low over a white area as stated. I'm not sure why you're talking about a resistor. The QTI module has a series resistor in the R lead already.

    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.
  • John KauffmanJohn Kauffman Posts: 653
    edited 2011-03-29 13:50
    We are looking at two different docs. Mine, printed, came with the kit. It has the solution I described above.
    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.
  • John KauffmanJohn Kauffman Posts: 653
    edited 2011-03-29 19:58
    Version 2.0 of the docs works fine. It explains a technique without a resistor, relying on detecting the ring of the sensor. I've DIY an encoder for the Boe-Bot since the P'lax item is out of stock.
Sign In or Register to comment.