Assignment Idea:
Ā My assignment for this week is to create an LED Chaser circuit. The project makes a sequence of LEDs turn on and off one after another, creating the effect of āchasing lights.ā
Why I Care About This Idea:
I am interested in this assignment because it is not only fun to design, but it is also very useful for my learning. I want to practice this simulation since I plan to use a similar system in my final project. By doing this assignment now, I will be more prepared and confident when I work on my larger project later.
What Inspired Me:
I was inspired by the way LED chasers are used in real life, such as in car indicators, decorations, and electronic displays. They are simple, but they show how powerful circuits and programming can be when combined creatively.
Tinkercad
š¹ Software/Machines:
Tinkercad ā to design and the circuit .
to provide electricity to the circuit.
š¹ Electronic Components:
Jumper wires & crocodile clips ā to connect the circuit parts.
Breadboard ā to assemble the circuit easily without soldering.
LED ā to control the circuit and show when it is working.
Resistor ā to control the current and protect the components.
Screw ā to fix the components tightly on the cardboard and keep the parts in place.Ā
Power supply: 5 Volt to power leds and ultrasonic.
Arduino
Jumper wires
ResistorĀ
5LED s
ultrasonic sensor
Design and Preparation Process:
For my assignment, I created a smart LED Chaser circuit using Arduino UNO and Tinkercad.
Tool/Software Used:
I used Tinkercad (Software) to build, wire, and simulate the circuit.
I also used Code Blocks inside Tinkercad to program the Arduino.
Smart Circuit Description:
The smart circuit utilizes the Arduino UNO board to control the input and output.
Input Component: Ultrasonic Sensor (HC-SR04).
Action Components: 5 LEDs (Blue, Green, Yellow, Red, White).
Input and Output Selection:
I chose the ultrasonic sensor as the input, because it can measure the distance of an object.
I selected five LEDs as the outputs to create a chasing light effect.
When the sensor detects an object closer than a certain distance, the LEDs turn ON one by one from blue ā white (left to right). Each LED turns on after 1 second delay.
When the object disappears (distance greater than threshold), the LEDs turn OFF in the reverse order from white ā blue, also one by one.
Circuit Wiring and Testing in Tinkercad:
I connected the ultrasonic sensor to the Arduino (Trig to pin 6, Echo to pin 2).
I connected each LED to pins 8ā12 with resistors.
I tested the circuit in Tinkercad, and it successfully simulated the LED chase effect when an object was detected.
Programming with Code Blocks:
I used Code Blocks in Tinkercad instead of traditional Arduino text code.
The program logic:
Measure distance with the ultrasonic sensor.
IF the object is detected (distance < 20 cm), turn ON LEDs one by one with 1-second delay.
ELSE (no object), turn OFF LEDs one by one in reverse.
(Insert your Code Block screenshot here)
Explanation of Code Blocks:
The if-else block checks the distance measured by the ultrasonic sensor.
Inside the if branch, each LED is turned ON with a delay of 1 second before the next LED.
Inside the else branch, the LEDs are turned OFF one by one with a 1-second delay in reverse orde
Ā Block code Part 1
Block code Part 2
Programming with Code Blocks:
I programmed the Arduino using Tinkercad Code Blocks.
Program logic:
The āif blockā checks if the ultrasonic sensor detects an object more than 20 cm.
If the condition is true, the program turns ON the LEDs one by one with a 1-second delay.
Otherwise, the program turns OFF the LEDs in reverse order, again with a 1-second delay.
Explanation of Code Blocks:
Repeat & Delay blocks: used to control the timing of LEDs turning ON and OFF.
If-Else block: makes the circuit āsmart,ā because it responds differently based on whether the sensor detects an object or not.
Digital Write blocks: used to switch each LED ON or OFF.
This programming creates a smooth chasing effect that is triggered by the ultrasonic input.
To wire my smart circuit, I followed these steps:
Placing LEDs:
I started by placing 5 LEDs (Blue, Green, Yellow, Red, White) on the breadboard.
I connected each LED to the Arduino pins in order: pin 8, pin 9, pin 10, pin 11, pin 12.
Then I placed resistors (220Ī©) for each LED to prevent burning them out.
I used jumper wires to connect the other ends of the resistors to GND on the Arduino.
Placing the Ultrasonic Sensor :
The sensor has 4 legs: VCC, GND, Trigger, and Echo.
I connected:
VCC ā 5V on Arduino
GND ā GND on Arduino
Trig ā pin 6 on Arduino
Echo ā pin 2 on Arduino
Final Check:
After wiring, I checked all the connections in Tinkercad to make sure they were correct.
Then I ran the simulation, and the LEDs responded to the ultrasonic sensor exactly as expected (chasing ON from blue ā white, and OFF in reverse when the object disappeared).
When I got stuck, I turned to my instructor Yassin for advice. The issue happened when the LEDs turned ON one by one from left to right (blue ā white), but they did not return back (white ā blue) when I moved the object away.
At that point, I had to pause and carefully check my Code Blocks. My instructor suggested two things:
Maybe I had made a mistake with the comparison symbol in the condition (< 20 vs > 20).
He asked me humorously if I had said āBismillahā before starting. I laughed, and then I actually said āBismillah al-Rahman al-Raheemā before trying again.
I fixed the comparison symbol in my code, and surprisingly everything worked perfectly right away!
Check comparison symbols carefully: A small mistake like using āgreater thanā instead of āless thanā can completely change how the program behaves.
Test both conditions: Always test the āifā and the āelseā parts of your code to make sure both work correctly.
Donāt rush: Sometimes when we assume everything is correct, we miss a simple logic error.
And finally, it never hurts to say āBismillahā before starting ā it might bring you luck and focus š.
Coolest thing I learned this week:
I learned about paper circuits, which was so interesting because it showed me how electricity can flow in such a simple and creative way using just paper, copper tape, and LEDs.
Something I will never forget from this week:
I also learned about PCBs and their typesālike single-layer, double-layer, multilayer, and flexible PCBs. Iāll never forget this because it helped me understand how real electronic devices are built and how important PCBs are in making technology work.
Title of Media