Wednesday, October 23, 2013

How to use the Parallax QTI line sensor with Arduino

The code for the line sensors can be found at

I spent a lot of time reading up on line sensors and ended up having a lot of trouble finding code for 'line sensors'. I found out that sensors that I have are called QTI Sensors, which stands for Charge Transfer Infrared. I won't go into too much detail about that because I don't really understand what it all means. I got a lot of help using these line sensors from, which explains what the whole QTI thing is a lot better than what I probably could.

After reading more online I found out that you can read from these sensors in two different ways. analogRead or using an RCTime function that is duplicated from the Basic Stamp. It can be used to read the resistive sensors, line the QTI sensor. It reads the charge across the capacitor.

NOTICE: The wiring for these are a bit odd. It's not standard with it being Ground Power Signal (Black, Red, White) on the three wires. It's Ground Signal Power.

On github, I posted two files. One file using the sensor as an analog input, and another file using the RCTime function. I haven't noticed a huge difference in performance when comparing the two outputs, except the code for the analog input is shorter and I personally think it's a bit easier to understand.

But anyways, the parts needed for this are:
QTI Sensor/Line Sensor (Data Sheet for linesensorand this is the actual product)

If you go to my github you can download all the code you need to use these. Look under the QTISensor repository.

Here's some pictures of just the wiring and whatever else.
 The 'face' of the line sensor

 the back of the line sensor

 How it's wired. The yellow wire is going to pin 5, and the purple wire is used as an LED indicator.