Software

Productivity Tool Wireless Mic200189

This page was translated by AI and may differ from the original
效率工具

This is a wireless microphone based on ESP-Mosaico: it uses the onboard microphone to transmit voice to a Mac via Bluetooth HFP, while using the touchscreen and physical buttons for quick actions such as speaking and Enter. The accompanying Mac daemon handles pre‑set shortcut keys and Fn mapping, making it easy to operate quickly during voice input. It helps you quickly vibe code.

Creatorgojinhe
4141

ESP-Mosaico Wireless Microphone Project

Project Overview

This project turns the ESP-Mosaico (ESP32‑S31) development board into a wireless voice input prototype for Mac. The on‑board microphone provides audio input to macOS via Classic Bluetooth HFP; the same device also offers Bluetooth keyboard functionality, using physical buttons and the touch screen to control push‑to‑talk, Enter, and Clear. The Mac‑side helper program maps the F18 sent by the board to Fn and sends the user‑configured pre‑key combination before speaking.

This is a prototype that runs on a real development board, not an emulator, and not a plug‑and‑play product guaranteed for any macOS application. Voice input methods must manually select this microphone and configure the appropriate shortcuts.

Working Chain

板载麦克风 -> ES8311 ADC -> I2S -> PCM 缓冲 -> HFP HF -> Mac 音频输入
板上按键/触摸屏 -> 蓝牙 HID 键盘 -> Mac 辅助程序 -> 前置组合键 + Fn

The HFP mSBC mode uses 16 kHz mono audio; when negotiated as CVSD it falls back to 8 kHz. This project only uses the uplink from the on‑board microphone and does not implement speaker playback. The Mac can continue to use its own speakers for output. Audio data is injected into the system via HFP and does not rely on any additional Mac virtual‑audio driver.

On-Board Operations

After a normal startup, the home screen displays four touch areas:

AreaFunction
TALKHold to talk, release to stop; while held the microphone icon lights green.
ENTERSends an Enter keystroke to the currently focused input location.
CLEARSends Command+A to the focused input, then sends Delete.
SETUPEnters the on‑board settings page; does not send keys directly to the Mac.

The microphone, keyboard, USB, and battery icons in the upper‑right corner indicate the board‑side link and battery status as observed. A connection icon does not guarantee that the voice input software has started recording, and a USB data connection does not mean the device is charging. Touch interactions and physical button presses produce a brief haptic feedback.

The physical BOOT button takes on voice control after normal operation: a long press acts as the talk button, a double‑tap acts as Enter; the AI button is no longer used for recording in this project. Holding BOOT while powering on still enters firmware download mode and cannot be used as a regular recording button. The power button remains responsible for powering the device on and off.

Mac-side Pre-key

tools/macos/mosaico_fn.m implements the local settings window and a resident key listener. The listener identifies the paired Mosaico keyboard and maps the F18 sent by the board to Fn; when a pre‑key is enabled, it first sends the selected key together with any Command/Option/Control/Shift modifiers, waits for the configured number of milliseconds, then simulates holding Fn, releasing Fn when the board button is released. Pre‑keys can be used to activate an input field or an application shortcut first, but they do not automatically locate or click a specific application's input field.

The helper program requires macOS Accessibility and Input Monitoring permissions. After modifying or re‑signing the app, the system may request re‑authorization. The current project uses a temporary signature; merely seeing the process running and key events being posted does not imply that the foreground application has processed the shortcuts. Runtime status and a limited number of event logs are stored in the current user's ~/Library/Application Support/MosaicoMic/ directory.

The public source version does not embed a personal Bluetooth address: you need to write the paired board’s 12‑digit hexadecimal Bluetooth serial number (without colons) into ~/Library/Application Support/MosaicoMic/board-serial.txt on the host and restrict the file permissions to the current user. Do not commit the board’s serial number or any recordings from your machine to the public repository.

Running and Development

The project resides in esp-mosaico-vibe/projects/wireless_mic, depends on the ESP-Mosaico BSP, ESP‑Iris, and a fixed ESP‑IDF environment within the workspace; it is not an ESP‑IDF repository that can be built independently of the workspace. The main modules are:

  • components/app_audio: ES8311/I2S acquisition, input gain, and bounded PCM buffering.
  • components/app_hfp: Classic Bluetooth HFP microphone transmission.
  • components/app_hid: Bluetooth keyboard reports and connection management.
  • components/app_controls: Physical/touch button gestures, Enter and Clear sequences, haptic feedback.
  • components/app_touch: LVGL touch UI, status icons, and ESP‑Iris screenshot interface.
  • tools/macos: Mac‑side pre‑key settings window and listener.

Compilation uses the ESP‑IDF specified by the workspace (target esp32s31). Board updates are performed uniformly via the workspace’s mosaico.py iris app-update or, depending on partition changes, system-update, with the target device explicitly specified; do not erase the entire flash directly or bypass the firmware recovery mechanism. Detailed build constraints are in the project README, and the Mac tools are described in the tool documentation.

Verified and To-be-Verified

On an ESP‑Mosaico V1.2 board paired with a Mac, HFP/mSBC negotiation, Mac system recognition of the microphone, and short‑duration local recording have been verified; the current board version is 0.2.4, and a screenshot of the board’s home page has also been obtained via ESP‑Iris. Firmware input gain has been reduced from 30 dB to 18 dB to lower the risk of clipping. Keyboard mapping and pre‑key combinations have generated Mac‑side event logs, but reading back system events does not guarantee that any voice input method has correctly received or displayed the text.

Further work is needed to test each target input method with real speech and on‑screen text, and to verify long‑duration recording, disconnection/reconnection, sleep‑wake behavior, actual latency, and battery life. Subsequent modifications in the current workspace, such as on‑board display brightness or sleep‑screen settings, should not be considered released and verified features. Historical test records are in the validation log; some early conclusions have been superseded by later versions.

Comments (0)