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?

  • 4
    Yes, with a relay. Ask google, it knows how.
    – Majenko
    Dec 3, 2015 at 13:19

4 Answers 4


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:

  1. Safety – keeping the mains voltage separate from the Arduino and the other low voltage components so that nobody gets hurt.

  2. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.