This week's assignment idea was to build and Program a smart circuit using an Arduino UNO which reads a signal from multiple input components (Sensor, Switch, or variable resistor) to control multiple action components (Motor, Buzzer, LED...etc) using Code Blocks
inspiration:
I chose to use the ultrasonic sensor as I wanted to know more about how I can make actions with it.
So, I searched google and Arduino projects for a cool project and decided on the one in the video here:
Leds + Ultrasonic + Arduino
as it was easy to program and all the components needed are in the kit.
For Circuit Simulation with code
used for writing the code
Breadboard For Wiring the connections
220 Ohm resistors for the buzzer and LEDs
6 LEDS
Buzzer
Slide Switch
An Ultrasonic Sensor
Arduino Uno Board
Male to Female jumper wires
Male to Male wires
Card Board for enclosure
Circuit on tinker cad
I choose the components and then created the circuit on the Tinker CAD website, to be able to test and simulate the operation before implementing it with real components, in order to avoid burning anything and avoiding errors.
After that, I wrote the code on Tinker Cad and copied it to Arduino IDE and verified that there are no errors.
Thus, the code is ready to be uploaded to Arduino.
Tinker Cad Link:
Circuit Simulation
In the code above, I first define the sound tones that will be issued from the buzzer, this is done through ready-made codes for these tones from the Arduino website.
I prepared and assembled the components, then connected them on the Breadboard and connected them on the Arduino And a computer to upload the code.
-After building the circuit completely, I connected the Arduino to the computer and uploaded the code to test the operation of the circuit correctly before making the enlocure.
Before I started making an enclosure using the cardboard, I first removed the components, unplugged the connection directly on the breadboard, and extended the components’ wires using male to female wires so that I could install them on the cardboard easily and be flexible in moving with me and installing them
-Then I worked on the enclosure part using cardboard.
The enclosure of the circuit.
The first challenge I faced was when I created the circuit and uploaded the code.
As the circuit didn't work and the sensor wasn't reading anything and also the buzzer didn't work.
I thought the problem was in the breadboard or in the components, so I tried to see what was this about, then I found that I wrongly connected the Arduino ground and +ve pins an the ground as I was connecting them with +5v and +3.5v wrongly, so I corrected this and connected the +ve of the breadboard to the +5v in Arduino and the -ve of the breadboard to the ground in Arduino.
I also had a problem adjusting the distances, based on which the specified LED is turned on and the tone specified in the buzzer is working, and when I searched the projects implemented using the ultrasonic sensor and read its code, I knew the limits of the distances it senses.
Link: Ultrasonic sensor
I also connected the resistors to the cathode instead of the anode which would have made some LEDs get burnt but I realized that this was wrong so, I reconnected it in the right way.
Title of Media
Title of Media
Buzzer