Audio Driver HAT

From Waveshare Wiki
Jump to: navigation, search
Audio Driver HAT
Audio Driver HAT01.jpg

X3_Pi audio codec
I2S
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Introduction

This product is an audio module designed based on Sunrise X3 PI. it adopts ES7210 high-performance four-channel encoding chip and ES8156 high-performance stereo audio decoding chip. It is controlled by the I2C interface and audio is transmitted by the I2S interface. The onboard standard 3.5mm headphone jack can play music through external headphones. There is a high-quality MEMS silicon microphone at the left and right corners of the board, which can record in stereo.

Feature

  • Power supply: 3.3V
  • Audio encoder: ES7210
  • Audio decoder: ES8156
  • Control interface: I2C
  • Audio interface: I2C
  • ADC signal-to-noise ratio: 102dB
  • DAC signal-to-noise ratio: 110dB

Hardware Connection

Pin Function X3_Pi Pin (BCM) Description
3.3V 3.3V 3.3V power input
GND GND Ground
SDA P2 I2C data input
SCL P3 I2C clock input
MCLK0 P4 I2S0 master clock input
BCLK0 P18 I2S0 bit clock input
LRCLK0 P19 I2S0 sub (frame) clock input
SDIO0 P20 I2S0 data input/output
MCLK1 P26 I2S1 master clock input
BCLK1 P0 I2S1 bit clock input
LRCLK1 P1 I2S1 sub (frame) clock input
SDIO1 P21 I2S1 data input/output

User Manual

Boxs-Intelligent Speech

Environment Installation

Install TogetherROS

sudo apt update
sudo apt install tros

Check whether TogetherROS is successfully installed.

ls /opt/

Audio Driver HAT10.jpg
Install the intelligent speech algorithm package.

sudo apt update
sudo apt install tros-hobot-audio

Get Start To Use

It is recommended to run the following commands as the super user, otherwise, an error may occur.

sudo su
#Enter the password

Test the hardware environment.

i2cdetect -r -y 0

Audio Driver HAT11.jpg
Configure TogetherROS environment.

source /opt/tros/setup.bash

Copy the configuration files needed to run the example from the installation path of TogetherROS. (This step can be skipped if you copied it before.)

cp -r /opt/tros/lib/hobot_audio/config/ .

Load the audio driver, and it only needs to be loaded once after booting.

bash config/audio.sh

Booting.

ros2 launch hobot_audio hobot_audio.launch.py

Audio Driver HAT12.jpg
Modify the voice input, just write in the corresponding position according to the format.

vim config/hrsc/cmd_word.json

Audio Driver HAT13.jpg

Normal Recording And Playback

Hardware test.

sudo i2cdetect -r -y 0

Audio Driver HAT11.jpg
Load driver audio codec and x3 audio framework driver.

sudo modprobe es7210
sudo modprobe es8156
sudo modprobe hobot-i2s-dma
sudo modprobe hobot-cpudai
sudo modprobe hobot-snd-7210 snd_card=5

Check if loading is successful.

ls /dev/snd

Audio Driver HAT15.JPG
Recording:

#Collect the recording of the 4-channel microphone for 5 seconds:
sudo tinycap ./4chn_test.wav -D 0 -d 0 -c 4 -b 16 -r 48000 -p 512 -n 4 -t 5
#Collect the recording of the 2-channel microphone for 5 seconds:
sudo tinycap ./2chn_test.wav -D 0 -d 0 -c 2 -b 16 -r 48000 -p 512 -n 4 -t 5

Playing:

#Play 2-channel audio (direct playback of 4-channel recordings is not supported):
sudo tinyplay ./2chn_test.wav -D 0 -d 1

Resource

Schematic Diagram

Chip

FAQ




Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)