Pages: [1]   Go Down
Author Topic: IR Phototransistor constantly outputs high vaule  (Read 774 times)
0 Members and 1 Guest are viewing this topic.
Silly-con Valley, Ca, U.S.
Offline Offline
Sr. Member
****
Karma: 17
Posts: 420
Lernin' to tinker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 LED
IR Sensor

Thanks in advance.


* IR sensor_bb.jpg (53.7 KB, 1018x848 - viewed 24 times.)
« Last Edit: May 26, 2011, 03:43:41 pm by biocow » Logged

10 PRINT CHR$(7)
20 GOTO 10

Silly-con Valley, Ca, U.S.
Offline Offline
Sr. Member
****
Karma: 17
Posts: 420
Lernin' to tinker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

10 PRINT CHR$(7)
20 GOTO 10

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

er
I would connect resistor to ground and the junction between resistor and diode to the Arduino input pin!
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Silly-con Valley, Ca, U.S.
Offline Offline
Sr. Member
****
Karma: 17
Posts: 420
Lernin' to tinker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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



* IR sensor_bb2.jpg (53.91 KB, 1018x848 - viewed 23 times.)
Logged

10 PRINT CHR$(7)
20 GOTO 10

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Silly-con Valley, Ca, U.S.
Offline Offline
Sr. Member
****
Karma: 17
Posts: 420
Lernin' to tinker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

10 PRINT CHR$(7)
20 GOTO 10

Pages: [1]   Go Up
Jump to: