I started the task by googling and looking for ideas, listing all the sensors I have, and exploring the possible ideas.
I always thought how the automatic door in mall works! so I wanted to make something similar that automatically open the door once someone approach.
I knew I would need to use IR sensor, and of course Arduino uno, and a way to open the door, servo motor would work greatly for a door!
5v adaptor
Buzzer
Arduino Uno
Lots of wires
IR sensor
250 MOhms Resistor
Yellow LED
Breadboard
Servo motor
Thinker cad for designing the circuit
Arduino IDE
I started by brain storming and listing all the components I need, and how the device will function.
It was very clear I will need a sensor, I had two options, I could use ultra sonic sensor or IR sensor, but I prefeed to use IR sensor to use something new, and because it has no distance, it's either High or low. unlike ultra sonic sensor it gives he distance that I do need.
The device will include the input it is the: IR Sensor To sense that something is close and turn on off the door.
The device will include Action components which is Servo motor, and led. When someone approaches. the servo motor will rotate and open the door, led wil turn off.
The circuit components will be:
Servo Motor
5V power adaptor
Yellow LED
Arduino uno.. the brain to control all
Wires
250 MOhms Resistor
IR Sensor to sense the movment.
breadboard
Here is the circuit on the thinkercad,
I decided that I will connect all components in parallel to operate them at the same time if I connect them in series the voltage will drain out and just one will work.
I connected the bottom rail for the breadboard to the 5v output of the Arduino +, and the ground with the ground rail -.
Then I connected all the ground and the voltage of all components to the down rail.
I made sure to check what is the voltage cable, ground for the IR sensor and servo motor. and I check the data sheet of all of them.
I connected the servo motor outputs to the pin number 6 in Arduino. and this will serve as an output that Arduino will give the angle to the servo motor.
Then, I connected the IR sensor to pin 4 on the Arduino. This will serve as its input. When the IR sensor detects something, it will send a high signal; when it doesn't, it will send a low signal.
I connected the LED and buzzer in the input 2 on the Arduino.
The programming blocks logic was like that:
In short words: we will check, if there is a reading from the sensor, then we rotate the servo motor from this degree to that degree. and we will let the Led up.
So we read from pin 4 first - The IR reading - we compare it to High and low. if there is a reading coming out of it (High) so we turn the servo motor on pin 6 to 180 degree, and we give power to pin 2.
else, if the sensor isn't reading any readings. then we don't turn the servo motor. it stays on 0.
You can view the cricket simulation on thinkercad using this "link"
I started by wiring all components on a breadboard, just as I did on thinkercad.
I made sure all components were properly connected. The Arduino Uno served as the main controller, supplying power and ground to all components.
Then - I connected the IR sensor to detect movement, with its signal pin linked to the Arduino for input. The servo motor was wired to pin 6, allowing it to receive control signals to rotate when triggered.
To complete the circuit, I added a yellow LED with a resistor to indicate system status. I made sure all voltage and ground connections were stable and double-checked the datasheets to confirm the correct wiring for each component.
And I uploaded the code to Arduino using
Arduino IDE.
I tested the circuit multiple times to ensure everything worked as expected. I checked the response of the IR sensor, the movement of the servo motor, and the LED behavior.
I made a door shape and sticked to the servo motor.
Then I made a enclosure for the circuit and the place to take the wires from.
Annnnd here is the final output:
One of the challenges I faced was setting the correct angle for the servo motor. At the beginning, it wasn’t aligned properly, so I had to go back and forth to adjust it.
By try and error, I needed to start the angle in 180 degree, and return it back to 0.
This was the solution that worked to open the door.
It will help me to wire all the sensors that my project will relay on sensors. I learned how to control them and take input from them.
I'd say sensors are like magic! It's really cool to take something from the real world and control something else with it! It's super awesome.
This video of the first time I wired the IR sensor – it was amazing playing with it!