Analogue Infrared Reflectance Sensors

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Analogue Infrared Reflectance Sensors

Post by JohnCrow »

Analogue Infrared Reflectance Sensors

While browsing the component websites, I have recently found it hard to resist ordering various strange and unusual sensors, (especially if they are not expensive) to experiment with.
There are some interesting devices on the market today.

These cost £1.99 in the UK

A recent purchase is the Pololu QTR-1A reflectance sensor. This is already mounted on a BOB so it simplifies the way it can be used.

The package contains a small pcb (8mm x 13mm) with the sensor itself, 3x smd components.
Also included is a 3pin SIL header which has to be soldered to the sensor board to allow the signals to be connected.
(It can also be bought as a strip of 8 sensors, which can be broken down to a strips of 6 sensors and 2 sensors respectively.

The data sheet can be downloaded from here

http://www.pololu.com/docs/pdf/0J13/QTR ... n_note.pdf

Reading L-R with the connections at the top
1 = Gnd
2 = 5V
3 = Signal Out.

Signal out is connected to ADC5 on the PIC

The device can be used to sense the difference between a white and a black surface held close to the sensor.

White Surface:

This has a strong reflectance. The output will tend towards 0V
Or 0 if reading as byte or integer

Black Surface:

This has a weak reflectance. The output will tend towards 5V
Or 255 / 1023 if reading as byte or integer.

Equipment:
EB006 Programmer with 16F877A

Port E = EB017 Patch Board
Port B = EB005 LCD Display

Jumper wires to suite patch board


Software:

This simple program is just to show the operation of the device.
It would be very easy to use this as the basis of a white line follower.
The difference between the two levels is very large so would be easy to detect.


I simply setup the LCD as normal.
Then the program drops into an endless loop.

Read the ADC input on ADC5
If less than or equal to a certain value , then colour = White

If greater than or equal to a certain value then colour = Black

If between these values then colour = Gray.

I did wonder if it would give different values for different colours and thus be used as a colour detector, however this does not seem to be the case with this sensor.

But, the device works exactly as it says in the data sheet and gives a strong indication with black or white.
Circuit.png
(17.43 KiB) Downloaded 1810 times
System.JPG
System.JPG (130.96 KiB) Viewed 3274 times
Sensor.JPG
Sensor.JPG (52.31 KiB) Viewed 3274 times
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Analogue Infrared Reflectance Sensors

Post by JohnCrow »

This is the flowcode file
ADC Sensor V2-byte.fcf
(13.41 KiB) Downloaded 279 times
1 in 10 people understand binary, the other one doesn't !

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Analogue Infrared Reflectance Sensors

Post by Enamul »

Nice work John. :)
I'll order one today.
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Analogue Infrared Reflectance Sensors

Post by medelec35 »

one application is a line follower for a robot?

Nice one John.

Thanks
Martin

Post Reply