Posts: 1
Joined: Wed Oct 31, 2018 6:14 pm

Trouble with Sparkfun QRE1113 line sensor

Wed Oct 31, 2018 6:25 pm

Hi all!

I bought a batch of QRE1113 (digital) IR sensors for my line following robot.

I connected the VCC to a 3.3v pin, GND to a GND pin on the Pi, and the OUT to a GPIO2. I deduced that the unit has all the resistors it needed built in so plugged these things in directly.

The below is my test code:

Code: Select all

import RPi.GPIO as IO
sensor = 2
IO.setmode (IO.BCM)

while (True):
    print IO.input(sensor)
The problem is that the IR sensor doesn't seem to be doing much of anything. The only input this code prints is "1" Plugging or unplugging the sensor doesn't seem to change that. This also applies to other GPIO pins. Some pins always print out 1s, and some pins always print 0s.

Can anyone point me towards the right direction? Am I using pins I shouldn't be using? Am I suppose to have resistors where I don't? Is my code erroneous?

Thanks, everyone!

Return to “Automation, sensing and robotics”