Let's Make Robots!

Pololu QTR-1RC Reflector Sensor with Digital Output

Hello.

How to use a sensor that doesn't required an analog-to-digital converter (ADC)? Like the Pololu QTR-1RC Reflector Sensor. I am using a picaxe 28x1 (Starter Kit). 

This has been discussed here http://letsmakerobots.com/node/5228 but no solution.

Here is the product information http://www.pololu.com/catalog/product/959

 

Thank you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
patrickmccabe's picture

So what do you want to use it for?

Faris's picture

Simple line following. (Black or White)

Faris's picture

It would be great if someone can post a sample code.

Thanks.

 

patrickmccabe's picture

No you do not have to measure the capacitor charge/ discharge. I have used them on 2 of my robots with arduino. Just use a pullup resistor, or the pullup command in picaxe which is easier, and you should be good and ready to read it as a digital sensor. It will give you 1 on black and 0 on white. No measuring time or anything. 

TeleFox's picture

Just to be clear, if you connect your sensor in this manner you'll only get a digital output, which will change state at a fixed reflectance threshold.
If you use the intended capacitor timing method you'll be able to get an analog reflectance value which can be calibrated in software.

patrickmccabe's picture

I would think that if you wanted an analog value, then you would buy the analog version of the sensor :D, but not necessarily but it would be easier. My guess is he  will be using it just for like line following or something along that line that just uses black and white.

amando96's picture

" then you would buy the analog version of the sensor :D,"  Some micro controllers don't have an ADC...

patrickmccabe's picture

He is using picaxe though with ADC. Maybe instead of us talking to our selves we should ask him what he wants to do with it. Sure you could measure the time it takes to charge and discharge but its not required if you are doing something simple. It is a reflectance sensor but many people just use it as a line sensor. 

TeleFox's picture

Last time I built a line follower (probably about 4 years ago now...) we had a command on the robot to 'teach' it what level white and black were, so you could calibrate the bot for different surfaces and lighting conditions. Either the voltage or capacitive timing based sensors can be used for this (they're both analog after all).

The analog voltage output sensor may require less coding (due to the ADC functions being handled in hardware), but it consumes more precious hardware resources and power compared to the timing based sensor.

amando96's picture

 You must measure the capacitor charge/discharge time, not sure how to that on a picaxe, but i'm sure other users will know how to :-)