The configuration options for the audio module are: Codec2 Enabled, PTT GPIO, Audio Bitrate/Codec Mode, I2S Word Select, I2S Data IN, I2S Data OUT, and I2S Clock. Configuring the audio module requires sending an admin message using the ConfigModule.Audio protobuf.
This experimental module allows you to connect a digital I2S microphone and speaker to any ESP32 device that features an SX128x radio and operates in the 2.4 GHz ISM Band. The Sub-1GHz bands are insufficient for supporting continuous audio packets on the mesh, even in the Short and Fast modes. Currently, the only supported devices are the LilyGo TLora 2.1-1.8 and TLora T3S3 boards. The module is designed for channels with a bandwidth of 2 kbit/sec or greater.
Required additional hardware:
-
Max98357 - I2S 3W Class D Amplifier
-
MSM261S4030H0 - I2S MEMS Low Noise Single Microphone
Audio Module Configuration Values
-
Codec2 Enabled: Enables the audio module.
-
PTT GPIO: The GPIO to use for the Push-To-Talk button. The default setting is GPIO 39 on the ESP32.
-
Audio Bitrate/Codec Mode: The bitrate to use for audio. The default is CODEC2_700B. The available options are: CODEC2_DEFAULT CODEC2_3200 CODEC2_2400 CODEC2_1600 CODEC2_1400 CODEC2_1300 CODEC2_1200 CODEC2_700B CODEC2_700
I2S Word Select: The GPIO to use for the WS signal in the I2S interface.
I2S Data IN: The GPIO to use for the SD signal in the I2S interface.
I2S Data OUT: The GPIO to use for the DIN signal in the I2S interface.
I2S Clock: The GPIO to use for the SCK signal in the I2S interface.
NOTE: These pins comprise an I2S digital audio interface. Meshtastic operates in monoaural mode, where the software designates the logical 'LEFT' stereo channel for the microphone and the logical 'RIGHT' stereo channel for the speaker. Therefore, configure your breakouts accordingly. Audio is half-duplex, allowing us to reuse some of the pins for a bi-directional configuration. There is no default pin assignment; setting these is mandatory.
Audio Module Configuration Client
Android
Audio config options are available for Android.
-
Open the Meshtastic App.
-
Navigate to: Vertical Ellipsis (3 dots in the top right) > Radio Configuration > Audio.
Apple
Audio module config is not available on iOS, iPadOS, and macOS.
CLI
All audio module config options are available in the Python CLI. Example commands are below:
| Setting | Acceptable Values | Default |
| audio.codec2_enabled | true, false | FALSE |
| audio.ptt_pin | GPIO Pin Number 1-39 | Default of 39 is Unset |
| audio.bitrate | CODEC2_DEFAULT CODEC2_3200 CODEC2_2400 CODEC2_1600 CODEC2_1400 CODEC2_1300 CODEC2_1200 CODEC2_700B CODEC2_700 | CODEC2_DEFAULT |
| audio.i2s_ws | GPIO Pin Number 1-34 | no Default |
| audio.i2s_sd | GPIO Pin Number 1-39 | no Default |
| audio.i2s_din | GPIO Pin Number 1-34 | no Default |
| audio.i2s_sck | GPIO Pin Number 1-34 | no Default |
Enable / Disable Module
| meshtastic --set audio.codec2_enabled true meshtastic --set audio.codec2_enabled false |
Set WS to GPIO pin number 7
| meshtastic --set audio.i2s_ws 7 |
Set DIN to GPIO pin number 28
| meshtastic --set audio.i2s_din 28 |
Set PTT to GPIO pin number 37
| meshtastic --set audio.ptt_pin 37 |
Set Codec Bitrate
| meshtastic --set audio.bitrate CODEC2_DEFAULT meshtastic --set audio.bitrate CODEC2_1400 |
NOTE: Since the device will reboot after each command is sent via the CLI, it is recommended to chain together commands as one when setting multiple values in a config section. For example:
| meshtastic --set audio.codec2_enabled true --set audio.bitrate CODEC2_1400 |
Web
All audio module config options are available in the Web UI.
warning
GPIO access is fundamentally dangerous because invalid options can physically damage or destroy your hardware. Ensure that you fully understand the schematic for your particular device before attempting this, as we do not offer a warranty. Use at your own risk.
This module requires attaching a peripheral accessory to your device; it will not function without one.
