Go Down

Topic: IR Phototransistor constantly outputs high vaule (Read 1 time) previous topic - next topic


May 26, 2011, 10:41 pm Last Edit: May 26, 2011, 10:43 pm by biocow Reason: 1
Don't have my sketch in front of me so I know this is breaking the rules, but I've already narrowed it down to a hardware problem.

I have an IR LED set up and verified it is lighting up using a camera.

Then I have an IR Phototransistor going into analog zero.

Sudo code sets analog 0 to input, reads the value and prints it to serial but it's always at 1023 even if the LED is on or off. Even if I cover the sensor with my finger or a dark cloth it still reads 1023. Even if I unplug the IR LED and cover the sensor. Still reads 1023.

I know the code is good because I put a pot in place of the sensor and the value changed as I turned the pot.

I've also tried changing the resistor value. Everything from 150ohms to 100K. It just always reads 1023.

Here are the 2 parts...

IR Sensor

Thanks in advance.


P.S. Yes, i'm making sure I have the collector to 5v and emitter to analog 0.


I would connect resistor to ground and the junction between resistor and diode to the Arduino input pin!
there are only 10 types of people
them that understands binary
and them that doesn't


Like this? With no resistor before the input pin is there a possibility of overloading the arduino pin?


That's definitely more correct. You cannot "overload" the input pin unless you apply excessive voltage. If you are concerned, you can add a 1k (or so) series resistor in series with your yellow wire (right before it reaches A0).

The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected


Great. Thanks to you both. I'll try this setup tonight.

Go Up