Our assignment for Week 7 involves building and Programming a smart circuit using an Arduino UNO which reads a signal from more than one input component to control more than one action component using Arduino IDE.
I chose to make a smart street with two inputs and two outputs components. When the car passes through the street, the smart lighting poles start to light up and then turn off after it passes. Also, I made a smart gate which open automatically to the cars.
Here's a list of software, machines, and materials I used for the assignment:
Tinkercad software for simulating
Arduino IDE
servo motor
resistance
cardboard
Avometer for troubleshooting
ultrasonic sensor
Breadboard
cutter
papers
IR sensor
Arduino uno with cable
LEDs
glow gun
jumpers
5V adaptor
RCA female
scissors
The simulation of the circuit
Tinkercad simulation Process:
In this project, I used IR sensor as input and 5 leds as outputs in first feature, ultrasonic sensor as input and servo motor as output in second feature.
I used Arduino UNO to control my circuit.
I used breadboard to mount electronics and wires on it.
I connected the IR sensor with pin 9 (signal) and the GND of Arduino.
I connected the leds with pins 1,2,3,4 and 5 (signals) and the GND of arduino, and connected resistances in series with them to limit the current through them.
I connected the ultrasonic sensor with the GND and VCC of Arduino, and connected trig with pin 10 and echo with pin 11 of Arduino.
I connected the servo motor with the GND, VCC and pin 12 of Arduino.
Finally, after simulating the circuit and uploading the code on Arduino, I used the power supply (5v - 2A) as power source.
Coding Process:
I started to define the inputs and outputs pins.
then, I begin to write the instructions: if IR reads low (that is mean the sensor is reading something), turn on the leds one by one, then turn off them one by one.
if it reads high, turn off the leds.
if ultrasonic sensor reads distance lower than 50 cm, rotate the servo to 90 and wait 3 seconeds, then rotate it to 0.
if it reads distance higher than 50 cm, let the servo at 0 as it is.
the code of the circuit (part 1)
the code of the circuit (part 2)
the code of the circuit (part 3)
I connected the IR sensor, ultrasonic sensor, servo motor, leds and resistances with arduino using breadboard as shown in tinkercad simulation
Demo of the circuit
The first enclosure
The new enclosure
Demo of the circuit
When working on an electronics project, ensure that you have control over all aspects of the project, including the connections, code, and physical design. In my case, I encountered difficulties when installing components inside the enclosure, which added complexity to the project.
Therefore, I recommend paying special attention to the enclosure design and component installation, ensuring that you have easy access to all parts of the project. This will help you avoid potential problems and difficulties in the future.
One of the challenges I faced was difficulty installing the components inside the enclosure. I struggled to secure them properly, which resulted in damaging some wires and LEDs during the installation process.
I encountered an issue during the enclosure phase where the second feature wasn't functioning. I proceeded to troubleshoot the components, starting with testing the servo by connecting it to pin 9 and uploading the sweep code. Unfortunately, it didn't work, so I replaced it.
This week, I learned how to make electrical circuits using arduino and coding using arduino ide instead of coding blocks, how to control outputs using different types of inputs, how to troubleshoot your circuit to detect the problem, and how to simulate your circuit first.
I encountered some problems and learned from them, so I think I will use them effectively in my final project.
Besides the hands-on learning experience, I thoroughly enjoyed the journey, absorbing valuable tricks and gaining in this week. The team spirit with fellow colleagues – sharing advice, capturing moments, laughter, and encouragement – created unforgettable memories.