Welcome 😊
This week we had to build and program a smart circuit using an Arduino UNO.
This week our assignment is to build and program a smart circuit using an Arduino UNO which reads a signal from an input component to control an action component using Tinkercad Code Blocks.
My inspiration came from a sensor that used to help the car driver to park 🚗🅿️.
Tinkercad used to design and simulate my electronic circuit.
Arduino IDE used to program the Arduino UNO.
Tinkercad circuit
I start by using Tinkercad to build and program my circuit and made sure that the circuit will work.
Tinkercad Components that I used during designing:
Arduino UNO
Breadboard
Ultrasonic Sensor (HC-SR04)
Buzzer
3x 220 Ohm Resistors
3x LED
Braking Down:
I connect the Ultrasonic Sensor to the Arduino VCC to 5V pin, Trig to D7 pin, Echo to D6 pin and GND to GND pin of the Arduino.
I used 3x 220 Ohm resistors on the anode terminals of the 3x LEDs to reduce the voltage as I connect the Green LED to D2 pin, Yellow LED to D3 pin and Red LED to D4 pin. And all the cathode terminals GND pin of the Arduino.
I connect the the anode terminal of the Buzzer to D11 and cathode to GND pin.
Part 1
Part 3
The code start by defining a variable called "distance" and then set that "distance" variable to the Ultrasonic reading value.
Print the value of "distance" in the serial monitor for debugging and read the real time reading of the Ultrasonic sensor.
then by using "if condition" it check if the value of the "distance" variable between 20 CM and 15 CM it sets pin D2 to HIGH which turns on the Green LED and fire up the buzzer which is connected to pin D11 with high delay between every buzz
and then using "if condition" it check if the value of the "distance" variable between 15 CM and 10 CM it sets pin D3 to HIGH which turns on the Yellow LED and fire up the buzzer which is connected to pin D11 with medium delay between every buzz
and then using "if condition" it check if the value of the "distance" variable between 10 CM and 5 CM it sets pin D4 to HIGH which turns on the Red LED and fire up the buzzer which is connected to pin D11 with small delay between every buzz
Other than those 3 conditions all the pins will set to LOW
Part 2
Full Code
Parking Sensor
I used the same components as on Tinkercad I placed everything of the breadboard and wire it all and I placed the buzzer directly on the Arduino connecting it to D11 and GND pins then I connect the Arduino to the computer and upload the code that was generated by Tinkercad.
When I power on the Arduino the Ultrasonic sensor start by reading the distance in front of it and there are 3 levels of the distance between the sensor and the object in front of it and every level light up a different LED and fire up the buzzer in a different way.
❤️
Me and my team-mate Ayman. We managed to build and program a Smart Waving Hand using Arduino during EoWeek activity.
Amani, Ibrahim, Michael, Ayman & I. We tried to debug the code during EoWeek Activity as the Ultrasonic sensor was giving up random readings
Also me and colleagues, we all like to talk and sharing knowledge & ideas.
❤️
After I wire the circuit and start testing one of the LEDs didn't light up so I start by tracing back the wires and I found that I didn't wire that LED to GND 🤦🏻♂️
so after I connected everything works fine.
The skills & knowledge I have acquired this week would help me using the Arduino as it would be the brain of my project.
The relay module can be powered with range of 5-24 V DC
and can handle up 250 V AC 🤯
I tried to replicate the circuit that Sherif had made using 2x 7 segments, IR sensor and relay it was fun .