Microphone (MAX9814, INMP441) + ASI Biont: Voice-Driven Automation with an AI Agent

Voice is the most natural interface humans have. Yet most IoT voice systems rely on proprietary cloud bridges that force your microphone into a closed ecosystem. ASI Biont flips the model: the AI agent comes to your hardware. You plug a MAX9814 or INMP441 into an ESP32, and the AI agent helps you read, interpret, and act on audio data — without a manual management panel. You simply describe your setup in a chat dialog, and the agent writes the integration code for you.

This guide explains how to connect these two popular microphone modules to ASI Biont, which transport to choose, and how to build real voice-control scenarios for smart homes, industrial controllers, and office workflows.

1. Why Pair an Analog and Digital Microphone with an AI Agent?

The MAX9814 is a low-cost analog electret microphone amplifier with automatic gain control (AGC), producing an analog voltage proportional to sound pressure. The INMP441 is a digital I2S MEMS microphone that outputs a pulse-density-modulated (PDM) signal converted to I2S frames. Both are common in ESP32 projects because the ESP32 has both a multi-channel ADC and a hardware I2S peripheral.

Pairing them with an AI agent adds a layer of interpretation: raw audio becomes commands, alerts, or structured data. ASI Biont can run speech recognition, keyword detection, or simple energy analysis on the incoming stream, then trigger automations through MQTT, Modbus, or HTTP.

2. ASI Biont Connectivity: How the Agent Talks to Your Hardware

ASI Biont supports a wide range of industrial and IoT protocols: COM ports via a Hardware Bridge (bridge.py), MQTT, Modbus/TCP, SSH, HTTP API/WebSocket, OPC-UA, Siemens S7, BACnet, EtherNet/IP, CAN bus, gRPC, CoAP, and a universal execute_python fallback. For microphones, the practical options are:

Transport Use case Latency
COM port (UART) Wired, low-latency audio/feature stream from ESP32 to PC 1–5 ms
MQTT over Wi-Fi Wireless, broker-based, easy to integrate with home automation 10–50 ms
execute_python Any custom code, direct polling or one-shot processing Variable

The Hardware Bridge is downloaded from the ASI Biont dashboard. Launch it with --token=XXX --ports=COM3 --baud 115200 --rate=10. The bridge exposes the COM port to the agent, which reads and writes through industrial_command().

3. Selecting the Right Transport

For a fixed installation — e.g., a conference room mic connected to a PC — the COM port is best because it avoids Wi-Fi packet loss and jitter. For a battery-powered ESP32 in a plant, MQTT over Wi-Fi is simpler to scale. There is no built-in preference in ASI Biont; the agent chooses a transport based on your description of the physical setup.

4. Reference Architecture

+----------------+    analog/I2S    +----------------+    UART/MQTT    +-------------------+

| MAX9814/INMP441| <---------------> |   ESP32        | <--------------> |  ASI Biont agent  |
| microphone     |   (3 wires/4)     | (ADC or I2S)   |     (bridge)    | (AI + automation) |
+----------------+                   +----------------+                 +-------------------+

The ESP32 captures audio frames, optionally computes features like volume or zero-crossing rate, and forwards them to ASI Biont. The agent then runs a speech-to-text model or a custom keyword matcher and executes the resulting intent.

5. Wiring MAX9814 to ESP32

The MAX9814 has three output pins: VDD, GND, and OUT. It typically operates at 2.7–5.5 V and outputs up to 2 Vpp. Connect it to any ADC-capable GPIO on the ESP32.

MAX9814 pin ESP32 pin Note
VDD 3.3 V Use decoupling cap of 100nF close to VDD
GND GND Common ground
OUT GPIO 34 (ADC1_CH6) ADC1 pins work with MicroPython ADC

For reliable readings, set the ADC’s input attenuation to 11 dB so the full analog audio swing fits within the 0–3.3 V range. See the MAX9814 datasheet for the full electrical specification.

6. Wiring INMP441 to ESP32

The INMP441 is an I2S MEMS microphone. Its output is a 24-bit two’s-complement sample at up to 48 kHz. You need four signals: SCK (bit clock), WS (word select), SD (data), and L/R (channel selection). Connect:

INMP441 pin ESP32 pin
SCK GPIO 26 (I2S BCLK)
WS GPIO 25 (I2S LRCLK)
SD GPIO 33 (I2S DIN)
L/R GND (left channel)
VDD 3.3 V
GND GND

