Arduino Nano-Based Battery-Powered Ultrasonic Distance Meter with Keypad and LCD Display
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an Arduino Nano, an HC-SR04 Ultrasonic Sensor, a 4x4 Keypad, a 16x2 I2C LCD, a 18650 Li-Ion battery, and a Rocker Switch. The circuit is designed to interface these components with the Arduino Nano for various input and output operations.
Component List
Arduino Nano
- Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
HC-SR04 Ultrasonic Sensor
- Description: A sensor used for measuring distance using ultrasonic waves.
- Pins: VCC, TRIG, ECHO, GND
4x4 Keypad (Simulator)
- Description: A matrix keypad used for user input.
- Pins: R1, C4, R2, C2, R3, R4, C1, C3
16x2 I2C LCD
- Description: A 16x2 character LCD display with I2C interface.
- Pins: GND, VCC, SDA, SCL
18650 Li-Ion
- Description: A rechargeable lithium-ion battery.
- Pins: Positive, Negative
Rocker Switch
- Description: A switch used to control the power supply.
- Pins: 1, 2
Wiring Details
Arduino Nano
GND is connected to:
- GND of 16x2 I2C LCD
- GND of HC-SR04 Ultrasonic Sensor
- Negative of 18650 Li-Ion
D2 is connected to R1 of 4x4 Keypad (Simulator)
D3 is connected to R2 of 4x4 Keypad (Simulator)
D4 is connected to R3 of 4x4 Keypad (Simulator)
D5 is connected to R4 of 4x4 Keypad (Simulator)
D6 is connected to C1 of 4x4 Keypad (Simulator)
D7 is connected to C2 of 4x4 Keypad (Simulator)
D8 is connected to C3 of 4x4 Keypad (Simulator)
D9 is connected to C4 of 4x4 Keypad (Simulator)
D10 is connected to TRIG of HC-SR04 Ultrasonic Sensor
D11/MOSI is connected to ECHO of HC-SR04 Ultrasonic Sensor
VIN is connected to pin 2 of Rocker Switch
5V is connected to:
- VCC of 16x2 I2C LCD
- VCC of HC-SR04 Ultrasonic Sensor
A5 is connected to SCL of 16x2 I2C LCD
A4 is connected to SDA of 16x2 I2C LCD
HC-SR04 Ultrasonic Sensor
- VCC is connected to 5V of Arduino Nano
- TRIG is connected to D10 of Arduino Nano
- ECHO is connected to D11/MOSI of Arduino Nano
- GND is connected to GND of Arduino Nano
4x4 Keypad (Simulator)
- R1 is connected to D2 of Arduino Nano
- R2 is connected to D3 of Arduino Nano
- R3 is connected to D4 of Arduino Nano
- R4 is connected to D5 of Arduino Nano
- C1 is connected to D6 of Arduino Nano
- C2 is connected to D7 of Arduino Nano
- C3 is connected to D8 of Arduino Nano
- C4 is connected to D9 of Arduino Nano
16x2 I2C LCD
- GND is connected to GND of Arduino Nano
- VCC is connected to 5V of Arduino Nano
- SDA is connected to A4 of Arduino Nano
- SCL is connected to A5 of Arduino Nano
18650 Li-Ion
- Positive is connected to pin 1 of Rocker Switch
- Negative is connected to GND of Arduino Nano
Rocker Switch
- Pin 1 is connected to Positive of 18650 Li-Ion
- Pin 2 is connected to VIN of Arduino Nano
Code Documentation
Arduino Nano Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino Nano. The setup() function is where you initialize your components and settings, and the loop() function is where the main logic of your program runs repeatedly.