FPGA | PYNQ-Z2 uses the voice broadcast module

This article describes how to use PYNQ to connect an external voice broadcast module

First post a physical map:
Physical connection

Introduction to Voice Broadcasting Module

Choose the YS-M3 voice playback module, which is the one shown in the figure below:
Voice broadcast module
This module is an MP3 playback module that integrates hard coding of MP3 and MAV, comes with a 3W power amplifier, can adjust the volume, and supports one-key triggering and coding triggering. Work mode, can trigger 31 songs at most, support 16G maximum memory. Before using, you need to put the song to be played in the TF card of the voice broadcast module in the format shown in the figure.
File placement
For example, here I am replacing the original 1-8 and 10th with the voice to be played.

Hardware connection

Because you need to use code to control the voice playback, select the encoding trigger mode:
Encoding mode
According to the instructions of the voice broadcast, we need three GND, one 5V, and five GPIO ports. For the introduction of PYNQ GPIO ports, please refer to this blog . Here directly use the Arduino interface on PYNQ as a GPIO for coding trigger, of course, you can also use the RPI interface. The connection method is as follows:
Insert picture description here
Insert picture description here
Use a Pmod's GND to connect to A10:
Pmod

Insert picture description here
Which pins can be configured as GPIO ports are mentioned in the PYNQ user manual. I will attach the voice broadcast module and the resource address of the PYNQ user manual at the end of the article (you can find it online).

Software debugging

Pin correspondence
We need to use the Python class in the picture above to control the reading and writing of Arduino IO. The index in the parameter needs attention, because I use the 5 pins A1-A5, and the A0-A5 pins in the document correspond to 15- 19.

Next, start jupyter notebook to write the code and
jupyter1
jupyter2
run it to hear the song you want (the sound quality of the two speakers is actually pretty good)

There are several considerations when writing code:

  1. The voice broadcast module uses reverse coding, 11110 corresponds to the first song, 11101 corresponds to the second song...and so on
  2. When playing multiple songs continuously, write the corresponding pin to 0 and then restore it to 1, you need to add a little delay in the middle. This is the case in PYNQ, otherwise errors will occur, and it is not necessary in the microcontroller (maybe What bug).
    If the end of the second song above is played, I write it like this:
A[1].write(1)
A[2].write(1)
# 在播放下一首时可能就会遇到错误

Reference

PYNQ-Z2 User Manual

YS-M3 Voice Play Module Information

Guess you like

Origin blog.csdn.net/qq_43580646/article/details/111713225