The L/R pin selects which I2S frame the mic uses. Tying it to GND outputs audio on the left channel; tying it to VDD outputs on the right. For a single microphone, either works as long as your code decodes the correct channel. See the INMP441 datasheet for complete specs.

7. MicroPython Code: Reading MAX9814 via ADC

On MicroPython for ESP32, the machine.ADC class provides fast sampling:

from machine import Pin, ADC
import time

mic = ADC(Pin(34), atten=ADC.ATTN_11DB)
mic.width(ADC.WIDTH_12BIT)

while True:
    sample = mic.read()  # 0..4095
    # publish sample as JSON over MQTT or send over UART
    time.sleep_ms(10)

Because while True loops inside ASI Biont’s execute_python are limited to 30 seconds, this loop runs on the ESP32, not on the agent. The ESP32 is responsible for continuous acquisition; ASI Biont only receives aggregated data or commands.

8. MicroPython Code: Reading INMP441 via I2S

MicroPython includes an I2S class for ESP32. The INMP441 is most stable when configured as 32-bit stereo, left channel, 16 kHz sample rate:

from machine import I2S, Pin
import time

i2s = I2S(0, sck=Pin(26), ws=Pin(25), sd=Pin(33),
          mode=I2S.RX, bits=32, format=I2S.STEREO, rate=16000)
buffer = bytearray(10_000)

while True:
    n = i2s.readinto(buffer)
    print(buffer[:n])  # pass to UART or MQTT

The raw I2S frames are little-endian. To reduce bandwidth, compute a short-window RMS energy in MicroPython and send that number instead of the whole waveform.

9. Publishing Audio Features over MQTT

The simplest integration is to send extracted features — volume, zero-crossing rate, or keyword confidence — rather than raw audio. On the ESP32, use umqtt.simple:

from umqtt.simple import MQTTClient
import json, time
from machine import Pin, ADC

client = MQTTClient("esp32mic", "192.168.1.100")
client.connect()
mic = ADC(Pin(34), atten=ADC.ATTN_11DB)
mic.width(ADC.WIDTH_12BIT)

while True:
    samples = [mic.read() for _ in range(200)]
    rms = int((sum(s*s for s in samples) / len(samples)) ** 0.5)
    client.publish("home/mic/level", json.dumps({"rms": rms}))
    time.sleep_ms(500)

ASI Biont can be the MQTT broker client. The AI agent subscribes to home/mic/#, decodes the JSON, and checks if the RMS exceeds a threshold to trigger an alert or voice command.

10. Streaming Raw Audio over UART to the Hardware Bridge

If your ESP32 is connected to the host machine via USB-UART, use the Hardware Bridge to expose the COM port. The bridge reads serial data and forwards it to ASI Biont. On the ESP32, send a fixed-size header plus audio block:

import ustruct, time
from machine import UART, Pin, ADC

uart = UART(2, baudrate=115200)
mic = ADC(Pin(34), atten=ADC.ATTN_11DB)
mic.width(ADC.WIDTH_12BIT)

while True:
    block = [mic.read() for _ in range(128)]
    uart.write(ustruct.pack('=BH', 0xAA, 128) + bytes(block))
    time.sleep_ms(8)

On the ASI Biont side, the agent calls industrial_command() with a command string that the bridge parses to read a block. Since the exact command payload depends on the bridge version, the AI generates it from the protocol documentation. The key point: the agent manages the binary framing and returns structured data to the chat.

11. ASI Biont Side: Receiving Data and Running Speech Recognition

Once audio or features reach ASI Biont, the agent can run speech recognition. Because the agent runs Python in a sandbox, it can call a local Whisper model or a cloud API. For latency-critical applications, use a small model like whisper-tiny or vosk-small:

# Generated by ASI Biont inside execute_python
import paho.mqtt.client as mqtt

def on_message(client, userdata, msg):
    print("topic:", msg.topic, "payload:", msg.payload)

c = mqtt.Client()
c.on_message = on_message
c.connect("localhost", 1883)
c.subscribe("home/mic/#")
c.loop(timeout=5.0)  # one-shot with 5 s window

The output of speech recognition is a text intent, which ASI Biont maps to an action: publish a command to a smart home broker, call a REST API, or write a coil via Modbus.

12. End-to-End Scenario: “Turn on the Light”

