QTR-1RC Reflectance Sensor

Woka

New Member
Hi,

I am relatively new to picaxe and am having trouble getting any reading out of the Pololu QTR-1RC digital sensor. I get nothing through the I/O pins. I have had no problems with getting a reading out of the equivelent anaolog sensor (QTR-1RA) through the analog pins.

If anyone has used this sensor or the array of 8, I would greatly appreciate some help.

I am using a 28X1 project board.

Woka:confused:
 

westaust55

Moderator
Welcome to the PICAXE forum

Can you please post a website link to the sensor in question. That saves others having to search for what you already have at hand.

Can you also post:
1. your schematic/circuit diagram showing how you have it conencted,
2 your program code as developed so far
3. any readily available clear photos showing the wiring so we can trace through in case you have an error in the circuit.
 

Woka

New Member
The web site for the sensor I am testing is http://www.pololu.com/catalog/product/959

There is also an 8 array of the same sensor http://www.pololu.com/catalog/product/961

I have attached a picture of the pin connection and sensor

This is a very basic code, all that I am trying to do at this stage is just get a reading.
Code:
main:
label_15:
		if pin1 = 0 then label_6	'Decision command
		low 5
		high 4
		low 6
		low 7
		goto label_15

label_6:
		low 4
		low 5
		low 7
		high 6
		goto label_15
I read in the Pololu forum that you should read() the input so I tried:
Code:
main:
label_11:	read 1,varA
		if varA = 0 then label_6	'Compare command
		low 5
		high 4
		low 6
		low 7
		goto label_11

label_6:
		low 4
		low 5
		low 7
		high 6
		goto label_11
Sorry but I don't have any curcuit diagrams at this stage as I am testing it on a 28x1 project board.

Woka
 

Attachments

Dippy

Moderator
Sorry, I can't make anything out from that image.

Why didn't you draw your circuit connection with a pen and paper and take a photo of that?

1. As it is a copy of a Parallax product why not search their site/forum?

2. It looks like you could connect it in 2 ways.
a) Bias the output with , say, a 10K res across the cap. to 5V.
A decent reflection will drag the output down towards ground/0V
No (or not much) reflection means out stays at 5-ish volts.
or,
b) Use a PICAXE I/O pin. Set pin to Output , set pin High , pause to charge, set pin to Input, read pin status in a loop until it measures as Input=low=0.
The amount of time it takes to get to zero/low reflects (haha) the strength of the reflected IR.
i.e. Charge the cap, set i/o pin to input, when voltage drops below PIC input threshold then it'll be 'low'. Do this with a timer or loop counter. The time or count will vary with power of reflection.
All pretty crude short range stuff.

This is how the ADC-less Stamps measure R (and C) values - and I would assume why this circuit was designed for Stamp.
For more details on coding, get the Stamp HELP (or manual) and search on RCTime function for a good description.
 
Last edited:

BeanieBots

Moderator
It's not an easy (or very suitable) sensor for a PICAXE to read.
You need to pull the I/O line high. Then make it an input and read the discharge. (noting the time taken for discharge). Your code doesn't indicate what is connected to what so it's impossible to comment on it except you seem to be making lines high AND low which is not how to read this type of sensor. Have a good read of the method described in the link you posted.

EDIT:
As Dippy describes, it has been designed to work with STAMPs that do not have the ADC function of PICAXE. His description of using a pull-up and ADC would be my approach.
 
Last edited:

Woka

New Member
Thanks for all our help and advice.

It all seems too difficult for what I am trying to do.

I was looking for a digital line following array as my analog pins are used with other inputs.

If anyone knows of any I would appreciate the help otherwise I will have to make them.

Woka
 
Top