Skip to content

Commit ac1c6e9

Browse files
authored
Merge pull request #298 from 092vk/axon: audio: Microphone
axon: audio: analog microphone: Added config and usage doc
2 parents cb55c7f + 1854ba0 commit ac1c6e9

2 files changed

Lines changed: 271 additions & 5 deletions

File tree

77.6 KB
Loading
Lines changed: 271 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,276 @@
1-
2-
31
#################
42
Analog MIC
53
#################
64

7-
.. note::
5+
.. image:: /_static/images/rk3588-axon/axon-mic.webp
6+
:width: 70%
7+
8+
The Analog MIC input on the Axon board provides a flexible interface for acoustic sensing using a broad class of analog microphone technologies. Axon provides support for mics of different types and companies at the same time preserving dynamic range while minimizing noise.
9+
10+
Wiring and connectors
11+
----------------------
12+
13+
* For Single ended interface mic:
14+
15+
* Mic output → ANALOG_MIC pin (+)
16+
* Mic ground → GND (GPIO GND) on axon header
17+
18+
* For Differential interface mic:
19+
20+
* Mic output → ANALOG_MIC pin (+)
21+
* Mic ground → ANALOG_MIC pin (-)
22+
23+
How to Setup
24+
------------
25+
26+
Follow these steps to connect and use an analog microphone with the Axon board.
27+
28+
1. Connect the microphone
29+
^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
Connect your microphone to the Axon board:
32+
33+
* If you are using single interface mic, just connect MIC_OUT to ANALOG_MIC PIN (+) and Microphone ground → Axon GND (Connect to GPIO GND)
34+
* Otherwise if you are using differential mic, connect MIC_OUT to ANALOG_MIC PIN (+) and MIC_GND to ANALOG_MIC PIN (-)
35+
36+
Refer to the Axon pinout documentation for exact pin locations `Axon Pinouts <https://docs.vicharak.in/vicharak_sbcs/axon/peripherals/gpio/#axon-gpios-header>`_
37+
38+
2. Detect the microphone
39+
^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
Boot the Axon board and open a terminal.
42+
43+
Run:
44+
45+
.. code-block:: bash
46+
47+
arecord -l
48+
49+
This will list available recording devices.
50+
51+
Example output:
52+
53+
.. code-block:: text
54+
55+
vicharak@vicharak:~$ aplay -l
56+
**** List of PLAYBACK Hardware Devices ****
57+
card 0: rockchipes8388 [rockchip-es8388], device 0: dailink-multicodecs ES8323 HiFi-0 [dailink-multicodecs ES8323 HiFi-0]
58+
Subdevices: 1/1
59+
Subdevice #0: subdevice #0
60+
card 1: rockchipdp0 [rockchip-dp0], device 0: rockchip-dp0 spdif-hifi-0 [rockchip-dp0 spdif-hifi-0]
61+
Subdevices: 1/1
62+
Subdevice #0: subdevice #0
63+
card 2: rockchipdp1 [rockchip-dp1], device 0: rockchip-dp1 spdif-hifi-0 [rockchip-dp1 spdif-hifi-0]
64+
Subdevices: 1/1
65+
Subdevice #0: subdevice #0
66+
card 3: rockchiphdmi0 [rockchip-hdmi0], device 0: rockchip-hdmi0 i2s-hifi-0 [rockchip-hdmi0 i2s-hifi-0]
67+
Subdevices: 1/1
68+
Subdevice #0: subdevice #0
69+
card 4: rockchiphdmi1 [rockchip-hdmi1], device 0: rockchip-hdmi1 i2s-hifi-0 [rockchip-hdmi1 i2s-hifi-0]
70+
Subdevices: 1/1
71+
Subdevice #0: subdevice #0
72+
73+
* Look for rockchipes8388, it contains **ES8388** which is an analog audio codec chip, which handles: audio.
74+
* Note down the device and card number to be used in below commands
75+
76+
* In this example: ``card 0, device 0 → plughw:0,0`` is used
77+
78+
3. Record Audio from Microphone
79+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80+
81+
Prerequisites
82+
"""""""""""""
83+
84+
Ensure:
85+
86+
* Microphone is properly connected to the SBC
87+
* ALSA utilities are installed
88+
89+
Install if needed:
90+
91+
.. code-block:: bash
92+
93+
sudo apt install alsa-utils
94+
95+
Step 1: Record Audio
96+
""""""""""""""""""""
97+
98+
Record audio using:
99+
100+
.. code-block:: bash
101+
102+
arecord -D plughw:0,0 -f S16_LE -r 16000 -c 1 test.wav
103+
104+
Parameter Explanation
105+
,,,,,,,,,,,,,,,,,,,,,
106+
107+
.. list-table::
108+
:header-rows: 1
109+
:widths: 20 60
110+
111+
* - Parameter
112+
- Meaning
113+
* - ``-D plughw:0,0``
114+
- Select microphone device
115+
* - ``-f S16_LE``
116+
- 16-bit signed little-endian format
117+
* - ``-r 16000``
118+
- Sampling rate (16 kHz)
119+
* - ``-c 1``
120+
- Mono recording
121+
* - ``test.wav``
122+
- Output file
123+
124+
Step 2: Stop Recording
125+
""""""""""""""""""""""
126+
127+
Press:
128+
129+
.. code-block:: text
130+
131+
Ctrl + C
132+
133+
The audio will be saved as ``test.wav``
134+
135+
Step 3: Playback Recorded Audio
136+
"""""""""""""""""""""""""""""""
137+
138+
Verify recording:
139+
140+
.. code-block:: bash
141+
142+
aplay test.wav
143+
144+
Recommended Settings for Speech Applications
145+
"""""""""""""""""""""""""""""""""""""""""""""
146+
147+
Use:
148+
149+
.. code-block:: bash
150+
151+
arecord -D plughw:0,0 -f S16_LE -r 16000 -c 1 speech.wav
152+
153+
This configuration is ideal for:
154+
155+
* Speech recognition
156+
* Voice assistants
157+
* Embedded AI applications
158+
159+
160+
Notes
161+
,,,,,
162+
163+
* Use ``plughw`` instead of ``hw`` to allow automatic format conversion
164+
* 16 kHz mono is sufficient for most voice applications
165+
* Higher sample rates (e.g., 44100 Hz) may be used for higher quality audio
166+
167+
Example:
168+
169+
.. code-block:: bash
170+
171+
arecord -D plughw:0,0 -f S16_LE -r 44100 -c 2 audio.wav
172+
173+
174+
Troubleshooting
175+
---------------
176+
177+
Quick Diagnostic Commands
178+
^^^^^^^^^^^^^^^^^^^^^^^^^^
179+
180+
List supported hardware parameters:
181+
182+
.. code-block:: bash
183+
184+
arecord -D hw:0,0 --dump-hw-params
185+
186+
Check microphone levels:
187+
188+
.. code-block:: bash
189+
190+
alsamixer
191+
192+
Press ``F4`` → Capture devices
193+
194+
Increase capture volume if needed.
195+
196+
---
197+
198+
No audio detected
199+
^^^^^^^^^^^^^^^^^
200+
201+
Check the following:
202+
203+
* Microphone is connected correctly
204+
* Ground connection is secure
205+
* Microphone output is connected to MIC input
206+
* Device is visible using:
207+
208+
.. code-block:: bash
209+
210+
arecord -l
211+
212+
* Capture volume is not muted:
213+
214+
.. code-block:: bash
215+
216+
alsamixer
217+
218+
Press F4 and increase Capture volume.
219+
220+
---
221+
222+
Low audio volume
223+
^^^^^^^^^^^^^^^^
224+
225+
Possible solutions:
226+
227+
* Increase microphone gain using:
228+
229+
.. code-block:: bash
230+
231+
alsamixer
232+
233+
* Use a microphone module with built-in amplifier
234+
* Move closer to the microphone
235+
236+
---
237+
238+
Excessive noise or interference
239+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
240+
241+
Check the following:
242+
243+
* Ensure proper grounding
244+
* Keep microphone wires short
245+
* Avoid routing microphone wires near power or digital signal lines
246+
* Use shielded cables if necessary
247+
248+
---
249+
250+
Hum or buzzing sound
251+
^^^^^^^^^^^^^^^^^^^^
252+
253+
Possible causes:
254+
255+
* Ground loop issues
256+
* Poor shielding
257+
* Electrical interference from nearby components
258+
259+
Solutions:
260+
261+
* Ensure common ground between microphone and Axon
262+
* Use shielded microphone cable
263+
* Keep microphone away from power sources and high-frequency components
264+
265+
---
266+
267+
Verification Checklist
268+
----------------------
269+
270+
Ensure the following:
8271

9-
**Documentation coming soon!**
10-
This section will be updated shortly with detailed instructions and information. Stay tuned for more!
272+
* Microphone is securely connected
273+
* Microphone appears in ``arecord -l``
274+
* Audio recording works using ``arecord``
275+
* Audio playback works using ``aplay``
276+
* Capture volume is properly set using ``alsamixer``

0 commit comments

Comments
 (0)