Consider an office setup: an ESP32 with an INMP441 publishes audio energy over MQTT; a separate ESP32 controls a relay.

  1. User says "Turn on the light".
  2. ESP32 captures audio and sends a 2-second I2S frame to the bridge via UART.
  3. ASI Biont receives the frame, runs a Whisper model, and extracts the intent {action: "turn_on", target: "light"}.
  4. The agent publishes an MQTT message light/1/set with payload ON using paho-mqtt.
  5. The relay module switches the light.

This entire flow is described by the user in one chat message: "Connect to COM8, listen for audio, when you hear 'turn on the light', publish ON to light/1/set." ASI Biont writes the bridge commands, the speech-recognition code, and the MQTT client.

13. Edge Keyword Spotting to Reduce Bandwidth

Continuous speech-to-text on the cloud is expensive. A better pattern is edge keyword spotting: the ESP32 runs a small on-device model or a simple energy threshold to detect a wake phrase, then uploads only the relevant 1–2 second audio segment to ASI Biont. This reduces Wi-Fi traffic by several orders of magnitude and keeps the AI-agent cost low.

For instance, capture only when the RMS exceeds a set value, or implement a basic correlation-based matcher on the ESP32 with an MFCC library. The AI agent can generate the wake-word logic in MicroPython, tailored to your vocabulary.

14. Automating Smart Home and Industrial Controllers

The value of ASI Biont is the downstream automation. A recognized voice command can be translated into:

  • An MQTT message for a Tasmota device (cmnd/light1/POWER ON).
  • A Modbus/TCP write to a PLC register via pymodbus.
  • A BACnet write to an HVAC controller.
  • An HTTP POST to a local dashboard or to https://api.telegram.org/bot<TOKEN>/sendMessage for a push notification.

Because the agent is protocol-agnostic, the same microphone input can drive both a smart home and an industrial controller in the same pipeline.

15. Universal execute_python: Connect Anything, Right Now

ASI Biont does not require a vendor SDK or a predefined device profile. Every interaction is driven by the execute_python tool: the AI writes a Python script that imports pyserial, paramiko, paho-mqtt, pymodbus, aiohttp, or opcua-asyncio, and runs it in a sandbox. To add a new microphone model, you simply tell the agent:

"I have a MAX9814 on ESP32, connected over MQTT at 192.168.1.100, topic home/mic/level. Write me a script that triggers when level > 800 and then sends a Telegram message."

The agent generates the script, runs it once, and shows the result. There is no “add device” button, no management panel, and no waiting for a hardware vendor to release a plugin. If the device speaks USB, serial, TCP, Modbus, or even raw binary, execute_python bridges the gap.

16. Security: Protecting Voice Data

Audio is sensitive. Use TLS for MQTT, and authenticate the ESP32 with unique client IDs. For serial connections, keep the host machine physically secured. If you send audio to an external speech-recognition API, choose a provider that offers on-premise or ephemeral processing. ASI Biont can run the recognition locally on your server — the sandbox executes the Python model, and raw audio never leaves your network.

17. Troubleshooting: Clipping, Noise, Latency

  • Clipping (MAX9814): If samples saturate at the ADC maximum, lower the gain via the AGC pin or add a voltage divider. The MAX9814’s AGC can cause pumping, so use a fixed gain setting when measuring.
  • I2S data zeros (INMP441): Verify L/R polarity. A common mistake is tying L/R to GND and decoding the right channel.
  • Latency: MQTT over Wi-Fi adds 10–50 ms; speech recognition adds 200–1000 ms. For time-critical commands, keep the model small or use edge keyword detection.
  • Serial corruption: Lower the baud to 115200 and add a checksum to the frame header.

18. MAX9814 vs INMP441 for Voice Automation

Parameter MAX9814 INMP441
Output Analog Digital (I2S)
ADC needed Yes No, internal sigma-delta
SNR 50–60 dB 61 dB (datasheet)
Sensitivity Adjustable AGC Fixed sensitivity
EMI immunity Low High (digital)
Best for Prototypes, battery Production, robust voice capture

For ASI Biont integrations, the INMP441 is the safer choice for speech recognition because digital transmission avoids analog noise and the ESP32 I2S driver handles the clocking. The MAX9814 remains a great low-cost option when you only need sound presence detection.


Ready to turn your microphone into an AI-controlled sensor? Describe your hardware setup in the ASI Biont chat — the agent will generate the bridge configuration, the MicroPython firmware, and the automation logic for you. Try it today at asibiont.com.

← All posts

Comments