Arduino Project Hub

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.

  • 1,048 views
  • 0 comments
  • 5 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

Fun Cases for Electronic Components

Project in progress by circuito.io team

  • 997 views
  • 3 comments
  • 18 respects

Simple Ultrasonic distance measurer with LCD display

Project tutorial by onatto22

  • 70 views
  • 0 comments
  • 2 respects

Useless box

Project showcase by Igor Putnik and brzi

  • 832 views
  • 0 comments
  • 8 respects

R6Pedals

Project showcase by Team Capitán Penurias

  • 44 views
  • 2 comments
  • 1 respect
Add projectSign up / Login