In this article, we’ll try to figure out how to get data from the SPH0645 MEMS microphone to the BLYNK IoT app on both desktop and mobile dashboards.
From our previous article about MEMS microphones, I have given a detailed explanation on how to get the SPH0645 microphone to display the sound level of the given surroundings. Now we’ll talk about how to get the values displayed from the Serial monitor onto BLYNK.
- COMPONENTS NEEDED:
- SPH0645 microphone
- Jumper wires
2. Arduino IDE and ESP32 Boards Add-on
We’ll program the ESP32 using Arduino IDE. So, you must have the ESP32 add-on installed. Follow the next tutorial if you haven’t already: Installing ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)
To build this project, you need to install the following libraries on your Arduino IDE:
- Blynk (Install available on Arduino Library Manager and also on GitHub)
- I2s interface (install from GitHub)
- You can install the first library using the Arduino Library Manager. Go to Sketch > Include Library > Manage Libraries and search for the library name.
- Getting the app ready:
We will use the Blynk Platform to create an app that will fetch data from ESP32 and display it on the smartphone. The steps to create the app –
- Create a new Blynk app
- Add 1 x Gauge and 1xLabeled Value Widgets and associate them with Virtual Pins V0. You can label and format the data as required. We use V0 for decibel reading.
- The ESP32 will transmit the decibel readings to the V0 pin.
- On creating the app, you will get a Blynk Auth Token. Note it down as you will need it later while programming the ESP32.
- The detailed guide can be found on their official Blynk IoT platform.
- HOW THE CODE WORKS
Let’s take a quick look at the relevant parts of this project. Insert your Blynk app auth key here. This is used to identify your ESP32 and App on the Blynk Server. You will receive the auth key after creating the Blynk app in the previous step.
|char auth  = ” “; // You should get Auth Token in the Blynk App.|
Insert your network credentials in the following variables for the ESP32 to connect to your local wifi network:
|char SSID  = ” “; // Enter your WiFi SSID here|
char pass = ” “; // Enter your WiFi Password here
Upload code and files
Run the program on Arduino and see the values changing in the mobile and desktop dashboard.