► Games

► Sound & Music

► Watches & Clocks


► Power Supplies

► Computers

► Graphics

► Thermometers

► Wearables

► Test Equipment

► Tutorials

► Libraries

► PCB-Based Projects

By processor

AVR ATtiny

► ATtiny10

► ATtiny2313

► ATtiny84

► ATtiny841

► ATtiny85

► ATtiny861

► ATtiny88

AVR ATmega

► ATmega328

► ATmega1284

AVR 0-series and 1-series

► ATmega4809

► ATtiny1604

► ATtiny1614

► ATtiny3216

► ATtiny3227

► ATtiny402

► ATtiny404

► ATtiny414

► ATtiny814

AVR DA/DB-series

► AVR128DA28

► AVR128DA32

► AVR128DA48

► AVR128DB28



► RP2040

► RA4M1

About me

  • About me
  • Twitter
  • Mastodon


RSS feed

IR Remote Control Switch

6th June 2015

This article describes a infrared-controlled AC power switch I built, based on a widely-available solid-state relay board. It allows you to turn on and off up to four lights or other appliances using a remote control:


Controlling a light with the Infrared Remote Control Switch.

It works with the Adafruit remote control [1] (available from Proto-PIC in the UK [2]), using buttons 1 to 4 on the remote:


Solid-state relay boards

There are a variety of AC power switching boards available on eBay or Aliexpress, using either relays or opto-isolated solid-state switches for the power switching. The boards are available in a range of different sizes, with from 1 to 8 channels. I decided to go for a 4-channel solid-state board, for greater reliability and lower power consumption, and found two alternatives on eBay:


The SunFounder (left) and SainSmart (right) solid-state relay boards.

They both use the same Omron solid-state switches, type 1565E, rated at 240VAC, 2A. The load voltage is specified at 75 to 265VAC, 50/60Hz, and the load current is 0.1A to 2A.

As you can see from my photograph they are both quite sloppily assembled, but they are fairly inexpensive; under $20 or £13.


The SunFounder solid state relay board is the slightly smaller of the two, and has the advantage of offering both screw terminals and header pins for the low-voltage signals.


The SainSmart board is slightly larger, and only provides screw terminals for the low-voltage signals.

Both boards draw a maximum of about 32mA at 5V DC, and each input switches on at about 1.55V with a current of less than 0.5mA, so you can drive them directly from the output of an AVR.

WARNING: On both boards there is live AC power on some of the tracks to the solid-state switches on the bottom of the board, so take care when testing with AC power.

I decided to base my project on the SunFounder board, because of its smaller size and the convenience of the header-pin connections.


The circuit consists of just an ATtiny85 and the TSOP38238 infrared receiver module, available from Sparkfun [3], or from HobbyTronics in the UK [4]:


Circuit of the Infrared Remote Control Switch.

I built it on a small piece of veroboard, designed to plug onto the header pins provided on the solid-state relay board. I mounted the infra-red receiver module on the bottom of the board so it would stand up above the board, for best infrared reception:


The infrared control circuit built on a small piece of veroboard.

Here's a diagram showing the layout on veroboard, with the tracks you need to cut, viewed from the component side of the board:


The program

The program is a modified version of my IR Remote Control Receiver project. I compiled the program using the Arduino-Tiny core extension to the Arduino IDE [5]. Select the ATtiny85 @ 1 MHz (internal oscillator; BOD disabled) option on the Board submenu; this is the default configuration of the ATtiny85 fuses. I uploaded the program by inserting the ATtiny85 into the socket on Sparkfun's Tiny AVR Programmer [6].

Here's the whole IR Remote Control Switch program: IR Remote Control Switch Program.

  1. ^ Mini Remote Control on Adafruit.
  2. ^ Mini Remote Control on Proto-PIC.
  3. ^ IR Receiver Diode - TSOP38238 on SparkFun.
  4. ^ Infra Red Receiver Module on HobbyTronics.
  5. ^ Arduino-Tiny core on Google Code.
  6. ^ Tiny AVR Programmer on Sparkfun.

blog comments powered by Disqus