ESP8266/ESP32 Arduino WiFi Microphone Source Code
The “Ai Thinker ESP12” module has an ACD pin which works in range of 0V to 3.3V with 10 bits resolution (0-1023). The pin is between RST and EN. In the “WiFi Microphone” project, we have used this channel as the audio signal input.
The source code contains 4 files:
- ESP8266WiFiMicrophone.ino – the main program
- AC.ino (autoconnect handler)
- AC.h (configuration headerfile)
- MicPage.ino (Microphone’s page and decoder)
After upload, run the program in “normal mode”.
Then in case you are using ESP12, the blue LED on the board would be turned on for 1 second then turns off. Then you’ll be able to see the module’s hot spot ssid via the WiFi networks in your PC or smart phone.
The default SSID is WiCardAC and the default password is 12345678. Connect and go to 192.168.4.1/config with a web browser.
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.
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 WiFi Microphone Audio Stream Page
This page is at the root address (192.168.4.1 or the router’s given IP) and also decodes the input signal from the ADC pin, to audio stream.
Then by click on the play button, you can listen to the live audio stream. Also the browser’s player is recording the stream at the same time.
The audio streamer uses 10 bits of the ADC channel. The sample rate is 8 KHz
- The WiFi signal strength takes effect on the module capability and the audio streams.
- The average voltage (silent voltage) is 1.65V (half of the 3.3V power source).
- The output audio stream will have about 3 seconds delay.
- Better to use a 3.3V-2A power source.
- Higher voltage hurts the module.
The projects and also the free DEMO revision is available in the following:
Written by: M. Mahdi K. Kanan – Full stack electronics and programming engineer and the founder of WiCardTech