ldr sensor reading erratically

Hi all...I'm hoping someone has some suggestions for me. I'm trying to use a LDR sensor on a night light. I have everything working fine on the bench, and after installation, the LDR sensor begins to read very erratically. 1023, down, back up, zero...completely not reading the light in the room. I thought maybe it was the sensor, so I tried a different one, same thing. I thought perhaps the power supply wasn't good enough, so put a 12v supply through a dc-dc buck converter so I could dial the voltage exact. Again, on the bench with a breadboard the LDR works fine, but after installing it into a project box, it began to read erratically. I have the positive 5v to one leg, other leg through resistor to negative. And on the BB I have the divider so the input wire goes from the second leg of the ldr to A0 of the UNO. When I'm installing it in the project box, I simply solder the resistor to the second leg, and have the input wire soldered above the resistor (between the resistor and the ldr sensor). Is this the source of my problems? It's the only thing I can think of...if that is proper, any suggestions? Thanks for any help!

You're in the wrong part of the forum, but apart from that, is this not perhaps a feedback thing from the light that it's switching? Sensor sees dark room, light goes on, now the room is light etc etc...

When in the project box, is the other end of the resistor connected to GND? What is the value of the resistor?

Well, I saw the label on the forum which is "troubleshooting", and I'm hoping for some troubleshooting!! Sorry if this is in the wrong place. It's not feedback, as all of this is happening on the breadboard, before I even put the led's in circuit. I have the sensor serial printing the value's to the laptop. It's just weird that it was working fine, and then started reading erratically. Two sensors, different power supplies....it's killing me trying to figure it out! I'm tempted just to throw the blanket over the edge of the bed during the day! (the led strip is under the bed, with the PIR motion sensor and Arduino. That part of the project works perfectly...all I wanted to do was add the LDR, have the Arduino read the ldr value, and if it was below a threshold, move on to read the PIR. Again, it worked fine (complete) until I moved the LDR into a project box, then erratic begin. Does the wiring of the LDR, resistor, input pin sound ok? It's the only thing left that I can think of....

The resistor in the project now is 3.3K. The resistor is connected to ground. I had a different (lower) value resistor in the circuit previously as well...don't remember the value at the moment...

When you moved the project box, the lighting conditions were probably different and would require a different resistor value to get best light and dark readings.

A suggestion to calibrate ... With the brightest light level expected, use a resistor value that brings the ADC reading to within 500 to 900.

Sorry...I think I confused you! The ldr sensor is in the project box, but still on the bench...the same place it as when it was wired through the breadboard. I haven't installed it where I want because I test it first, and that's when I discovered the erratic behavior. In the same light, it will read everything from 1023 to 0...constantly changing. Even if I put my finger over the sensor, same thing. But it worked fine when wired to the breadboard. So the only difference is the wiring of the sensor to the resistor and the input wire. But I can't see how that has changed. On the BB I had the 5v+ to one leg of ldr, resistor to other leg, which went to ground, and the input pin from the ldr/resistor leg to A0. In the project box, the only difference I see is that there is no breadboard. I just have the input wire soldered to the ldr leg, before the resistor. Perhaps I need to solder it right at the ldr leg/resistor junction, rather than further up the leg?

Maybe your soldered joint is dry?

bigsammy: Well, I saw the label on the forum which is "troubleshooting",

It also says:

For problems with Arduino itself, NOT your project

I think it's for problems to do more with PC not seeing Arduino, or sketch not uploading, new versions of IDE acting different from old versions, that kind of thing.