ESP8266/ESP12 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.
This project contains two folders ESP8266WiFiMicrophone (the WiFi Microphone source code) and PHP Script (For server use option).
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.
The WiFi autoconnect configuration page:
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.
After about 5 seconds delay (the record and decode/encode delay time), the audio plays by the browser.
The audio streamer uses 8 high bits of the ADC channel. Also The “LOUD” button, changes the decoder to the 8 low bits. The time under the button shows how long it took to receive and encode/decode the data. The best time is under 3.5 seconds.
- 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 link of project in our online store: ESP8266/ESP12 Arduino WiFi Microphone