the idea of this week's assignment is to design and program a smart device that performs a certain function or solve a problem, Arduino should take two inputs and performs more than one action.
Since I was a kid it always fascinated me the doors that open when you approach them, the water taps that run when we put our hands, the lights that turn on when we walk to the room, and all that cool stuff that were mysterious to me back in the days! Yes, I did get the idea when I grew up but I haven't really got the opportunity to work with all these cool sensors up until now, So I decided to use two motion sensors in this week's assignment and perform different actions to each one of them.
Material:
-Breadboard
-Jumper wires.
-LED
-Resistor.
-Arduino UNO
-Ultrasonic sensor.
-IR sensor.
-Servo motor.
-USB cable.
-Cardboard.
I used Autodesk Tinkercad for circuit simulation.
and Arduino IDE to write the text code and upload the code to Arduino UNO.
Designing steps:
-First, I connected the Ultrasonic sensor and the servomotor with the Arduino and used code blocks to simulate the movement.
-Then I connected the IR sensor, which is not available in the Tinkercad components so I used the PIR sensor instead, and also used the code blocks first to make sure the connections are correct.
Finally I wrote the code in text!
I first included the servo library, identified each pin and its mode.
-Then with the help of this reference, I managed to deal with the ultrasonic sensor and get readings from it.
-I merged the two codes, the servo with the ultrasonic (if it found an object in less than 20 cm distance the servo which controls the door will open, else it will return back to zero degrees)
-And the IR sensor with the led, if it sensed any one in front of the door it will turn on, else it will stay turned off.
First, I connected the circuit as I did in the simulation.
Then I tested each sensor and made sure they were working properly.
here's our mini smart home!😍
This video was a great help to build the enclosure for the project, I used the same basic idea but with a small change in the shape and dimensions,
I was inspired by Muhammed Adel's idea in the previous week's assignment, he used a paper clip as a hook to open the box, and finally, I did the same with a keychain ring.
I had a huge problem with the mechanism of opening the door! I used a lot of different materials to link the door knob to the servo motor, most of them were weak and barely did the job
I got to work with sensors and understand them more which will be a great help in my final project because I'm going to use the same kinds of sensors I used in this assignment, and maybe more!
I got to work with my teammates to make a way complicated and much cooler smart home system! and it was a fun and rich experience.