ESP32 WiFi Microphone
The “DOIT ESP32 DEVKIT V1” module has multiple ACD pins which work in range of 0V to 3.3V with 12 bits resolution (0-4095). The pin that we have used for this project is GPIO33 (D33). In the “ESP32 WiFi Microphone” project, we have used this channel as the audio signal input.
Here’s the project link:
ESP32 WiFi Microphone Arduino source code+schematic – rev 1.3
And a free test bin of older revision for ESP8266
ESP8266 WiFi Microphone Pre-Compiled Binary File (ESP12, NodeMcu…) – Rev 1.2
The module reads audio signal from ADC pin, then decode it to audio data and transmits it to the web UI. Web browser receives the data and stars recording it to a WAV file as soon as the user opens the main web page (192.168.4.1). Also the user can play the recorded audio live-ly at the same time.
This project contains a folder (ESP32WiFiMicrophone) which is the WiFi Microphone source code. The source code contains 4 files:
- ESP32WiFiMicrophone.ino – the main program
- AC.ino (WiFi connection handler)
- AC.h (WiFi configuration headerfile)
- MicPage.ino (Microphone’s page and the decoder)
ESP32 WiFi Microphone Web UI
The default SSID is “WiCard MP” and the default password is 12345678. Connect and go to “192.168.4.1” with a web browser.
Here’s the web UI in 192.168.4.1:
Right after loading the page, the module starts recording automatically. By clicking on the play button, the recorded sound will play.
In the right top of the page, there is a menu button, here are the menu items:
“Scope” will lead to audio signal oscilloscope page. In this page you can check the audio signal and set the best output by turning the sound sensor potentiometer.
“Settings” will lead you to the WiFi and device configuration page:
This page shows the WiFi connection status, available access points and etc. Also in this page you can configure the hotspot connections and recording settings.
In the “Modem Configuration” section, you’re able to view/edit the SSID and password of WiFi modem/router and then click on “Save” after inserting. The module would connect to the modem after about 30 seconds in case of validity of ssid and password.
- This page is also available via the DHCP IP of the module. The given IP address for the above picture is 192.168.0.12.
In the “Device Hot Spot Configuration” section, you can set the module hotspot’s SSID and password. Also you can set a password for the internal page with Secure Link section. (Example: the secure link is ABCD and the root page would be at 192.168.4.1/ABCD/ address)
The “Hidden HotSpot” button will set the module’s hot spot as hidden hotspot and the “Disable HotSpot when is connected to the modem” would disable the module’s hotspot, when is connected to the modem.
The Stream Configuration
The stream configuration is in the bottom of “settings” page:
With “Audio Stream Bitrate” the quality of the audio stream can be set in 96, 108 or 120Kbps.
- The signal strength must be higher for higher quality.
The “Audio Stream Packet Length” sets the stream time in 5, 10, 30 or 60 minutes.
“Audio Stream Software Amplitude” increases the sound volume of the output data.
- In case of using a strong microphone module or loud input audio, there’s no need to the software amplitude.
The Audio Stream Page
This page is in the root address (192.168.4.1 or the router’s given IP) and decodes the received data from module to the audio stream.
After opening the page, wait for a few seconds for the initial file loading. Then click on the “play” button.
This page records audio data to in the browser’s cache automatically. Also you can play the audio and listen to the audio lively at the same time.
The preset time can be 5, 10, 30 and 60 minutes. After this time spent, you can refresh the page and record again.
To downloading the audio file directly, go to 192.168.4.1/s (or “the router’s given IP”/s).
- If you close the web page, recording will be aborted.
- Do not open two pages at the same time. The module can handle only one page at a time.
- The WiFi signal strength takes effect on the module capability and the audio streams.
More projects in our Blog.