I'm trying to make a homemade IR sensor using some IR LEDs and a photodiode, first I tested the whole circuit using a multimeter, when no light is bouncing from the LEDs I get a 0.6V output from the photodiode, and when I make the light rebound close to the photodiode I get a 4.8V output from it. I want to hook this up to my Arduino in order to take note of the different values I get so I can make a proximity sensor and eventually have it show me in an LCD how far an object that passes by is.
My problem is this, I connected the photodiode output to Analog input 0 in the Arduino, I set up serial communication with my computer and then do an analogRead of that input pin 0; my problem is that when I open up the serial monitor, it always shows 1023 as the output, however, the output value is nowhere near 5 volts, it's actually the 0.6 volts I get from not bouncing any IR light on the photodiode, any ideas on how to troubleshoot this?
Thanks for the input, I measured the voltage I was getting on the analogue pin itself and it is working like it should, it varies how and when it should, but I still get the constant value of "1023" on the serial monitor.
I also tried making the input ground, and got a constant "0" and then made the input 5 volts and got constant "1023" as well, looking around I found that this was a basic troubleshooting procedure and it looks like in this aspect it's working fine.
As far as joining my grounds I'm only using the 5 volt output and ground from the Arduino so everything's got really only just one ground connection.
That tends to suggest that the software is wrong. Can you post it.
It could be also that there is a lot of pickup on the signal that the voltmeter is not seeing.
A good photograph of your setup might help us spot something.
Ok, in the following link is an album with the various pictures I took, as well as some pictures of the multimeter readings; I also included a picture of the basic schematic: http://imgur.com/a/3gr5R
My code is very basic, I just did it to see if there were any problems with the readings (which there are :P):
I also tried making the input ground, and got a constant "0" and then made the input 5 volts and got constant "1023" as well,
That suggests your arduino system is working.
I measured the voltage I was getting on the analogue pin itself and it is working like it should, it varies how and when it should, but I still get the constant value of "1023" on the serial monitor.
That suggests your arduino system is not working.
It is logically inconsistent to have the two statements above true at the same time. Therefore one of these statements must be false.
There may be some loose connection or other inadvertent change in wiring between the two tests.
Thanks for posting the code and the photos, unfortunately I can't spot any errors.
I am at a bit of a loss as to what to suggest next, only repeat those tests looking at the output on the serial monitor.
When I say on the analogue pin, you do know I mean pin 23 of the 328 chip?
Ok, I retried measuring the voltage across the analogue pin while looking at the serial monitor, and as long as I'm measuring the voltage across it, the readings in the serial monitor are correct, but as soon as I remove the multimeter probe from it, it goes back up to 1023.
Well looks like I finally found a fix for my problem, a simple voltage divider was the answer to all my problems, a simple 100k ohm resistor between ground and the A0 sensing lead.
Thank you so much for your help, if it weren't for your suggestions I would've never realized how simple the solution was!