Obstacle detection system using HC-SR04, SSD1306 display and Arduino UNO

Arduino UNO 22-02-24
117 0

1- Principle of obstacle detection system using HC-SR04, SSD1306 display and Arduino UNO

2- Necessary system components

3- Obstacle detection system wiring diagram

4- Programming the Arduino UNO board

 

 

Principle of obstacle detection system using HC-SR04, SSD1306 display and Arduino UNO

An obstacle detection system is a technology designed to identify and alert users or autonomous systems about obstacles or hazards in their environment. These systems are commonly used in various applications, including robotics, autonomous vehicles, drones, industrial automation, and assistive technologies. The primary goal is to enhance safety and prevent collisions by providing real-time information about the presence of obstacles.

The obstacle detection system using HC-SR04, SSD1306 display, LED, buzzer, and Arduino UNO operates based on the principles of ultrasonic distance measurement and sensor integration. Here’s a step-by-step explanation of how the system works:

1- Ultrasonic Distance Measurement (HC-SR04):

The HC-SR04 ultrasonic sensor emits ultrasonic waves using the transducer on the trigger pin.

The waves travel through the air and bounce off any obstacle in their path.

The transducer on the echo pin receives the reflected waves.

2- Calculation of Distance:

The Arduino measures the time it takes for the ultrasonic waves to travel to the obstacle and back.

Using the speed of sound in air (approximately 343 meters per second), the Arduino calculates the distance to the obstacle.

3- Obstacle Detection:

A conditional statement checks if the measured distance is less than a predefined threshold (e.g., 20 cm).

If the distance is less than the threshold, an obstacle is considered detected.

4- Display on SSD1306 display:

The SSD1306 display screen serves as a user interface by displaying relevant information  obstacle detection status.

5- LED Indication:

An LED is used to provide a visual indication of obstacle detection.

The LED is turned on when an obstacle is detected and turned off otherwise.

6- Buzzer Alert:

A buzzer is employed to provide an audible alert when an obstacle is detected.

The buzzer is activated, producing a tone, when the system identifies an obstacle.

Necessary system components

Arduino UNO :

Arduino Uno

The Arduino Uno is an open-source microcontroller board that is part of the Arduino platform. It is designed for ease of use and is widely used in the maker and hobbyist communities for prototyping and creating various electronic projects.

HC-SR04 ultrasonic Sensor

HC-SR04

The HC-SR04 is an ultrasonic distance measuring sensor module.

SSD1306 screen

The SSD1306 is a popular display controller used in OLED (Organic Light-Emitting Diode) screens. It’s commonly employed in various electronics projects to showcase information on small screens. The SSD1306 controller is compatible with different screen sizes and is often integrated with microcontrollers like Arduino UNO board to display text, graphics, and images.

This screen is used for displaying a alert message if the HC-SR04 sensor detects an obstacle.

LED 

LED

In an obstacle detection system, an LED (Light Emitting Diode) can be used as a visual indicator to provide feedback about the detection status. The LED can be programmed to turn on or off based on whether an obstacle is detected within a certain range.

Resistance (220 ohm)

Résistance

The resistance needed for an LED (Light Emitting Diode) in a circuit is determined by Ohm’s Law, which states that the resistance (R) is equal to the voltage (V) divided by the current (I).

Jumper Wires:

Jumper wires

For making temporary connections and wiring between components.

Breadboard:

Test plate

A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering.

Obstacle detection system wiring diagram

Obstacle detection system wiring diagramObstacle detection system wiring diagram

Attaching the SSD1306 display :

– connect the VCC pin of the display to 5V pin of the Arduino UNO

– connect the GND pin of the display to GND pin of the Arduino UNO

– connect the SDA pin of the display to A4 pin of the Arduino UNO

– connect the SCL pin of the display to A5 pin of the Arduino UNO

Attaching the HC-SR04 sensor :

– Connect the VCC(+) pin of the HC-SR04 ultrasonic sensor to the 3.3V pin on the Arduino UNO board.

– Connect the Trig pin of the HC-SR04 ultrasonic sensor to pin 2 on the Arduino UNO board.

– Connect the Echo pin of the HC-SR04 ultrasonic sensor to pin 3 on the Arduino UNO board.

– Connect the GND(-) pin of the DHT22 sensor to any ground (GND) pin on the Arduino UNO board.

Attaching the buzzer :

– Connect the (+) terminal of buzzer to pin 4 on the Arduino UNO board.

– Connect the (-) terminal of buzzer to GND pin on the Arduino UNO board.

Attaching the red LED :

– Connect the negative terminal (cathode) of each LED to the ground (GND) of the Arduino UNO board.

– Connect a resistor between the pin 5 and the positive terminal (anode) of the LED

Programming the Arduino UNO board

To program an obstacle detection system controlled by Arduino, you’ll need to follow these steps.

1- import this library :Ultrasonic for HC-SR04 sensor

2- import this library : Adafruit_SSD1306 for SSD1306 display

3- Create a new Arduino script and write the following code :

This code continuously monitors the distance using the HC-SR04 sensor, displays the distance on the SSD1306 screen, and triggers the LED and buzzer if an obstacle is detected within a threshold distance (4 cm in this example).

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info