Automatic gate in parking
This week we were talking about sensors and how to use them in making any project smarter. We were asked to make a circuit where the Arduino acts as input and as output too. So, I decided to make a circuit of an automatic gate like the one that exits in the parking of any mall.
For simulation, I used TinkerCad.
For real implementation I used each of the following:
1-Male-Male wires
2-Arduino UNO
3-Buzzer
4-Red LED
5- 1 kohm resistor
6-Ultrasonic sensor
7-Servo motor
Components used
Simulation of the circuit on tinkercad
I started to choose the components I will need from the components menu, then I connected them and finally I used to code blocks to program it.
My circuit contains one input which is the Ultrasonic sensor, and it has 3 outputs which are the red led, the buzzer and the servo motor.
In this circuit, the ultrasonic sensor is supposed to measure how far the object is. Also, the servo motor is acting as the gate in our case, where its initial state is 0 degrees. So it opens by changing its angle to 90 degrees and then when closing it returns back to the zero position.
In the code, I divided its range into two conditions, the first is when the object is near to the sensor with 50 cm or less, in this case the gate is supposed to open for the car and also both the buzzer and the red led will turn on.
Otherwise (when it is more than 50 cm away), the gate returns back to its initial position (closed --> 0 degrees) and the red led will light.
Circuit on Tinkercad
1st part
2nd part
1st part
2nd part
On the real implementation of the circuit, I had to test whether it the circuit is functional or not, so I used a pen to act as the car and when the pen was far away from the sensor with more than 50 cm only the red led was on and the servo shaft didn't rotate, but when it comes nearer both the led and the buzzer were on and also the shaft of the servo rotate with 90 degrees, I moved the pen away again with more than 50 cm so the buzzer stopped, the led remained as it was and the servo moved back to its initial state and became in the zero degree position.
The components were wired as follows:
Buzzer: +ve terminal --> on Arduino pin 4
-ve terminal --> GND
Ultrasonic Sensor: vcc terminal --> +5 v
ground terminal --> GND
trigger terminal --> on Arduino pin 7
echo terminal --> on Arduino pin 6
LED: cathode terminal -->GND
anode terminal --> on Arduino pin 3
Servo Motor: power terminal --> +5 v
ground terminal --> GND
signal terminal --> on Arduino pin 5
Trying the circuit
Ultrasonic sensor
After finishing the EOWeek session, Mahmoud -one of my teammates- suggested an idea for my project that will help me in easy implementing on of the features that I strongly wanted in my project which was that the robodog will detect the place of the person calling it and goes to it. He suggested using 2 ultrasonic sensors, one for sending the signal (activating the trigger pin only) and the other for receiving it only. And using the code and the equation of speed, it can detect where the person is standing and move with this distance towards him/her. So, instead of using sound detection which is some how difficult to be implemented during the 2 weeks we have for building the project I can use this method fo place detection.
I don't know if this counts as a challenge or not but it is something I was confused about, while doing the activity of the EOWeek, I was confused about the servo motor whether it is digital or analog. When I discussed this point with my instructors they told me that it is digital but I felt that I need more explanation, so I googled it in order to find more satisfying answers for me. What I found was that there are already the types, some servos are digital and the others are analog. But what we have in the kit is a digital one.
Digital Servo Motor
Sensors is one of the main
Title of Media