In one of our previous Arduino project, we used the sensor HC-SR04 to allow a robot to see obstacles while moving and to act accordingly. The HC-SR04 is a very popular ultrasonic sensor and you should definitely learn how to make use of it.
This project will be subdivided into two parts. We want to build a device that will sense the distance from a moving object, send that distance to the serial port and display the distance on an LCD screen. And it is important that the distance is in meter so we can easily apprehend and comprehend it.
To make the project simpler we will use an LCD with an I2C converter so we will need just 4 cables to connect it to Arduino. We will also need to add an additional library to the sketch, but worry not! it is easy to download.
Ultrasonic distance sensor
Here are the needed part:
Let’s start with something simple. How do we display a distance on the serial port?
You first have to make the connections as shown on the schematic below. We do not need to add the LCD yet.
This is how it should look like, very simple right? just 4 cables, the Arduino Uno board and the ultrasonic sensor.
And this is what you should see on the serial port
Ok, half of the project is ready, let’s now add an LCD, here is how you should connect it.
Then we have to download the library. You can download it from the Arduino IDE. Simply open Sketch >> Include Library >> Manage Libraries and then find LCD I2C.
The code we have to upload is somewhat similar to the first one at the difference that this time instead of displaying on the serial, we display the values on the LCD.
And There you have it!
Very fun, simple and useful project. I hope you have become a better maker after reading this tutorial. Do not hesitate to show me what you have been able to build in the comment section below.
You might also like:
- Arduino hx711 tutorial
- Arduino magnetic switch
- Best Arduino Kits
- gifts for engineering students
- gifts for engineers
- mpu6050 Arduino projects
- Current sensor Arduino
- Soil Moisture Sensor With Arduino
- Arduino Count up Timer Using the Nokia 5110 LCD
- Arduino Yun: Integrating or Juxtaposing Arduino with Linux
- Arduino Projects: Line Follower Robot
- Arduino RFID Project for Beginners
- Arduino MOSFET Project
- Which Arduino Should You Buy
- What Can You Do With Arduino Boards?
- Great Alternatives to the Arduino Microcontroller
- Arduino Projects: Color Sensor
- Arduino IDE Alternatives
- Arduino Mega vs. Uno
- Arduino Projects: Arduino LCD Display
- Read Arduino Rotary Encoders
- A Selection of the Best Arduino Simulators
- Arduino Projects: IR Receiver
- Arduino Light Sensor Project
- Arduino Projects: Arduino Decibel Meter
- Arduino Stopwatch Project
- Arduino Bluetooth RC Car Project
- Arduino Temperature Logger Project
- Arduino Projects: Arduino 7 Segment Display
- Arduino Projects: Clap ON Clap OFF Light
- Arduino Relay Project
- How to install Arduino Library
- Rain Sensor Arduino Project With Buzzer
- Arduino Projects: RGB LED Arduino
- Arduino Stepper Motor Project
- Arduino Projects: Arduino DC Motor Control
- Best Arduino robot kit
- Arduino 3D Printed Case
- Arduino Projects: Asynchronous LEDs Blink
- Arduino Projects: Ultrasonic Distance Sensor
- Arduino Projects: LED – 4X4X4 LED Cube
- Arduino Car Projects: Build an Obstacle Avoiding Robot With Less Than $30
- Arduino Projects: Servo Potentiometer Control
- Arduino LED Project: Knight Rider
- Arduino Projects: PIR Motion Sensor
- The Difference between Arduino and Raspberry Pi
- Top 9 Books Every Engineer Should Read
- Top Used Sensors for Arduino
- First Hand on the Arduino Uno Board