Arduino-Controlled Ultrasonic Distance Measurement with Audio Feedback
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary of the Circuit
This circuit integrates an Arduino UNO microcontroller with an HC-SR04 Ultrasonic Sensor and a DFPlayer MINI module to create a system capable of detecting distances and playing audio files. The system is powered through the Arduino UNO, which also serves as the central processing unit for controlling the ultrasonic sensor and sending commands to the DFPlayer MINI. The DFPlayer MINI is connected to a loudspeaker for audio output.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Purpose: Acts as the central processing unit for the circuit, controlling the ultrasonic sensor and the DFPlayer MINI module.
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor capable of measuring distances by emitting ultrasonic waves and measuring the time taken for the echo to return.
- Purpose: Used to detect the distance to objects in front of the sensor.
DFPlayer MINI
- Description: A small and low-cost MP3 module that can directly play MP3 files from a microSD card.
- Purpose: Used to play audio files in response to sensor readings or other triggers.
Loudspeaker
- Description: An electroacoustic transducer that converts an electrical audio signal into a corresponding sound.
- Purpose: Outputs the audio signals from the DFPlayer MINI.
Wiring Details
Arduino UNO
- 5V connected to:
- HC-SR04 Ultrasonic Sensor VCC
- DFPlayer MINI VCC
- GND connected to:
- HC-SR04 Ultrasonic Sensor GND
- DFPlayer MINI GND
- D12 connected to DFPlayer MINI TX
- D11 connected to DFPlayer MINI RX
- D10 connected to HC-SR04 Ultrasonic Sensor ECHO
- D9 connected to HC-SR04 Ultrasonic Sensor TRIG
HC-SR04 Ultrasonic Sensor
- VCC connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
- ECHO connected to Arduino UNO D10
- TRIG connected to Arduino UNO D9
DFPlayer MINI
- VCC connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
- TX connected to Arduino UNO D12
- RX connected to Arduino UNO D11
- SPK1 connected to Loudspeaker pin2
- SPK2 connected to Loudspeaker pin1
Loudspeaker
- pin1 connected to DFPlayer MINI SPK2
- pin2 connected to DFPlayer MINI SPK1
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Additional Notes (documentation.txt)
No additional code documentation was provided.