With this source code, an ESP8266 or NodeMCU and a standard microphone module, build a 240kbps WiFi Spy microphone with audio recorder and live stream player..
Price:
Other projects from this group
This project is an ESP8266 WiFi Microphone firmware arduino source code (.ino) for online audio stream and also recording the audio.
This project has Chain Network feature option. The “Chain Network” is a local network which the devices one by one are connected to the each other. So you can add multiple WiFi microphone or Camera in an over the air (OTA) network and listen to the audio stream and video stream of each devices.
The “Ai Thinker ESP12” module (ESP8266MOD) and NodeMCU has an ACD pin (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.
There are the following files in this project:
This project is compatiple with ESP8266 modules which have ADC pin, like ESP-12-E and ESP8266 NodeMCU.
The Web Application:
The circuit with "NodeMCU" and "Waveshare Sound Sensor":
First open one of the files with Arduino program, then set the settings as the following image (Board, CPU Frequency and Flash Frequency):
WaveShare sound sensor is an audio amplifier and sensor with LM386. This module is compatible with this project.
You can either use a prepared SD/MMC memory card module (with resistors and the 3.3V regulator) or use a slot and add the resistors to your circuit.
In case you are using NodeMCU, it’s suggested to use a memory module with a 3.3V regulator and supply it with 5V (“Vin”), because it reduces the ESP module’s power supply noises and the ESP module’s internal regulator heat.
For recording the voices automatically, insert a memory card, turn on the module and select the sensitivity (10db, 20db and 30db for the louder noises).
Then the device starts to hearing the noises and as soon as hearing the load enough noise, it starts to recording it in a .wav file with the selected quality and record time.
When the recording is finished, the file will be available in the file manager.
It’s suggested to use a standard 3.3V microphone module (like “WaveShare Sound Sensor”). The ADC pin (A0) of esp8266 is the audio signal input. Before using the WiFi microphone, build one of the following circuits.
Here’s a suggested circuit with a simple capacitive microphone, LM386 and ESP8266MOD (ESP12):
In the above schematic (LM386 and ESP8266MOD), LED1 shows the power is on, SW1 is the ESP8266 module reset button, H1 is the module’s UART connector (for flashing/programming) and H2 pin header needs a jumper to put the ESP12 module in the flash programming mode.
The microphone block has a potentiometer (P1) to calibrating the input audio signal. In the low level, the audio noise will decrease but the output audio is weaker and in the high level you can hear the small voices but more noisy.
The “Chain Network” is a local network which the devices one by one are connected to the each other (Series). In the chain network, the first device is the master of network. The starter (either the master or the last joined module) is directly connected to the WebApp. It sends the command to the next device, and the next device sends it to the next one till the last device. The last device response will be sent to the first device and finally the WebApp via the middle devices.
Plug the power and turn on the circuit and the module in “normal mode”.
Then in case you are using ESP12, the blue LED on the board would be turned on. 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 WiCardMic and the default password is 12345678. Connect and go to 192.168.4.1 with a PC or smart phone web browser (Chrome or Firefox).
Here’s the web UI:
Right after loading the page, the module starts recording and buffering automatically. By clicking on the play button, the recorded sound will play.
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/0 (or the router’s given IP).
Above of the audio player, you can see the target device.
The Web Application is divided to 4 menus. The menus can be selected by click on the menu button.
“Online Stream” refers to the “Live Audio Player” page, “Network” refers to the Network WiFi Microphone Monitor (oscilloscope), "File Manager" refers to the memory card access and “Settings” refers to the settings and configuration page.
In the “Network” page, there are 4 scope/monitor channels. That means you can add up to 4 devices, either WiCard Microphone or WiCard Camera to the chain network and see the audio signals or online video streams at the same time.
In the above picture, only two devices (CH0 and CH1) are connected to the network.
By click on each channel, the target device in the audio player page will change to the selected device.
The web application’s settings menu has been divided to 5 parts:
For the programming, use the pre-defined functions in the files which start with “user”.
Add your start-up script to the “userInit()” function in user_init.ino file. No need to do wifi or server configuration. This configuration already have done in the firmware system files (e.g. systemInit() and setup()).
The “userLoop()” function (user_loop.ino) calls repeatedly (like arduino “loop()” function), If your program needs to execute a statement repeatedly (e.g. reading a sensor’s data), insert your script in this function.
The “webapp.h” file is the root page’s script. You can customize sWebApp variable in that file if you’re going to make changes in the Web UI.
Also you can customize the “userGetSettings()” function (user_settings.ino), for adding more settings to the firmware. The WebApp execute this function when you click on the Settings menu.
After you click on the SAVE button of the user-defined settings, the “userSetSettings()” functions will be called.
The “userMain()” in the “user_main.ino” file, calls once when you click on the “Player” menu (or initially after loading the root page).
The “userSubInit()” in the “user_sub.ino” file, calls once when you click on the “Network” menu and sends the available devices in the network back..
The “userSub()” in the “user_sub.ino” file, calls intervally and the starter collects the scope data in the chain network.
The “userGlobal()” function in the “user_global.ino” is not working in this revision.
In the AC.h file, if you remove “#define LOG_ENABLE”, the logs will not be shown and the log memory would be released.
In the user_global.h file, you can change the bit-rate timing and delays with the following “define” variable:
#define AUDIO_6KHZ_DELAY%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; %26nbsp;%26nbsp;140
#define AUDIO_12KHZ_TIMING%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; 80
#define AUDIO_18KHZ_TIMING%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; 54
#define AUDIO_24KHZ_TIMING%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; 39
Also you can change the buffer sizes with the following variables.
#define AUDIO_BUFFER_SIZE%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; %26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;3900
#define AUDIO_NET_BUFFER_SIZE%26nbsp;%26nbsp;%26nbsp;%26nbsp; 100
2.1
- Compatibility of Camera devices for the Network feature
- Bugs fixed
- Network quality increased to 240kbps
- Online Audio stream added for the SpyCam devices in the network
- File manager upgraded
2.0
- Memory card reader added to the hardware
- Voice recorder added to the software
- File manager added to the WebApp
1.6
- The audio noises reduced
- The network audio quality increased to 64Kbps
- Page loading speed increased
- Buffer size increased
- Connection secured with upgrading the secure link feature
- Auto network channel and target selector added
1.5
- The Web Ui upgraded
- Bit-rate and the quality of audio stream increased (240Kbps)
- Network stream feature added
- Network monitor feature added
1.4
- Bit-rate increased up to 110Kbps
- SecureLink bug fixed
1.3
- Schematic improvement
- The Web UI has been changed
- increasing the quality of the recorded sound
- Increasing the bitrate up to 100kbps
- reducing the noises
- Bugs fixed
1.2
- Schematic improvement
- Secure link debug
- ADC input improvement
- Output file improvement
- Selectable stream quality
- Adjustable stream time
- Adjustable software amplitude
1.1
- 10:28 frame (increased)
- Audio stream recorder and player
- 8KHz sample rate (increased)
- 10 bits resolution (increased)
- Calibration page
- The stability and quality of audio stream increased
- Suggested test circuit updated
- Bugs fixed
1.0
- 3300 miliseconds frames
- LOUD button
- 7.5KHz sample rate
- 8 bits resolution
- Internal pages secure link
- Show MAC and IP in config page
- Set module hotspot and modem’s ssid and password
- Automatically connection to the modem
- Config page
- Hidden hotspot button
- Disable hotspot button