QTI sensor help - for an analogue value
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.
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
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.
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.
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.
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.