I want to use LDR to control a light bulb (12W) which runs on AC supply using Arduino.
Is it possible to do this?
If yes, how?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Sign up to join this communityI want to use LDR to control a light bulb (12W) which runs on AC supply using Arduino.
Is it possible to do this?
If yes, how?
Try the PowerSwitch Tail II.
This is suitable if you are living in the USA (120VAC power). You will find 240VAC versions as a kit on that web page as well.
The quick and dirty answer is that you need something that will safely handle the mains voltage that you can control with the Arduino (which is running at 5 (or 3.3) volts). There are two issues you need to consider:
Safety – keeping the mains voltage separate from the Arduino and the other low voltage components so that nobody gets hurt.
Capability of components – avoiding damage to the Arduino and related components due to the mains voltage.
A common way of achieving the second goal is with either a relay or a solid-state component like a triac.
The first goal is often accomplished by using an optocoupler – a device that isolates the low-voltage circuitry from the higher mains voltage by means of an LED and a photo transistor in a common housing.
The circuitry around the relay and optocoupler aren't all that complicated but it isn't trivial either. You might look on e-bay – a search for "arduino relay" will find you lots of modules that will do the job for you.
You can use a relay shield like these: Relay Boards - eBay
Be sure to check the amp draw of the relays. Sometimes you need a transistor, but I don't think you should for these shields. Just be careful working with mains voltage.
If you want to switch it on/off, there is a simple solution using a relay and an optocupler (safer option) or transistor. Here is a schematic:
but if you want to control intensity of light, then you have to use triac control, which you have explained here: AC Phase Control.