|
ARDUINO UNO REV3 |
x 1 | |
|
|
2-Channel Relay |
x 1 | |
|
|
IR ReceiverNewark
|
x 1 | |
|
|
IR Remote (generic) |
x 1 | |
|
|
HLK-PM01HI-LINK(海凌科)
|
x 1 |
|
arduino IDEArduino
|
|
|
Soldering iron |
IR Remote for Fan
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.
#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.
// 0x"YOURCODE1" will turn into something like
// 0xABCDEFX after reading the remote value
// Same for YOURCODE2/3/4
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);
}
}
#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
}
}
IR Remote for Fan
Attribution-ShareAlike (CC BY-SA) License
Read More⇒
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Noshirt
-
IR Remote for Fan
So, I found this little Fan (it should be at least 10 years old), which was powered by some buttons ...
-
Arduino Weather Station v1.0 (BMP280)
First version of a very simple weather station made with an Arduino UNO, a BMP280 sensor and a LCD.I...
-
Wi-Fi Controlled Relay
One day I woke up. I thought, why can't my windows be opened from my pc?! Why I have to get up from ...
-
Start/Stop Chronometer
Me and my friend are always in competition for something, in every sports, from ski to run, to MTB. ...
-
Arduino Keyboard V2.0
That's an update for the older version of the project!Now you can play the keyboard on the keys from...
-
Arduino Keyboard
Didn't know what to do as my first Arduino Project, so i thought of starting out with something litt...
-
-
ARPS-2 – Arduino-Compatible Robot Project Shield for Arduino UNO
1370 0 5 -
-
A Compact Charging Breakout Board For Waveshare ESP32-C3
1896 3 7 -
AI-driven LoRa & LLM-enabled Kiosk & Food Delivery System
1900 2 0 -
-
-
-
ESP32-C3 BLE Keyboard - Battery Powered with USB-C Charging
2075 0 1 -







