Noise pollution directly affects the quality of life and health. With Digilent Pmod MIC3 and Digital Discovery, you can create a cloud-based noise pollution monitor to assess the noise impact.
The Pmod MIC3 is a MEMS Microphone powered by the Knowles Acoustics SPA2410LR5H-B microphone and the Texas Instruments ADCS7476 analog-to-digital converter. The Digilent Digital DiscoveryDigilent Digital Discovery is a combined USB logic analyzer, protocol analyzer, and pattern generator. WaveForms is the virtual instrument suite for the Digital Discovery. It gives you access to all instruments including
- 32-channel digital logic analyzer (1.2…3.3V CMOS, 8 channels at 800MS/s*, 16 channels at 400MS/s*, and 32 channels at 200MS/s)
- Protocol Analyzer Featuring Digital Bus Analyzers (SPI, I²C, UART, CAN, AVR)
- 16-channel pattern generator (1.2…3.3V CMOS, 100MS/s)
Hardware Setup
The Pmod MIC 3 communicates on SPI interface and is connected to the Digital Discovery's digital I/O lines as follows:
- SS to DIO line 0 (DIO 24 on Digital Discovery),
- MISO to DIO 1 (DIO 25 on Digital Discovery)
- SCK to DIO 2 (DIO 26 on Digital Discovery).
- VCC to the positive supply of the device (VIO on Digital Discovery)
- Grounds of the two devices come connected together
ThingSpeak free IoT analytics platform
ThingSpeak, created by MathWorks, is a free online platform for collecting, viewing, and analyzing data in the cloud. ThingSpeak allows you to aggregate, visualize, and analyze live data streams. We use ThingSpeak to run the data analysis and display the result. First of all, we will sign up for Thingspeak. Then, we will add a channel to run the analysis. Here are some steps.
Step1: In the Channels menu, create a New Channel.
Step 2: Configure the channel settings, name, and fields. The field will be the containers for your data.
Step 3: Under API Keys, generate Write API Key to push data to the server from the WaveForms SDK and access stored data respectively.
Step 4: After uploading data to a channel, you modify plots and graphs through the preset widgets or MATLAB codes
Python Script
Python is used to convert the measured data from Pmod MIC3 and upload the results to ThingSpeak. We load Waveforms library (dwf.dll) and import request module. The request module lets us send the data to Thinkspeak. The program includes the below function:
- close_device - Reset all instruments and close the Digital Discovery
- display_error - Display the error message
- spi_read - Rad SPI data
Results
The results of the measurements are averaged, then converted to dB (this conversion is just an approximation of the true noise level). The measured noise levels can be plotted against time, or displayed on a gauge widget. A histogram of the measured values can also be displayed, along with a virtual LED, to indicate dangerous noise levels.
Find the project details and source files at Digilent Reference Page.