Automated Desk Lamp (with ARDUINO and HC-SR04)hjh

2.2K1515

Intro: Automated Desk Lamp (with ARDUINO and HC-SR04)hjh

HELLO...........................AADABH...........................NAMASTE.............

THIS PROJECT IS VERY USEFUL .BY THIS WE COULD BE FREE OF OUR PARENTS CHARGE WHEN WE LEAVE OUR ELECTRONIC APPLIANCES ON AND THEN THEY GET ON........... ON US..........

WHAT IT IS::

IN THIS PROJECT THE ELECTRONIC APPLIANCE IS A LAMP .............

WHEN YOU WILL SIT ON YOUR DESK THE LAMP WILL ILLUMINATE AND WHEN YOU WILL LEAVE YOUR DESK IT WILL TURN OFF

PLEASE VOTE FOR ME IN THE CONTEST

STEP 1: PARTS

THIS PROJECT REQUIRES VERY FEW PARTS

1. ARDUINO UNO or NANO/1

2. HC-SR04(ULTRASONIC SENSOR)

3. USB CABLE

4. ARDUINO INSTALLED IN YOUR COMPUTER(1.0.6 OR ABOVE)

5. JUMPER WIRES

6. ANY ELECTRICAL APPLIANCE(I am using a desk lamp)

7. 9V battery

8.BATTERY HOLDER

9. SWITCH

10. BREAD BOARD

STEP 2: CODE

const int trig = 2;

const int echo = 3;

const int relay = 4;

long duration, distanceCm;

int limitCm = 15;

void setup() {

Serial.begin(9600);

pinMode(relay, OUTPUT);

}

void loop() {

pinMode(trig, OUTPUT);

digitalWrite(trig, LOW);

delayMicroseconds(2);

digitalWrite(trig, HIGH);

delayMicroseconds(5);

digitalWrite(trig, LOW);

pinMode(echo,INPUT);

duration = pulseIn(echo ,HIGH);

distanceCm = microsecondsToCm(duration);

Serial.print(distanceCm);

Serial.print("CM");

Serial.println();

void checkLimit();

delay(100);

}

void checkLimit(){

if(distanceCm < limitCm){

digitalWrite(relay,HIGH);

}else{

digitalWrite(relay,LOW); }

}

long microsecondsToCm(long microseconds)

{

return microseconds / 29 / 2;

}

THE INO FILE IS GIVEN BELOW FOR EASE(YOU CAN DOWNLOAD IT)

STEP 3: UPLOADING THE PROGRAM

1. INSERT YOUR ARDUINO IN YOUR LAPTOP

2.A POP UP WILL COME WHICH WILL SHOW SOMETHING LIKE ...................ARDUINO ON COM3 OR COM1

3. REMEMBER THE COM NUMBER

4.NOW OPEN ARDUINO WINDOW AND FOLLOW THE STEP TOOLS>ARDUINO>SELECT ARDUINO V YOU ARE USING EG. ARDUINO NANO && DO

TOOLS>PORT>SELECT THE COM NUMBER REMEMBERED BY YOU!

5. ON LEFT SIDE OF COMPILE BUTTON THERE IS A UPLOAD ICON CLICK IT

UpLoAdInG..............................

STEP 4: CONNECTIONS

1. OPEN YOUR LAMP AND TAKE ANY WIRE ARISING FROM THE BATTERY OF IT EITHER + OR - . I PREFER +

2. CUT IT

3. CONNECT ONE END OF WIRE TO RELAY NORMALLY OPEN PIN

4. AND CONNECT ANOTHER TO THE RELAY COMMON PIN

5. WHEN YOU WILL NOW SWITCH ON YOUR LAMP IT WOULDN'T GLOW

6. CONNECT THE RELAY POWER PINS IN YOUR ARDUINO THROUGH WIRE AT THE PIN 4 OF ARDUINO

7.CONNECT +&- OF HC-SR04 TO +5 VOLT PIN OF ARDUINO AND - TO GND RESPECTIVELY

8.CONNECT THE TRIG PIN OF HC-SR04 TO PIN 2 OF ARDUINO AND ECHO PIN TO PIN 3 OF ARDUINO

ALL CONNECTIONS MADE BY JUMPER WIRE AND FEMALE HEADER

STEP 5: FINAL TOUCH

1.PUT YOUR HC-SR04 IN THE CHAIR (refer picture)

2.POWER YOUR ARDUINO

3.I REFER YOU TO PUT A SWITCH WHILE POWERING YOUR ARDUNO

NOW WHEN YOU WILL SIT ON YOUR CHAIR THE LAMP WILL ILLUMINATE

THANK YOU

BYE

PLS VOTE

STEP 6: PROS AND COS

PROS

1.RIGHT SITTING POSTURES //sdauiudiiasdiaduiaud9a8ud98u

2.SAVES BATTERY

3. AUTOMATIC

4. USES ARDUINO UNO HENCE NO NEED FOR EXTRA IC'S

5.SIMPLE TO MAKE

COS

1. DELICATE(IF I USE TO OUCH MY ARDUINO IT SHUTS DOWN AND I HAVE TO RESTART IT)

2. NOT WIRELESS

13 Comments

hey aditya.!
please turn off your caps lock off. the button to the left of "a".
it seems you are shouting all the way throughout.
Normal sentances are far more appealing to read.
Keep learning.
happy making:)
sorryfir the aame but it was my first i'ble now I hv improved
There is a key called caps lock which I think you have accidentally left on :D

Unfortunately i have to say that i had left it intentionally

Oh, but this is to tell you that doesn't look good. I really mean that. Most of the instructables you see always have text in lower case format. Keep that in mind next time.

Also your cover photo does not describe the project but yourself. The guys at instructables always say that the cover has to be informative and descriptive.

Good project! You got my vote too, use sentence case (the normal way we write; first letter being capital of the sentence and the rest lowercase) in the future instructables, it is aesthetically pleasing to the reader that way...

Use all Caps when you need to emphasize on some particular thing. You can make it bold too! Happy Making!

Great! I voted for U!

Great job!

You got my vote:)

If u live in NCR PLEASE tell me where do u buy electronic stuff my only support is eBay right now
Another thing please don't upload ur selfies too
Good thing bro but could use a few modifications though.U are Indian I guess.