Switching a Light Bulb with an Arduino

I had wanted to try this out since long. The most basic way was to use a simple relay. When the coil is energised, it pulls the contact towards itself, and establishes a connection so that the bulb can turn on. But it is noisy.

Then I heard of Solid State Relays (SSRs). These are functionally the same but have no moving parts. Internally they consist of a TRIAC and an Opto-isolator.

A TRIAC is basically the main switch, and the isolator is to keep the Arduino circuitry safe from the high supply voltage.

Caution: High voltages are dangerous. This post just describes what I did. This is by no means a guide. If you decide to do something similar, please accept that you are doing so at your own risk. Read up well and take care.

The first step is understanding these parts. Pulling up their data sheets, a TRIAC is like this:

Image for post
Image for post

It has two terminals where the mains supply is connected and a gate which controls it.

Image for post
Image for post

For the opto-isolator, at the input is a simple LED. If this is on, then the output is switched.

Image for post
Image for post

The combination of the two parts. Hence the Arduino is completely isolated from the mains supply.

Image for post
Image for post

The basics. A bulb socket, mains socket and safety tape.

Image for post
Image for post

The bulb I wish to take control of. It’s very bright, hence I left it inside the covering.

Image for post
Image for post

The circuit above, put together on a general use board.

Image for post
Image for post

Again, take extreme care and cover all high voltage areas with safety tape.

Now its just a matter of turning on the LED inside the opto-isolator using any device like an Arduino. Fairly simple. While the Arduino thinks it is controlling an LED, it is actually controlling a huge 60W bulb!

Originally published at paramaggarwal.com.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store