In my project arduino reads the signal form 2 photoresistors and prints it to the serial port. The problem is that the resuts aren't very steady; for both the value that's read changes of about 10% and so my project gets very unstable. The circuit is the same as the examples on the arduino book, so common 5V and a resistor to the ground; The value is read by analogIn 0 and 1.
Following Suggestions on other treads I tried to add some delay between the readings, to do an average of about 10 readings but it has been useless as of now
The light levels may be unstable, the reference (supply) voltage may be unstable, or exposed wiring could be picking up AC hum from the surroundings.
Post a picture and hand-drawn schematic (not Fritzing) of your setup, an example listing of the output and perhaps we can help.
I will take the photos later, as the circuit is mounted on a solar panel.... But measured with a multimeter the values didn't seem shaky... I also tried to put a photoresistor directly from the 5V to the A0 input( setting the A0 output as HIGH to serve as a resistence) and the result is still the same
If you have long wires from the Arduino to the photoresistor, then it is very likely that the wires are picking up AC "hum". In that case, you would use twisted pair, or better, twisted pair with a shield grounded at the Arduino.
But it happens even with the photoresistor plugged in the arduino female pins... in this case no wires at all!
What is the other resistor in the voltage divider? Post a circuit diagram!
Forget about the internal arduino resistor I talked about in the last comment;
Here there are the pictures of the circuit,I hope they are good enough, tell me If they are not what you need.
The exposed wires are usually taped, I exposed them to make the circuit less confusing.
What is the resistance across one of those LDRs when in:
A) Full sunlight.
B) Shade.
C) Dark.
Also please provide the rating/ohms of those 2 divider resistors.
I'm sorry I'm not very familiar with electronics terms in english and google isn't helping, could you use less tecnical expressions?
Actually, seems like the problem only exists when testing indoors; I tested it today and after adjustments the result were steady... That's strange as I use a common lamp as light source.
The new problem that came up is that the maximum value the arduino gets is 200(don't ask me what), while connecting directly the 5v in the digital pin gives 1024 as a maximum; I would like to make my project very precise so I would need a whole scale.
Is it a problem with the photoresistor or with the resistor I put with the sensor?
ondsinet:
very precise so I would need a whole scale.
Well...let me save you the hassle now.
TSL2561
well... could tweaking the pulldown resistor help?
AH!
"If you're planning to have the sensor in a bright area and use a 10KΩ pulldown, it will quickly saturate. That means that it will hit the 'ceiling' of 5V and not be able to differentiate between kinda bright and really bright. In that case, you should replace the 10KΩ pulldown with a 1KΩ pulldown. In that case, it will not be able to detect dark level differences as well but it will be able to detect bright light differences better. This is a tradeoff that you will have to decide upon!"