Serial communication on Arduino?

I tested a QRD1114 reflective sensor using a voltage meter, and was working great. I was getting good responses from the sensor (one of the sensors I was using had a bad LED which was not working, but the sensor worked fine with an external IR LED that I had laying around.) But as soon as I hooked it up to an analog input pin of my arduino board, and used the serial communications to display the reading from the sensor on the serial monitor, every reading would be 1023 (which should be the highest possible reading) even when there wasn't anything near the sensor. I changed the pin, so I know it isn't a defective pin. I repeated the test with a photo cell and got similar results. what could be the problem, and what can I do about it?

17 answers
sort by: active | newest | oldest
Dec 20, 2011. 1:33 AMsteveastrouk says:
Show your circuit diagram, for a start.

Steve
Dec 20, 2011. 1:35 PMsteveastrouk says:
No, This is a DC signal - how would it flow through the capacitor.

Steve
Dec 20, 2011. 11:20 AMsteveastrouk says:
Ah ! A completely wrong circuit......

Do this:

Connect a 4.7K resistor from the phototransistor emitter to ground. Connect the arduino pin to the emitter.


Steve
Dec 20, 2011. 1:34 PMsteveastrouk says:
No.

Your circuit now looks OK, but is the ground of this connected to the ground of the arduino ?

You may have to alter the resistor values to get decent results. Make the 68 Ohm bigger.

Steve
Dec 20, 2011. 2:17 PMsteveastrouk says:
Change the circuit, put the resistor from collector to the 5V line, connect the emitter to ground, connect the arduino to the collector. This configuration has a higher gain than the other circuit, but the output is never less than a volt or so.

Steve
Dec 20, 2011. 5:06 AMfrollard says:
Okay, are you talking to the sensor with SERIAL or are you reading the analog value from the sensor?

http://arduino.cc/en/Tutorial/AnalogInOutSerial

What happens when you use this code?
Dec 20, 2011. 1:16 PMfrollard says:
that tells me the sensor isn't putting out a variable voltage between 0 and 5 volts. Does it have a dc bias? (like outputting between 3-8 volts for max to min readings)

Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!