Project tutorial
IR Remote Controlled Power Switch for Rapsberry Pi 3

IR Remote Controlled Power Switch for Rapsberry Pi 3 © GPL3+

Arduino Nano based relay power switch for Raspberry Pi 3 (Kodi) operated by common TV remote controller.

  • 1 comment
  • 9 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
Hy gluegun
Hot glue gun (generic)

Apps and online services

About this project

My laziness is my power ;-)

I'm using Rapsberry Pi 3 based Kodi mediacenter to watch movies, TV series, pictures and listen music. I like to keep it switched off if it is not in use – it is not a problem to switch it off but to switch it on again I have to physically go to its AC/DC adaptor (5 steps! – a real exercise!), unplug it and plug it again to start my Kodi. I know it should be possible to wake up Rapsberry using Wake on LAN, nevertheless I was never succesfull to configure and use this functionality.

Rapsberry Pi 3 is powered using the standard micro USB connector (5, 5 V), so I decided to build an Arduino Nano based IR controlled power switch. I wanted to use the IR controler I use for operating my TV and Kodi, so I found two buttons (AD and SUBT.) on it I never used and decided to learn Arduino to understand these two command for switching the power for Rapsberry on and off.

I took the inspiration from this project – – and I built based on it a simple IR receiver which copies the IR signals received by IR receiver attached to PIN 11 to serial monitor. This was needed to find out which codes are emited when my two buttons are pressed. I found out that each button is randomly (?) sending two different codes (HEX - DEC):

  • AD E0E0E41B - 3772834843 or 37A03AA2 - 933247650
  • SUBT. E0E0A45B - 3772818523 or A51FEC3E - 2770332734

Not a big deal to react adequately on both of them.

So I extended the original project with relay attached to PIN 12. This relay switches on and off the power for Rapsberry Pi 3. Whole electronics is powered by the same adaptor (it is located before the relay so it is always powered when the adaptor is plugged in.

Laziness won and I do not need to stand up from my sofa to switch of my mediacenter. Next challenge is to build a robot which would bring me cold beer from a fridge ;-)

Finally I added one red LED (PIN 10) which copies the statuses of relay and works as a visual controll. (I think to reverse its logic not to disturb when Kodi is on and I'm watching TV). Whole the used electronic fits in a box from Xiaomi Band I had on my table for ages. (Yes – I definitely need to buy a 3D printer to be able to print nice boxes – I have to explain this to my wife ;-))

How does it work


IR controlled relay switch based on Arduino NanoArduino
Original code is based on this project - - which I extended and tailored.
#include <IRremote.h>

 * Credits -
 * TV Samsung remote codes
 * AD     - E0E0E41B - 3772834843 or 37A03AA2 - 933247650
 * SUBT.  - E0E0A45B - 3772818523 or A51FEC3E - 2770332734

//Relay PIN
#define relePIN 12

//IR sensor PIN
int RECV_PIN = 11;

//Control LED PIN
int LED_PIN = 10;

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
  pinMode(relePIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  irrecv.enableIRIn(); // Start the receiver

void loop()
  if (irrecv.decode(&results))
    Serial.print(results.value, HEX);
    Serial.print(" - ");
    if (results.value == 3772834843 || results.value == 933247650){
      digitalWrite(relePIN, HIGH); // Relay ON
      digitalWrite(LED_PIN, HIGH); // LED ON
    if (results.value == 3772818523 || results.value == 2770332734){
      digitalWrite(relePIN, LOW); // Relay OFF
      digitalWrite(LED_PIN, LOW); // LED OFF
    irrecv.resume(); // Receive the next value


Wiring diagram
Please note relay module was used (not relay shield)
Ir remote relay switch wiring bcsl3fxike


Similar projects you might like

Turn On/Off TV Sound System Using the TV IR Remote Control

Project tutorial by Lugh

  • 1 comment
  • 6 respects

IR Remote Controlled Home Automation

Project tutorial by suhail jr

  • 20 respects

Remote Controlled Pet Feeder

Project tutorial by Amal Mathew

  • 1 comment
  • 40 respects

Remote Lamp

Project tutorial by Kutluhan Aktar

  • 7 respects

Arduino Nano and Visuino: Infrared Remote Controlled Relay

Project tutorial by Boian Mitov

  • 16 respects

Arduino: Switching ON/OFF Appliances Using IR Remote

Project showcase by Naman Chauhan

  • 129 respects
Add projectSign up / Login