IR Remote Control and Arduino Control AC Voltage Device © CC BY-NC

Simple instruction to let you know how to control an AC voltage device using an IR remote control and the Arduino.

  • 2,268 views
  • 0 comments
  • 7 respects

Components and supplies

Apps and online services

About this project

Introduction

One of the most interesting ways to control many applications is by using an IR remote control. You can find this medium of control used with TVs, DVRs, air conditioners, and more.

In this tutorial, I would like to show you how to control any AC device and control it using an IR remote control and the Arduino. We will divide this experiment into:

  • Control an AC device as an ON - OFF switch.
  • Control an AC output voltage using a "dimmer" application.

Bill of Materials

But first, let's see what we want. The components we need for this experiment are:

  • Arduino Board (I used the UNO)
  • IR Rx TSOP3848
  • Sugar device (to control the AC device)
  • RJ12 Cable & RJ Breakout
  • AC lamp and Lamp socket
  • LED
  • 510R resistor
  • Breadboard
  • Solderless jumper

Testing

Let's test the IR RX and see what code that your remote sends to Arduino.

The IR receiver sensor has 3 pins: VCC, GND, OUT. Be careful when you connect the IR RX.

Wiring

First we need to build the circuit in like this:

Coding

First upload this library, then upload this (test IR code) and open the serial. Then, once you press the IR remote control, you can detect the code for each button as you see here:

In my case:

  • Power on: 0xFB38C7
  • Increase: 0xFBE01F
  • Decrease: 0xFBE21D

Why 0x in the beginning? Because the code is in hex format.

First application for ON - OFF AC switch:

Second Dimmer application:

For the dimmer application, we will use the Volume Up and Volume Down button to increase and decrease the brightness.

If you like the Sugar device idea and application, why you don't support us on indiegogo and become our backer today. We will offer the dimmer code and many more applications exclusively for our backers.

Schematics

schematic IR
Schematic ir schem ctr78qat9m

Code

IR switch on off codeArduino
/*
 * Copyright 2009 Ken Shirriff
   Modifiy by M. Rawashdeh
   Sugar device Switch ON OFF application
 */

#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int SugarPin=9;
const int LEDpin=8;
boolean Power=false;
void setup()
{
//  Serial.begin(115200);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(SugarPin,OUTPUT);
  pinMode(LEDpin,OUTPUT);  
}

void loop() {
  if (irrecv.decode(&results)) {
//   Serial.println(results.value, HEX);
switch(results.value)   
{
  case 0xFB38C7:
  // power on/OFF
  Power= !Power;
  if(Power)
  {
   analogWrite(SugarPin,64) ;
   digitalWrite(LEDpin,HIGH);
   }
  if(!Power)
  {
   analogWrite(SugarPin,12) ;
   digitalWrite(LEDpin,LOW);
  }
  delay(1500);
  break;
  }
  irrecv.resume(); // Receive the next value  
}
}
Test IR codeArduino
/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 *  http://arcfn.com

 */

#include 

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }

}

Comments

Similar projects you might like

Guess the Number With Arduino KeyPad

Project tutorial by Giovanni Gentile

  • 80 views
  • 2 comments
  • 3 respects

Control a 7 Segment Display with a keypad!

Project tutorial by Isaac100

  • 109 views
  • 2 comments
  • 2 respects

Launch Pad Count Down Sequence Display

Project in progress by Douglas Frey

  • 78 views
  • 0 comments
  • 2 respects

Know the Temp of Your Home From Anywhere with Arduino Cloud!

Project tutorial by Isaac100

  • 2,011 views
  • 2 comments
  • 11 respects

Safe City: A Device to Keep You Safe

Project tutorial by Patel Darshil

  • 1,297 views
  • 0 comments
  • 9 respects

Water Softener

Project tutorial by moty

  • 627 views
  • 0 comments
  • 6 respects
Add projectSign up / Login