Introduction to Programming and Physical Computing Seminar

Leonard A. Rieck

 

CONTEXT

Ultrasonic Counter System – Explanation

This system uses an ultrasonic sensor to detect when an object passes in front of it.
Every time something comes closer than x cm, the Arduino counts one pass and lights up fewer red LEDs, showing how many passes remain.

A green LED stays ON while there are still passes left.
When all 10 red LEDs turn OFF, the system activates an alert — the buzzer beeps repeatedly, and all red LEDs blink to show that the limit is reached.

The OLED display shows:

  • the number of passes remaining,
  • the current distance,
  • and whether the path is “CLEAR” or “BLOCKED.”

You can press the reset button to set the counter back to zero, which also makes a short double beep.

Default mode
Start of count
End of count

 Future Improvements

In the future, the system can be upgraded by adding a second ultrasonic sensor.
With two sensors placed side by side, the Arduino could detect the direction of movement — knowing whether an object is going in or out.
This would turn the project into a bidirectional counter, allowing it to track both entries and exits accurately.
Other possible improvements include saving the count to memory, adding wireless communication to send data to a phone or PC, and using a larger display for clearer information.

VIDEO LINK: