Popularizing digital and analog electronic knowledge, promoting education for the nation.
Hello everyone, in this episode of Maker e Workshop, we will teach you how to use the DEplayer mini module, Arduino, LCD1602, and ultrasonic module to create an ultrasonic distance measurement voice broadcast system. We will explain it in four parts.
Part 1: Arduino
When it comes to Arduino, I’m sure everyone is familiar with it. Arduino is a convenient, flexible, and easy-to-use open-source electronic prototyping platform. It includes hardware (various models of Arduino boards) and software (Arduino IDE). It was developed by a European team in the winter of 2005. Members include Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis, and Nicholas Zambetti.
It is built on an open-source simple I/O interface board and has a development environment similar to Java and C language called Processing/Wiring. It mainly consists of two main parts: the hardware part is the Arduino circuit board used for circuit connections; the other is the Arduino IDE, the programming development environment on your computer. You just need to write the program code in the IDE, upload the program to the Arduino circuit board, and the program will tell the Arduino circuit board what to do.
Part 2: Ultrasonic Module
There are many types of ultrasonic modules, and today we will explain the advantages and applications of the HC-SR04 module, as well as its working principle. The HC-SR04 module has stable performance and accurate distance measurements, with high precision and a small blind spot. It is mainly used in robot obstacle avoidance, object distance measurement, liquid level detection, and parking space detection.
This module has 4 pins, VCC and GND provide power to the module, using the IO port to trigger distance measurement with TRIG, giving at least 10Us high-level signal. The module automatically sends 8 pulses of 40kHz and detects if there is a signal returned. If a signal is returned, it outputs a high level through the IO port ECHO, and the duration of the high level is the time it takes for the ultrasonic wave to travel to and back. The tested distance is calculated as (high level time * sound speed (340M/S)) / 2;
Part 3: LCD1602
To understand 1602, we first need to understand its pin function diagram. Pin 1: GND is the power ground, Pin 2: VCC connects to the positive terminal of the 5V power supply, Pin 3: V0 is the contrast adjustment terminal for the LCD. When connected to the positive power supply, the contrast is weakest, and when connected to ground, the contrast is highest (if the contrast is too high, it will produce “ghosting”; you can adjust the contrast using a 10K potentiometer). Pin 4: RS is the register select, when high level (1) selects the data register, and when low level (0) selects the instruction register. Pin 5: RW is the read/write signal line, high level (1) for read operation, low level (0) for write operation.Pin 6: E (or EN) is the enable pin, high level (1) for reading information, and falling edge executes the instruction. Pins 7-14: D0-D7 are 8-bit bidirectional data pins. Pins 15-16: are empty pins or backlight power supply. Pin 15 is the positive terminal of the backlight, and pin 16 is the negative terminal of the backlight. Characteristics include 3.3V or 5V operating voltage, adjustable contrast, and an internal reset circuit providing various control commands such as clear screen, character flashing, cursor blinking, display shift, and more.
In this setup, we use pins 1, 2, 3, 5, 10, 11, 12, and 13, which connect to the Arduino board.
Pin 1 and 2 of 1602 connect to the GND and VCC of the Arduino board, Pin 3 and Pin 5 connect to pins 13 and 12 of the Arduino board, 10, 11, 12, and 13 connect to pins 2, 3, 4, and 5 of the board.
Part 4: DEplayer mini Module
DFPlayer Mini is a compact and inexpensive MP3 module that can be directly connected to a speaker.
First, let’s understand its pin diagram. Looking counterclockwise from the left, Pin 1 connects to VCC, the power input for the module, Pin 2 connects to RX, the serial data input, Pin 3 connects to TX, the serial data output, Pins 4 and 5 are DAC_R and DAC_L, which refer to the audio output for the right and left channels, respectively, and can drive headphones and amplifiers. Pins 6 and 8 are SPK2 and SPK1, which can be used to drive speakers less than 3w. Pins 9 and 11 are IO1 and IO2, which are low-level trigger pins that default to the previous and next tracks, respectively. Pin 7 and Pin 10 are ground. Pins 12 and 13 are ADKEY1 and ADKEY2, also low-level triggered, which default to the first and fifth tracks when triggered. Pins 14 and 15 are USB+ and USB-, which can be used to connect to USB drives and USB ports. Pin 16 indicates the Busy state, which outputs low level when there is audio and high level when there is no audio.
Let’s first play a few songs in IO mode, here is the schematic of IO mode.
Physical playback.
In the ultrasonic distance measurement system, we only use pins 1, 2, 3, 6, 7, 8, and the connection method with the Arduino is shown in the figure:
We will combine these four modules, upload the program to the board, and we will see the distance measured by the ultrasonic wave displayed on the 1602 and corresponding voice broadcasted.
We can see that when the distance between the wooden block and the ultrasonic wave changes, the corresponding LCD1602 will display the corresponding distance, and the DEplayer mini module will broadcast it, which is very fun.
Alright, that’s it for this ultrasonic distance measurement voice broadcast system. Friends who are interested can try making it; a detailed video tutorial will be attached in the next episode.
Alright, this tutorial ends here. For more exciting video tutorials on electronic production and DIY electronics, please follow: Maker e Workshop.
Fans, please click on the last advertisement on the WeChat page; your clicks can help us earn advertising revenue, support us, and give us the motivation to continue creating. At the same time, you can ask us for the program of this voice broadcast system. Thank you all!
Leave a Comment
Your email address will not be published. Required fields are marked *