TV Remote Control Home Appliances - Real Time

TV Remote Control Home Appliances...Tried Real Time

Circuit Diagram:
Arduino Code:
/*
 * Code written by Sdev
 * https://youtube.com/sdevelectronics
 */

#include <EEPROM.h>
#include <IRremote.h>

int load_status_1,load_status_2,load_status_3,load_status_4;

#define LED1 5
#define LED2 6
#define LED3 7
#define LED4 8

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){
  delay(5000);
  Serial.begin(9600);
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(LED3,OUTPUT);
  pinMode(LED4,OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
  check_load_status();
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);

     if (results.value == 0x80BF916E) {  //red
      if(load_status_1){
        load_status_1 = 0;
        digitalWrite(LED1,load_status_1);
        EEPROM.update(0, load_status_1);
      }else{
        load_status_1 = 1;
        digitalWrite(LED1,load_status_1);
        EEPROM.update(0, load_status_1);
      }
    }
    if (results.value == 0x80BF21DE) {  //green
       if(load_status_2){
        load_status_2 = 0;
        digitalWrite(LED2,load_status_2);
        EEPROM.update(1, load_status_2);
      }else{
        load_status_2 = 1;
        digitalWrite(LED2,load_status_2);
        EEPROM.update(1, load_status_2);
      }
    }
    if (results.value == 0x80BF9B64) {  //yellow
       if(load_status_3){
        load_status_3 = 0;
        digitalWrite(LED3,load_status_3);
        EEPROM.update(2, load_status_3);
      }else{
        load_status_3 = 1;
        digitalWrite(LED3,load_status_3);
        EEPROM.update(2, load_status_3);
      }
    }
    if (results.value == 0x80BF6996) {  //blue
       if(load_status_4){
        load_status_4 = 0;
        digitalWrite(LED4,load_status_4);
        EEPROM.update(3, load_status_4);
      }else{
        load_status_4 = 1;
        digitalWrite(LED4,load_status_4);
        EEPROM.update(3, load_status_4);
      }
    }

    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

void check_load_status(){
  load_status_1 = EEPROM.read(0);
  load_status_2 = EEPROM.read(1);
  load_status_3 = EEPROM.read(2);
  load_status_4 = EEPROM.read(3);

  digitalWrite(LED1,load_status_1);
  digitalWrite(LED2,load_status_2);
  digitalWrite(LED3,load_status_3);
  digitalWrite(LED4,load_status_4);
}


Video Link:
https://youtu.be/MX3e3i53HhY

EEPROM Arduino

In this Project, we will see about how to EEPROM in Arduino with LEDs .

Circuit Diagram:

Arduino Code:
dummy_eeprom_code.ino
#include <EEPROM.h>

void setup() {
  Serial.begin(9600);
  EEPROM.write(12,73);
  int k = EEPROM.read(12);
  Serial.println(k);
}

void loop() {

}

eeprom_led_control_code.ino
/*
 * Code written by Sdev
 * https://youtube.com/sdevelectronics
 */

#include <EEPROM.h>
#include <IRremote.h>

int load_status_1,load_status_2,load_status_3,load_status_4;

#define LED1 5
#define LED2 4
#define LED3 3
#define LED4 2

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){
  Serial.begin(9600);
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(LED3,OUTPUT);
  pinMode(LED4,OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
  check_load_status();
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);

     if (results.value == 0x80BF916E) {  //red
      if(load_status_1){
        load_status_1 = 0;
        digitalWrite(LED1,load_status_1);
        EEPROM.update(0, load_status_1);
      }else{
        load_status_1 = 1;
        digitalWrite(LED1,load_status_1);
        EEPROM.update(0, load_status_1);
      }
    }
    if (results.value == 0x80BF21DE) {  //green
       if(load_status_2){
        load_status_2 = 0;
        digitalWrite(LED2,load_status_2);
        EEPROM.update(1, load_status_2);
      }else{
        load_status_2 = 1;
        digitalWrite(LED2,load_status_2);
        EEPROM.update(1, load_status_2);
      }
    }
    if (results.value == 0x80BF9B64) {  //yellow
       if(load_status_3){
        load_status_3 = 0;
        digitalWrite(LED3,load_status_3);
        EEPROM.update(2, load_status_3);
      }else{
        load_status_3 = 1;
        digitalWrite(LED3,load_status_3);
        EEPROM.update(2, load_status_3);
      }
    }
    if (results.value == 0x80BF6996) {  //blue
       if(load_status_4){
        load_status_4 = 0;
        digitalWrite(LED4,load_status_4);
        EEPROM.update(3, load_status_4);
      }else{
        load_status_4 = 1;
        digitalWrite(LED4,load_status_4);
        EEPROM.update(3, load_status_4);
      }
    }

    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

void check_load_status(){
  load_status_1 = EEPROM.read(0);
  load_status_2 = EEPROM.read(1);
  load_status_3 = EEPROM.read(2);
  load_status_4 = EEPROM.read(3);

  digitalWrite(LED1,load_status_1);
  digitalWrite(LED2,load_status_2);
  digitalWrite(LED3,load_status_3);
  digitalWrite(LED4,load_status_4);
}

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...

Arduino - NRF24L01 Communication Tutorial

In this Project, we will see about how to transfer data through nRF24L01 module with Arduino.

Circuit Diagram:

Arduino Code:
nRF24L01_simple_msg_tx_code.ino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
  
RF24 radio(9, 10); // CE, CSN

const byte address[6] = "pipe1";

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}

