License

Public Domain

Recommend Projects

ARDUINO NANO HOME AUTOMATION SYSTEM

9 months ago 278
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments

Description

THIS IS A SIMPLE ARDUINO IR HOME AUTOMATION SYSTEM IN WHICH IT CAN ACTIVATE OR DEACTIVATE 2 RELAYS INDUVIDUALLY OR SEPERATELY.

THE IR REMOTE USED FOR THIS PROJECT HAS A RANGE OF 8m BUT THE NAME AND DETAILS ARE NOT SPECIFIED. SO I FOUND A PICTURE OF IT ON THE INTERNET SO U CAN SEE WHICH ONE IT IS IR REMOTE FOR ARDUINO

button 0 = ALL RELAYS ARE OFF. button 1 = RELAY1 IS ON/OFF. button 2 = RELAY2 IS ON/OFF. button CH/OK = RELAY1 AND RELAY2 ARE ON.

WARNING DO NOT POWER THE DEVICE WITH THE POWER SUPPLY PORT WHILE THE ARDUINO IS SEPERATELY ON WITH A USB CABLE.

FOR AN EXAMPLE, THIS PROJECT CAN BE USED TO CONNECT A DOMESTIC ELECTRONIC LIGHT OR FAN. I HAVE TRIED IT :)

the code is below at the comment section. i tried to put the code here but it didnt come right so i sent it as a comment

and the library name is IRremote.h

Documents

Sheet_1

NEW_PCB

BOM

Attachments

None
Success
The owner does not allow comments in this project now

Comments (2)

Daniel Avery Reply

 this  is the new code for this project,




#include

int RECV_PIN = 10;
int RELAY_PIN = 6;
int RELAY_PIN2 = 8;

IRrecv irrecv(RECV_PIN);
decode_results results;

void dump(decode_results *results) {
  int count = results->rawlen;

}

void setup()
{
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(RELAY_PIN2,OUTPUT);
  pinMode(13, OUTPUT);
    Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

int on = 0;
unsigned long last = millis();

#define BUTTON_1 0xFF30CF
#define BUTTON_2 0xFF18E7
#define BUTTON_3 0xFF7A85
#define BUTTON_0 0xFF6897
#define BUTTON_OK 0xFF629D

void loop() {
  if (irrecv.decode(&results)) {
    if (results.value == BUTTON_2)
    {

      on = !on;
      digitalWrite(RELAY_PIN, on ? HIGH : LOW);
      digitalWrite(13, on ? HIGH : LOW);
      dump(&results);

    if (results.value == BUTTON_1)
    {

      on = !on;
      digitalWrite(RELAY_PIN2, on ? HIGH : LOW);
      digitalWrite(13, on ? HIGH : LOW);
      dump(&results);
    }

     if (results.value == BUTTON_OK)
    {

      on = !on;
      digitalWrite(RELAY_PIN2, on ? HIGH : LOW);
      digitalWrite(RELAY_PIN, on ? HIGH : LOW);
      digitalWrite(13, on ? HIGH : LOW);
      dump(&results);
    }

    irrecv.resume(); // Receive the next value
  }
}
Daniel Avery Reply

the library name is   \

goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.