Shop OBEX P1 Docs P2 Docs Learn Events
QTI sensor help - for an analogue value — Parallax Forums

QTI sensor help - for an analogue value

rusty009rusty009 Posts: 21
edited 2009-01-09 05:07 in General Discussion
Hey, I have been reading around and found this site,
http://rzollinger.wordpress.com/2007/04/26/qti-line-sensor-demo/#comment-704

and on the site it says you can use the QTI to output an analogue value from 0 - 1023. I was wondering what code would be used to do this ? Thanks.

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-01-08 15:17
    rusty009,

    You could use a 12-bit ADC (LTC1298)·in combination with a 100 Ohm external resistor to form a voltage divider with the QTIs internal 220 Ohm resistor and Phototransistor.· The Voltage to the ADC would vary between 5V and 3.66V or cause the ADC to respond with a number ranging from 4095 (5V)·to 2998 (3.66) ... the difference being 1097·...· 4095 - 2998 = 1097·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    1336 x 712 - 80K
    QTI.JPG 79.6K
  • rusty009rusty009 Posts: 21
    edited 2009-01-08 16:14
    Hey, I really dont understand that circuit, could you help me understand it? Thanks,
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-01-08 18:46
    rusty009,

    The ADC used that I have referenced is a 12-Bit ADC that Parallax sells. You can find code examples on how to interface to this ADC from the following link starting on page 7 for the Basic Stamp II.

    http://www.parallax.com/Portals/0/Downloads/docs/prod/appkit/ltc1298.pdf


    Some information about the QTI sensor and a program example to use it solo without the LTC1298 can be found from the following link.

    http://www.parallax.com/Portals/0/Downloads/docs/prod/compshop/qtilinesensorrev1.pdf

    With the circuit that I provided, it is important to see that by making the 'white' wire in the schematic HIGH (+5) that you turn the QTI sensor 'ON'. Likewise, making the 'white' wire LOW (0V) will turn the QTI sensor 'OFF'. With the QTI being 'ON', the reflected light from QTIs output LED will proportionally turn on QTIs photo-transistor. This proportional output can then be interpreted from the ADC and in turn read by the Basic Stamp.


    For further information and code examples about how the QTI sensors work, you can check out the following link.

    http://www.parallax.com/Portals/0/Downloads/docs/prod/sic/AppliedSumo-v1.0.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • rusty009rusty009 Posts: 21
    edited 2009-01-08 22:07
    Ok, Thanks ! I have done some further reading and apparently I can use a function in PBASIC that coverts the signal for me, without an extra IC. I was wondering if the BASIC stamp II had the capability to do this, or do I need an IC ?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-01-08 22:51
    rusty009,

    Yes, that is correct you don't need an external IC, you can use the RCTIME command with the Basic Stamp II. With your original question, a 0-1023 output would be typical of what you would see from an ADC and that is why I showed you that path. The main difference between using RCTIME vs. an external ADC, is that the ADC will provide a slightly more linear response over the entire sensor range, where the RCTIME will be more exponential. This may or may not matter much depending on your particular application.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • rusty009rusty009 Posts: 21
    edited 2009-01-08 23:14
    I am using my QTI senor as a colour sensor, detecting the greyscale in a colour, will it be ok ? Thanks.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-01-09 05:07
    rusty009,

    Without knowing what degree of grayscale and range of grayscale you are measuring this is impossible for me to answer. You may need to do some empirical testing to determine this for yourself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
Sign In or Register to comment.