Creating an automatic dimming lighting system

Hello, I'm trying to create a series of LED light bulbs (just 3 or 4), that brighten or dim based on the amount of light outside. I'm planning on using a phototransistor, but I am not sure how to go about this. I want to have it so if there's more light, the bulbs dim, but if there is less sunlight, the bulbs brighten. Any help is greatly appreciated!

While the basics of this are trivial getting good results are almost imposable due to the wide dynamic range of the lights and the ambient light and the fact that the two are not linear. Add to that the fact your eyes is not linear and you have an uphill task.

Basically drive the LEDs with PWM trough a suitable driver, like a transistor or FET and then alter that PWM value with the reading you get from a photo resistor connected to the analogue input and a pull up resistor to +5V.

Grumpy_Mike: ... and a pull up resistor to +5V.

... and enable the internal pull up resistor.

PeterH:

Grumpy_Mike: ... and a pull up resistor to +5V.

... and enable the internal pull up resistor.

No the problem with that is that it is a not very stable value, it is not very well defined, and it might not be the right value.

Grumpy_Mike: No the problem with that is that it is a not very stable value, it is not very well defined,

Do you mean it might vary from board to board, or something else?

Grumpy_Mike: and it might not be the right value.

It happened to be a suitable value in my case, and I would suspect that if it's only to be used for daylight sensing then the precise resistance wouldn't be critical as long as it was in the right ballpark. The system will need to be calibrated anyway.

Do you mean it might vary from board to board, or something else?

Yes and Yes. The data sheet shows it to have a range of 20K to 50K so it can change from board to board. The value can also change due to temperature and aging.