The idea behind this smart device is to support students while studying. The device is placed on the desk and works with an ultrasonic sensor, an LED, a buzzer, and a slider button.
As long as the student is sitting at the desk, the ultrasonic sensor detects their presence, and the LED light stays on to indicate that they are focused on studying.
Once the student leaves the chair or moves away, the sensor recognizes the absence. Immediately, the buzzer turns on and produces a sound, reminding them that they’ve stopped studying.
The slider button allows manual control of the system when needed.
The idea is based on the desk theme .
TinkerCad to make the circuit and simulate it .
Arduino IDE to make the code
Arduino UNO
Breadboard
ultrasonic distance ( INPUT)
buzzer(OUTPUT)
resistor
LED(OUTPUT)
MALE-MALE wires
push button /SLIDER(INPUT)
cardboard
ultrasonic distance
I used the ultrasonic sensor to measure the distance and detect if an object is within 50 cm.
( INPUT)
buzzer
(OUTPUT)
resistor
Added a a 220Ω resistor to prevent the LED from burning out by limiting the current
LED
(OUTPUT)
push button /SLIDER
to control the circuit
(INPUT)
First, I started by making the connections in Tinkercad and made sure that everything was properly connected
TinkerCad simulation
First, I set up all my components on the breadboard after completing the connections and simulation in Tinkercad.
The ultrasonic sensor was my first input, because it reads the distance and detects if something moves or if there’s an object in front of it.
The second input was the slider button, which controls the whole circuit — switching it between automatic and manual mode.
For the outputs, I used a buzzer that makes a sound whenever the ultrasonic sensor detects that something moved away, as an alert.
I also used an LED that lights up to give an additional visual alert.
I started by connecting my outputs to the Arduino.
I connected the buzzer to pin 3.
I connected the LED to pin 2.
Then I connected my inputs to the Arduino.
For the ultrasonic sensor, the trigger pin was connected to pin 12 and the echo pin to pin 11.
The slider button was connected to pin 4.
After that, I connected the 5V power from the Arduino to the positive rail of the breadboard.
I also connected the Arduino ground (GND) to the negative rail of the breadboard.
This provided power to the whole circuit so it could work properly.
I first started by defining my variables:
duration → stores the time (in microseconds) taken by the ultrasonic pulse to travel and return.
distance → stores the calculated distance (in centimeters) using the value of duration.
blinkRate → another dynamic variable that changes based on the distance and controls the delay time.
All of these variables are dynamic because their values keep changing based on the sensor readings.
I created a function readUltrasonicDistance() that controls the ultrasonic sensor by sending a trigger pulse and reading the echo to calculate the distance.
In the setup() function:
Pin 4 is defined as an input (slider switch).
Pin 2 is defined as an output (LED).
Pin 3 is defined as an output (buzzer).
In the loop() function:
First, I check if the slider (pin 4) is ON (HIGH).
If the slider is ON:
I read the distance from the ultrasonic sensor (trigger pin 12, echo pin 11).
I multiply the time reading by 0.01723 to convert it into distance in centimeters.
I calculate blinkRate from the distance.
If the distance is less than or equal to 50 cm:
The LED (pin 2) turns ON.
The buzzer (pin 3) turns ON with a medium tone (analogWrite(3, 127)).
The buzzer and LED react with delays controlled by blinkRate, so the timing changes depending on the distance.
If the distance is greater than 50 cm:
The LED and buzzer are turned OFF.
If the slider is OFF:
The whole system is disabled, LED and buzzer stay OFF.
Finally, I uploaded my code to the Arduino.
The circuit worked successfully as expected.
first I started with putting the sensor , buzzer and the LED on the front side to wire them inside the box .
I mount every thing ( wire) inside the box and connected every thing to the Arduino and the breadboard .
Then I tried to try the device before I finish the whole enclosure .
Title of Media
Troubleshooting:
At first, I connected the ultrasonic sensor to pins 8 and 7 for the Echo and Trigger, but it was not working properly. Later, I learned from one of my classmates that the ultrasonic sensor works in a specific way:
The Trigger pin only needs to send a short pulse, so it can be connected to any digital pin.
The Echo pin returns a pulse whose duration represents the measured distance. To read this pulse accurately, it is better to connect it to a pin that supports timing functions (usually marked with ~ on the Arduino).
This is because the Echo signal requires precise microsecond-level timing, which is handled more reliably by those pins.
After knowing this, I changed the connections to pins 11 and 12, and then the sensor started working correctly.
🔹 Summary of My Work:
I connected my outputs first: the buzzer to pin 3 and the LED to pin 2.
Then I connected my inputs: the ultrasonic sensor (trigger → pin 21, echo → pin 11) and the slider button to pin 4.
After that, I provided power by connecting 5V and GND from the Arduino to the breadboard rails.
Finally, I uploaded my code to the Arduino, and the circuit worked successfully.
I tested and proved that the alert system (light + sound) responds when movement is detected.
Title of Media
Title of Media