Arduino: Project 30: Automatic Table Lamp

So this project is actually dedicated to my mom. It solves a very common problem: leaving electrical appliances on even when no one is in the room. So this smart lamp turns on when you sit at your table and turns off a little while after it senses that you’ve left.

Demo:

Things Required:

  1. Jumper Wires
  2. Arduino UNO
  3. Relay
  4. Lamp that is powered through your House AC supply
  5. PIR Sensor
  6. breadboard
  7. USB Cable
  8. Arduino IDE on computer

Reference Material:

  1. I referenced this (LINK) article for the project and for getting to know the working of the PIR sensor. Note that in the project done here they’ve just used an LED, which I’ve replaced with a relay.

Code:

View on/ Download from Github: (LINK)

int pir_pin=8;
int relay_pin=7;
int pir_value;

void setup() {
  pinMode(pir_pin, INPUT);
  pinMode(relay_pin, OUTPUT);
  digitalWrite(relay_pin, LOW);
  Serial.begin(9600);
}

void loop() {
  pir_value= digitalRead(pir_pin);
  Serial.println(pir_value);
  if(pir_value==1){
    digitalWrite(relay_pin, HIGH);
  } else {
    digitalWrite(relay_pin, LOW);
  }
}

Stay Tuned for upcoming posts on Arduino Projects! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

Happy Learning!!

This image has an empty alt attribute; its file name is stay-tuned.gif

2 thoughts on “Arduino: Project 30: Automatic Table Lamp

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: