Arduino Mega 2560 Dual Ultrasonic Sensor Distance Measurement System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves the use of two HC-SR04 Ultrasonic Sensors connected to an Arduino Mega 2560 microcontroller. The sensors are powered through a terminal block and share common ground connections. The Arduino Mega 2560 is programmed to interact with the sensors, likely for distance measurement purposes.
Component List
HC-SR04 Ultrasonic Sensor
- Description: Ultrasonic distance sensor
- Pins: VCC, TRIG, ECHO, GND
GND
- Description: Ground connection
- Pins: GND
Terminal Block KTB1 20A 6P
- Description: Terminal block for power distribution
- Pins: 1, 2, 3, 4, 5, 6
Arduino Mega 2560
- Description: Microcontroller board
- Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, PWM pins, AREF, SDA, SCL
Wiring Details
HC-SR04 Ultrasonic Sensor 1
- VCC connected to Terminal Block KTB1 20A 6P Pin 1
- TRIG connected to Arduino Mega 2560 Pin D5 PWM
- ECHO connected to Arduino Mega 2560 Pin D4 PWM
- GND connected to GND
HC-SR04 Ultrasonic Sensor 2
- VCC connected to Terminal Block KTB1 20A 6P Pin 1
- TRIG connected to Arduino Mega 2560 Pin D7 PWM
- ECHO connected to Arduino Mega 2560 Pin D6 PWM
- GND connected to GND
GND
- GND connected to:
- HC-SR04 Ultrasonic Sensor 1 GND
- HC-SR04 Ultrasonic Sensor 2 GND
- Arduino Mega 2560 GND
Terminal Block KTB1 20A 6P
- Pin 1 connected to HC-SR04 Ultrasonic Sensor 1 VCC and HC-SR04 Ultrasonic Sensor 2 VCC
- Pin 6 connected to Arduino Mega 2560 5V
Arduino Mega 2560
- Pin D5 PWM connected to HC-SR04 Ultrasonic Sensor 1 TRIG
- Pin D4 PWM connected to HC-SR04 Ultrasonic Sensor 1 ECHO
- Pin D7 PWM connected to HC-SR04 Ultrasonic Sensor 2 TRIG
- Pin D6 PWM connected to HC-SR04 Ultrasonic Sensor 2 ECHO
- GND connected to GND
- 5V connected to Terminal Block KTB1 20A 6P Pin 6
Code Documentation
Arduino Mega 2560 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 Mega 2560. The setup() function is where you initialize your sensors and other components, and the loop() function is where you place the main logic that runs repeatedly.
Additional Documentation
This section is reserved for any additional documentation or notes that may be required for understanding the circuit or the code.