Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Ultrasonic Distance Measurement with I2C LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Ultrasonic Distance Measurement with I2C LCD Display

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller with an I2C LCD 16x2 screen and an HC-SR04 Ultrasonic Sensor. The Arduino UNO serves as the central processing unit, controlling the LCD screen via the I2C communication protocol and interfacing with the ultrasonic sensor to potentially measure distance. The LCD screen is used to display messages, and the ultrasonic sensor can be used for proximity detection or range finding. The circuit is powered by the Arduino's 5V output, which is distributed to the other components.

Component List

Arduino UNO

I2C LCD 16x2 Screen

HC-SR04 Ultrasonic Sensor

Wiring Details

Arduino UNO

I2C LCD 16x2 Screen

HC-SR04 Ultrasonic Sensor

Documented Code

/*
 * This Arduino sketch initializes an I2C 16x2 LCD screen and displays
 * the message 'Hello' on it. The LCD is connected to the Arduino UNO
 * via the I2C interface, with SDA connected to A4 and SCL connected to A5.
 */

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Initialize the LCD
  lcd.begin();
  // Turn on the backlight
  lcd.backlight();
  // Print 'Hello' to the LCD
  lcd.setCursor(0, 0);
  lcd.print("Hello");
}

void loop() {
  // Nothing to do here
}

Filename: sketch.ino

Description: The code initializes the I2C LCD screen and displays the message "Hello" on it. The setup() function is called once when the program starts and is used to initialize the LCD with the begin() method, turn on the backlight, and set the cursor to the beginning of the screen before printing "Hello". The loop() function runs continuously after setup() finishes but is left empty as there is no need for repeated actions in this simple example.