Door-On! a Door Opener Through an IR Sensor.

by luca.qumsieh in Circuits > Arduino

323 Views, 0 Favorites, 0 Comments

Door-On! a Door Opener Through an IR Sensor.

IMG_1820.jpg

There are too many people who are stuck under the yoke of those who live with them who do not close doors when they leave, especially when the oppressed mentioned ones are laying in bed comfortably. Thus, the solution is to create a remote controlled door opener and door closer, which is just what I made.

Supplies

For this project you need:

  • A cardboard box
  • HITEC HS-485HB
  • TSOP38238 IR Sensor
  • Spare parts (i.e. screws, metal pieces, etc.)

You will also need the IR Remote Library

Step 1: Metal Bar

IMG_1815.jpg
IMG_1814.jpg
IMG_1813.jpg

Attach a metal bar (it can be plastic, but it must have holes so that screws and nails can go through) to the top part of the door of the cardboard box. Then put nails into it, so that it stays firm. Then, put two "L" shaped metal pieces on top, and screw those in, as the image shows. Then connect the servo to the top of it, with the screw in the center of the servo connecting into the metal bar at the end, and then put another metal bar going out from the servo and have it go into the box. Then screw it in snugly.

Step 2: the Pictures

IMG_1812.jpg
IMG_1811.jpg

To make it seem more realistic, since this is but a prototype, take pictures of your room, like I did, and tape them to the top.

Step 3: the Wiring

IMG_1810.jpg

For the Servo

  1. Blue -> Black
  2. Green -> Red
  3. Yellow -> Yellow

Step 4: the IR Sensor

IMG_1809.jpg

Tape the IR Sensor sideways at the top of the box, and then wire the wires from it through the box to the back and then connect it as such:

  1. Red -> GND
  2. Brown -> 3.3 V
  3. Orange -> 12

Step 5: the Coding

Screen Shot 2021-05-06 at 10.08.41 PM.png
engineering flowhcart.png
Copy and paste this C++ Code (also an image): #include #include //fwd 9 //bck 7 Servo myservo; const byte IR_RECEIVE_PIN = 11; void setup() { Serial.begin(9600); Serial.println("IR Receive test"); IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); myservo.attach(9); } void loop() { if (IrReceiver.decode()) { Serial.println(IrReceiver.decodedIRData.command); if (IrReceiver.decodedIRData.command == 9) { myservo.write(260); delay(15); Serial.println("fwd"); } else if (IrReceiver.decodedIRData.command == 7) { myservo.write(0); delay(15); Serial.println("bck"); } /*if (IrReceiver.decodedIRData.command == 9) { Serial.println("hello"); } else { Serial.println("goodbye"); }*/ IrReceiver.resume(); } } The attached flowchart is a breakdown of how the code works.

Step 6: Finished

You're done! It should look like the attached video! Good job!