Project tutorial
IR Remote for Fan

IR Remote for Fan © GPL3+

Turn on/off your fan without getting up, just by using an IR remote.

  • 20 views
  • 0 comments
  • 1 respect

Components and supplies

Necessary tools and machines

About this project

So, I found this little Fan (it should be at least 10 years old), which was powered by some buttons and I had to get up from my bed/chair/whatever I was sitting on just to turn it on/off or to change speed (it has 3 speed).

So I came up with this idea of turning it off/on and changing speed with a simple IR Remote, obtaining a lot of comfort during hot summer days and nights.

So, I think that was a very nice idea and everything works properly.

Obviosuly, you can use that approach for every household appliance you have in your home, hope you will find it useful!

Have a nice day :)

Just one thing: YOU'RE WORKING WITH 220V, SO BE VERY VERY VERY VERY VERY CAREFUL BECAUSE YOU COULD SERIOUSLY HARM YOURSELF.

Code

Remote.inoArduino
Upload this code and change "YOURCODE" with your IR Remote Code.
Example: 0x"YOURCODE" -> 0xFF30CF
#include <IRremoteInt.h>

#include <IRremote.h> // use the library
int receiver = 11; // pin 1 of IR receiver to Arduino digital pin 11
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results;

void setup()
{
  Serial.begin(9600); // for serial monitor output
  irrecv.enableIRIn(); // Start the receiver
  pinMode(5, OUTPUT); //IN1 of first Relay
  pinMode(6, OUTPUT); //IN2 of first Relay
  pinMode(7, OUTPUT); //IN1 of second Relay
}
void loop()
{
  if (irrecv.decode(&results)) // have we received an IR signal?
  {
    Serial.println(results.value, HEX); // display it on serial monitor in hexadecimal
    irrecv.resume();// receive the next value
  }
 
 //Check if other Relays are OFF before turning ON the one selected.
  if (results.value == 0x"YOURCODE1"){ 
    if (digitalRead(6) == LOW && digitalRead(7) == LOW) {
    digitalWrite(5, HIGH); 
  }
    else if(digitalRead(6) == HIGH || digitalRead(7) == HIGH) {
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      delay(1000); //Wait a sec just to be sure of not causing a short circuit
      digitalWrite(5, HIGH);
    }
  }
  
 if ( results.value == 0x"YOURCODE2"){ 
  if (digitalRead(5) == LOW && digitalRead(7) == LOW) {
    digitalWrite(6, HIGH); 
  }
  else if(digitalRead(5) == HIGH || digitalRead(7) == HIGH) {
      digitalWrite(5, LOW);
      digitalWrite(7, LOW);
      delay(1000);
      digitalWrite(6, HIGH);
    }
 }  

 if ( results.value == 0x"YOURCODE3"){ 
  if (digitalRead(5) == LOW && digitalRead(6) == LOW) {
    digitalWrite(7, HIGH); 
  }
  else if(digitalRead(5) == HIGH || digitalRead(6) == HIGH) {
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      delay(1000);
      digitalWrite(7, HIGH);
    }
 }  

// Put here your code for turning off the Fan
 if ( results.value == 0x"YOURCODE4"){
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
 }

}
Decoder.inoArduino
Use this code to read and store your remote's code
#include <IRremoteInt.h>

#include <IRremote.h> // use the library
int receiver = 11; // pin 1 of IR receiver to Arduino digital pin 11
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results;

void setup()
{
  Serial.begin(9600); // for serial monitor output
  irrecv.enableIRIn(); // Start the receiver
  pinMode(9, OUTPUT); // Pin 9 output
}
void loop()
{
  if (irrecv.decode(&results)) // have we received an IR signal?
  {
    Serial.println(results.value, HEX); // display it on serial monitor in hexadecimal
    irrecv.resume();// receive the next value
  }
   
}

Schematics

cattura_OHt5XH5XdR.PNG
Cattura oht5xh5xdr

Comments

Similar projects you might like

TV remote controlled Light and Fan

Project tutorial by Rishabh

  • 18,805 views
  • 13 comments
  • 63 respects

Arduino: Switching ON/OFF Appliances Using IR Remote

Project showcase by Naman Chauhan

  • 11,293 views
  • 0 comments
  • 126 respects

IR Remote Controlled Power Switch for Rapsberry Pi 3

Project tutorial by Vilém Kužel

  • 1,855 views
  • 1 comment
  • 9 respects

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

Project tutorial by Lugh

  • 800 views
  • 1 comment
  • 6 respects

IR Remote Controlled Home Automation

Project tutorial by suhail jr

  • 10,925 views
  • 7 comments
  • 19 respects
Add projectSign up / Login