The idea came from the final project, where there is a Proximity sensor that detects user presence or movement to activate the timer and a screen displaying the time. but i use 7-segment display the time
Software:
I used Thinkercad to simulate my electronic circuit and wrote my code using the website. This week, using code blocks in TinkerCAD was a technical requirement, so I did just that.
I used Arduino IDE to upload my code to my Arduino .
The Material
breadboard
resistors 330 Ohm
Input Component:
wires
Arduino Uno
Arduino Uno is a small programmable board that reads inputs and controls outputs based on uploaded code.
Displays numbers based on signals from the Arduino.
ultrasonic sensor
Measures distance by sending and receiving ultrasonic waves.
Sends an electrical signal to the Arduino based on the detected distance.
breadboard
helps organize connections without soldering.
jumper Wires
Connect components to the Arduino Uno and breadboard.
allowing signals to transfer.
Resistors (330 Ohm)
Limit current to protect the 7-segment display LEDs.
Ensure proper brightness and prevent damage.
First, in Tinkercad,
I take the components and start to connect them.
connect every segment by resistance,
and then connect every resistance by wire to the pin in the Arduino
and then create the code blocks
The program measures the distance using an ultrasonic sensor.
If the distance is less than 60 cm, turn on the 7 segment and It counts from 9 to 1.
each pattern lasts 1 second before switching to the next.
Pattern 1:
LEDs ON → Pins 2, 3, 4, 5, 6, 7 (HIGH)
LED OFF → Pin 8 (LOW)
Wait for 1 second
Pattern 2:
All LEDs ON → Pins 2, 3, 4, 5, 6, 7, 8 (HIGH)
Wait for 1 second
Pattern 3:
LEDs ON → Pins 2, 3, 6 (HIGH)
LEDs OFF → Pins 4, 5, 7, 8 (LOW)
Wait for 1 second
Pattern 4:
LEDs ON → Pins 3, 4, 5, 6, 7, 8 (HIGH)
LED OFF → Pin 2 (LOW)
Wait for 1 second
Pattern 5:
LEDs ON → Pins 3, 4, 5, 6, 7 (HIGH)
LED OFF → Pins 2, 8 (LOW)
Wait for 1 second
Pattern 6:
LEDs ON → Pins 2, 4, 5, 6 (HIGH)
LEDs OFF → Pins 3, 7, 8 (LOW)
Wait for 1 second
Pattern 7:
LEDs ON → Pins 2, 3, 5, 6, 7 (HIGH)
LED OFF → Pins 4, 8 (LOW)
Wait for 1 second
Pattern 8:
LEDs ON → Pins 2, 3, 5, 7, 8 (HIGH)
LED OFF → Pins 4, 6 (LOW)
Wait for 1 second
Pattern 9:
LEDs ON → Pin 6, 2 (HIGH)
LEDs OFF → Pins 3, 4, 5, 7, 8 (LOW)
Wait for 1 second
I connect the components and then connect the Arduino to the laptopand then upload the code to Arduino
Obstacles to potential difficulties: Switch wire that comes from segments that are connected to Arduino pins.
Solution: Review the connections I put in the circuit to work well.
when connecting the Arduino to the laptop, did not select the right board and port so the code did not upload to Arduino
Solution: Determine the port and board before uploading the code to Arduino