void loop() {
  const char text[] = "SDev Electronics";
  radio.write(&text, sizeof(text));
  delay(1000);
}

nRF24L01_simple_msg_rx_code.ino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN

const byte address[6] = "pipe1";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}

void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

nRF24L01_control_led_tx_code.ino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define btn_onn 3
#define btn_off 4

RF24 radio(9, 10); // CE, CSN

const byte address[6] = "pipe1";

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();

  pinMode(btn_onn, INPUT_PULLUP);
  pinMode(btn_off, INPUT_PULLUP);
}

void loop() {
  if (digitalRead(btn_onn) == LOW) {
    const char text[] = "LED01_ONN";
    radio.write(&text, sizeof(text));
  }
  if (digitalRead(btn_off) == LOW) {
    const char text[] = "LED01_OFF";
    radio.write(&text, sizeof(text));
  }
  delay(100);
}

nRF24L01_control_led_rx_code.ino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define mled 2

RF24 radio(9, 10); // CE, CSN

const byte address[6] = "pipe1";

void setup() {
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();

  pinMode(mled, OUTPUT);
}

void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    String str(text);
    if (str == "LED01_ONN") {
      digitalWrite(mled, HIGH);
    }
    else if (str == "LED01_OFF") {
      digitalWrite(mled, LOW);
    }
  }
}

nRF24L01_dynamic_control_tx_code.ino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define potpin A0
#define led 2

RF24 radio(9, 10); // CE, CSN
const byte addresses[][6] = {"pipe1", "pipe2"};
boolean buttonState = 0;

void setup() {
  pinMode(led, OUTPUT);
  radio.begin();
  radio.openWritingPipe(addresses[1]); // 00002
  radio.openReadingPipe(1, addresses[0]); // 00001
  radio.setPALevel(RF24_PA_MIN);
}

void loop() {
  radio.stopListening();
  int potValue = analogRead(potpin);
  int angleValue = map(potValue, 0, 1023, 0, 255);
  radio.write(&angleValue, sizeof(angleValue));

  delay(5);
  radio.startListening();
  while (!radio.available());
  radio.read(&buttonState, sizeof(buttonState));
  if (buttonState == HIGH) {
    digitalWrite(led, HIGH);
  }
  else {
    digitalWrite(led, LOW);
  }
  delay(5);
}

nRF24L01_dynamic_control_rx_code.ino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define btn 2
#define pwm_pin 3

RF24 radio(9, 10); // CE, CSN
const byte addresses[][6] = {"pipe1", "pipe2"};
boolean buttonState = 0;

void setup() {
  pinMode(btn, INPUT_PULLUP);
  radio.begin();
  radio.openWritingPipe(addresses[0]); // 00001
  radio.openReadingPipe(1, addresses[1]); // 00002
  radio.setPALevel(RF24_PA_MIN);
}

void loop() {
  delay(5);
  radio.startListening();
  if ( radio.available()) {
    while (radio.available()) {
      int pwm_value = 0;
      radio.read(&pwm_value, sizeof(pwm_value));
      analogWrite(pwm_pin, pwm_value);
    }
    delay(5);
    radio.stopListening();
    buttonState = digitalRead(btn);
    radio.write(&buttonState, sizeof(buttonState));
  }
}

Libraries Used:

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...

Arduino - RF 433 Module Communication

In this Project, we will see about how to transfer data through RF433MHz module with Arduino.

Circuit Diagram:

Arduino Code:
rf_433_tx_code.ino
/*
   RF433 TRANSMITTER
*/

#include "VirtualWire.h"
char *msg;

void setup() {
  vw_set_tx_pin(8);
  vw_setup(4000);
}

void loop() {
  msg = "LED_ONN" ;
  vw_send((char *)msg, strlen(msg));
  vw_wait_tx();
  delay(3000);

  msg = "LED_OFF" ;
  vw_send((char *)msg, strlen(msg));
  vw_wait_tx();
  delay(3000);
}

rf_433_rx_code.ino
/*
   RF433 RECEIVER
*/

#include "VirtualWire.h"

void setup() {
  vw_set_rx_pin(8);
  vw_setup(4000);
  vw_rx_start();

  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

void loop() {
  char buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen)) {
    Serial.println(buf);
    String str(buf);
    if (str.equals("LED_ONN")) {
      digitalWrite(13, 1);
    }
    if (str.equals("LED_OFF")) {
      digitalWrite(13, 0);
    }
  }
}

Libraries Used:

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...