IoT Based Sound Pollution Monitoring System – Measure and Track Decibels (dB) using NodeMCU

IoT Based Sound Pollution Monitoring System using NodeMCU

We surely can’t imagine a world without sound. Sound is one of an integral part of our day to day life, everything just becomes monotonous without the presence of audio. But too much of anything is dangerous, with the advent of automobiles, loudspeakers, etc. sound pollution has become a threat in recent days. So, in this project, we will build an IoT decibel meter to measure sound in a particular place and record the value in a graph using IoT. A device like this will be useful in places like hospitals and schools to track and monitor the sound levels and take action accordingly. Previously we have also built an Air pollution meter to monitor air quality using IoT.

 

A sound level meter is employed for acoustic (sound that travels through the air) measurements. The simplest sort of microphone for sound level meters is the capacitor microphone, which mixes precision with stability and reliability. The diaphragm of the microphone responds to changes in air pressure caused by sound waves. That’s why the instrument is usually mentioned as a sound pressure level (SPL) Meter.

 

Sound level meters are commonly utilized in sound pollution studies for the quantification of various sorts of noise, especially for industrial, environmental, mining, and aircraft noise. The reading from a sound level meter doesn't correlate well to human-perceived loudness, which is best measured by a loudness meter. Specific loudness may be a compressive nonlinearity and varies at certain levels and certain frequencies. These metrics also can be calculated in several other ways.

IoT Decibel Meter

Here we are going to make an IoT based decibel meter that will measure the sound in decibels(dB) using a sound sensor and display it to the LCD display along with that, it will also be pushing the readings to the Blynk IoT platform making it accessible from across the world.

 

Components Required

  • ESP8266 NodeMCU Board
  • Microphone sensor
  • 16*2 LCD Module
  • Breadboard
  • Connecting wires

 

How does Microphone Module Work?

The microphone based sound sensor is used to detect sound. It gives a measurement of how loud a sound is. The sound sensor module is a small board that mixes a microphone (50Hz-10kHz) and a few processing circuitry to convert sound waves into electrical signals. This electrical signal is fed to on-board LM393 High Precision Comparator to digitize it and is made available at the OUT pin.

 

The module features a built-in potentiometer for sensitivity adjustment of the OUT signal. We will set a threshold by employing a potentiometer. So that when the amplitude of the sound exceeds the edge value, the module will output LOW, otherwise, HIGH. Apart from this, the module has two LEDs. The facility LED will illuminate when the module is powered. The Status LED will illuminate when the digital output goes LOW.

Sound Sensor Module

The sound sensor only has three pins: VCC, GND & OUT. VCC pin supplies power for the sensor & works on 3.3V to 5V. OUT pin outputs HIGH when conditions are quiet and goes LOW when sound is detected.

 

Circuit Diagram for IoT Sound Meter

The connections are pretty simple, we just have to connect the sound sensor to one of the Analog pin and the LCD to the I2C pins.

IoT Sound Meter Circuit Diagram

IoT Sound Meter

In the above diagram, we have connected the power pins of the sound sensor and LCD display to 3v3 and GND pin of NodeMCU. Along with that, we have also connected the SCL and SDA pins of the module to D1 and D2 respectively, and the OUT pin of the sound sensor to A0 pin.

 

Setting up Blynk for Remote Monitoring

For the IoT part, we will be using the Blynk IoT platform. We have previously used Blynk with Nodemcu to build many different projects. You can also check out other Blynk projects that we have built earlier. In this application, we will be adding a gauge to display the intensity of sound in decibels. Let us set up the app quickly.

  • First of all, install the Blynk app from PlayStore and create an account.

 

  • Click on the create button and create your new project.

Blynk App

 

  • Give your project a name and choose the board as NodeMCU and connection type as Wi-Fi.

Decibel Meter Using Blynk

 

  • An auth token will be sent to your registered email id. Keep it safe as it will be used later on while programming.

Auth Token in Blynk App

Auth Token is a unique alphanumeric string to identify your project in the Blynk’s server and assigning the correct data through it.

 

  • Now drag and drop a gauge from the list and configure it.

Blynk Projects

 

  • Connect the gauge to virtual pin V0 and set the values to 0 and 90 respectively, also set the reading rate to 1 sec.

IoT Sound Meter using Blynk

And now you’re done with setting up Blynk. Let us jump to the coding part.

 

Program for IoT Decibel Meter

Here, we have to develop a code that takes input from the sound sensor and maps it value to decibels and after comparing the loudness, it should not only print it to the 16*2 LCD display but should also send it to the Blynk server.

 

The complete code for this project can be found at the bottom of this page. You can directly copy-paste it in your IDE and change only three parameters i.e. SSID, pass, and auth token. The explanation of the code is as follows.

 

In the very first part of the code, we have included all the necessary libraries and definitions. Also, we have defined the necessary variables and objects for further programming.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <LiquidCrystal_I2C.h>
#define SENSOR_PIN A0
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
const int sampleWindow = 50;
unsigned int sample;
int db;
char auth[] = "IEu1xT825VDt6hNfrcFgdJ6InJ1QUfsA";
char ssid[] = "YourSSID";
char pass[] = "YourPass";

 

Further ahead, we have created a Blynk function to handle the virtual pin that our gauge is connected to. We are simply sending the values stored in the dB variable to the V0 pin.

BLYNK_READ(V0)
{
  Blynk.virtualWrite(V0, db);
}

 

In the setup part of the code, we are defining the pin mode as input and beginning the LCD display as well as the Blynk function.

void setup() {
  pinMode (SENSOR_PIN, INPUT);
  lcd.begin(16, 2);
  lcd.backlight();
  lcd.clear();
  Blynk.begin(auth, ssid, pass);
}

 

In the loop part, we are doing all the processing tasks like comparison and value assignment along with running the Blynk function.

void loop() {
  Blynk.run();
  unsigned long startMillis = millis(); // Start of sample window
  float peakToPeak = 0; //peak-to-peak level
  unsigned int signalMax = 0; //minimum value
  unsigned int signalMin = 1024; //maximum value
  // collect data for 50 mS
  while (millis() - startMillis < sampleWindow)
  {
    sample = analogRead(SENSOR_PIN); //get reading from microphone
    if (sample < 1024) // toss out spurious readings
    {
      if (sample > signalMax)
      {
        signalMax = sample; // save just the max levels
      }
      else if (sample < signalMin)
      {
        signalMin = sample; // save just the min levels
      }
    }
  }
  peakToPeak = signalMax - signalMin; // max - min = peak-peak amplitude
  Serial.println(peakToPeak);
  db = map(peakToPeak, 20, 900, 49.5, 90); //calibrate for deciBels
  lcd.setCursor(0, 0);
  lcd.print("Loudness: ");
  lcd.print(db);
  lcd.print("dB");
  if (db <= 50)
  {
    lcd.setCursor(0, 1);
    lcd.print("Level: Quite");
  }
  else if (db > 50 && db < 75)
  {
    lcd.setCursor(0, 1);
    lcd.print("Level: Moderate");
  }
  else if (db >= 75)
  {
    lcd.setCursor(0, 1);
    lcd.print("Level: High");
  }
  delay(600);
  lcd.clear();
}

 

Working of the Project

Now that you have understood the code, you can simply upload it to your NodeMCU board and the project should start working.

IoT Based Sound Pollution Meter

To make sure the values are correct, I compared them to an android application on my phone that could measure sound. As you can see from the pictures, the results were quite close.

Sound Level Meter

The complete working of this project is also demonstrated in the video linked below. Hope you enjoyed the project and learned something useful if you have any questions, leave them in the comment section below.

Code

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <LiquidCrystal_I2C.h>
#define SENSOR_PIN A0
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
const int sampleWindow = 50;
unsigned int sample;
int db;
char auth[] = "IEu1xT825VDt6hNfrcFgdJ6InJ1QUfsA";
char ssid[] = "realme 6";
char pass[] = "evil@zeb";
BLYNK_READ(V0)
{
  Blynk.virtualWrite(V0, db);
}
void setup() {
  pinMode (SENSOR_PIN, INPUT);
  lcd.begin(16, 2);
  lcd.backlight();
  lcd.clear();
  Blynk.begin(auth, ssid, pass);
}
void loop() {
  Blynk.run();
  unsigned long startMillis = millis();  // Start of sample window
  float peakToPeak = 0;  // peak-to-peak level
  unsigned int signalMax = 0;  //minimum value
  unsigned int signalMin = 1024;  //maximum value
  // collect data for 50 mS
  while (millis() - startMillis < sampleWindow)
  {
    sample = analogRead(SENSOR_PIN);  //get reading from microphone
    if (sample < 1024)  // toss out spurious readings
    {
      if (sample > signalMax)
      {
        signalMax = sample;  // save just the max levels
      }
      else if (sample < signalMin)
      {
        signalMin = sample;  // save just the min levels
      }
    }
  }
  peakToPeak = signalMax - signalMin;  // max - min = peak-peak amplitude
  Serial.println(peakToPeak);
  db = map(peakToPeak, 20, 900, 49.5, 90);  //calibrate for deciBels
  lcd.setCursor(0, 0);
  lcd.print("Loudness: ");
  lcd.print(db);
  lcd.print("dB");
  if (db <= 50)
  {
    lcd.setCursor(0, 1);
    lcd.print("Level: Quite");
  }
  else if (db > 50 && db < 75)
  {
    lcd.setCursor(0, 1);
    lcd.print("Level: Moderate");
  }
  else if (db >= 75)
  {
    lcd.setCursor(0, 1);
    lcd.print("Level: High");
  }
  delay(600);
  lcd.clear();
}

Video

41 Comments

The added weight iamazonsurmountwayweightedvest_2021 is a sure-fire way to make whatever workout you're doing infinitely more difficult. And if you've been sticking with bodyweight exercises, it can be an incredible tool to help push you.You can wear them during hikes, cardio workouts, and even CrossFit's iconic Murph workout. (CrossFitter Chris Holt did two back-to-back Murphs wearing a 30-pound weighted vest.) Or you can try one out during this weighted vest home workout designed by Scott Britton that will challenge you with a descending ladder of running and reps of press-ups.Weighted vests will take any home workout to the next level and transform just about any activity into a resistance exercise.

Thanks so much for giving everyone remarkably wonderful opportunity to read critical reviews from this web site. It really is so beneficial and as well , full of a great time for me personally and my office colleagues to visit your site at the least three times in 7 days to learn the latest issues you have. And definitely, I am actually contented with the unbelievable secrets you give. Selected 3 ideas in this post are indeed the very best we have had.

Thanks so much for providing individuals with an extraordinarily splendid possiblity to read critical reviews from this site. It can be so lovely and jam-packed with a great time for me personally and my office fellow workers to visit the blog on the least 3 times in 7 days to see the fresh items you have. And lastly, I am just at all times impressed with all the excellent strategies you give. Selected 4 tips in this post are unquestionably the most effective we have ever had.

Thanks so much for giving everyone such a breathtaking possiblity to check tips from this web site. It can be so pleasurable and as well , full of a great time for me personally and my office mates to search your site at least three times per week to study the fresh things you will have. Not to mention, I'm just certainly happy for the stunning tips you serve. Some two tips in this posting are really the very best we've had.

I wish to voice my gratitude for your kindness supporting individuals that have the need for help with that concern. Your very own commitment to passing the solution up and down came to be wonderfully good and have regularly made guys and women like me to reach their goals. Your own warm and friendly tips and hints means a whole lot a person like me and even more to my fellow workers. Many thanks; from everyone of us.

I simply desired to say thanks once more. I do not know the things I would have achieved in the absence of those suggestions documented by you on my industry. It was actually a very fearsome concern for me, however , observing a expert avenue you processed it took me to leap for fulfillment. Now i'm grateful for your support and in addition hope you comprehend what a great job that you're undertaking teaching other individuals thru your webblog. Probably you haven't met all of us.

A lot of thanks for every one of your effort on this blog. Debby really loves setting aside time for internet research and it's really easy to understand why. My partner and i notice all regarding the powerful method you offer vital ideas through this blog and as well as recommend contribution from some other people about this theme while our simple princess is without question starting to learn a great deal. Have fun with the rest of the new year. You're the one doing a remarkable job.

I actually wanted to compose a brief remark to appreciate you for all of the magnificent tips and hints you are showing here. My particularly long internet research has finally been rewarded with good quality details to share with my family. I would express that we website visitors are extremely endowed to dwell in a fabulous site with very many wonderful professionals with great plans. I feel really happy to have discovered your website and look forward to plenty of more cool minutes reading here. Thanks a lot once again for all the details.

Thanks so much for giving everyone remarkably breathtaking possiblity to read in detail from this site. It really is so pleasing and full of fun for me personally and my office acquaintances to search your web site really 3 times in one week to read through the newest stuff you have got. And of course, we are certainly amazed for the excellent secrets you give. Certain 3 areas on this page are essentially the most impressive we've had.

My husband and i have been very thrilled Jordan could deal with his web research using the ideas he received from your site. It's not at all simplistic to just always be freely giving guidance which usually men and women may have been making money from. Therefore we already know we need the blog owner to be grateful to for this. The type of illustrations you have made, the straightforward blog menu, the relationships your site make it easier to instill - it's got most terrific, and it's really facilitating our son in addition to us do think that idea is brilliant, which is particularly pressing. Many thanks for all!

Thank you a lot for giving everyone an exceptionally spectacular possiblity to read from this blog. It is usually very good and stuffed with a good time for me and my office mates to search your website at the very least 3 times every week to see the newest guidance you will have. And lastly, I am actually fascinated considering the special hints served by you. Some 4 ideas on this page are certainly the simplest we've ever had.

I needed to write you the bit of note to give thanks as before relating to the breathtaking opinions you have discussed in this article. This is simply particularly generous of people like you to present unreservedly just what a lot of people would have distributed for an electronic book to help make some money on their own, notably considering that you could have done it if you ever decided. These strategies likewise worked like the fantastic way to fully grasp many people have the identical zeal similar to my very own to grasp a lot more in terms of this problem. I'm sure there are many more fun opportunities up front for people who browse through your blog.

I would like to get across my passion for your generosity in support of women who need help on in this area of interest. Your special commitment to getting the solution up and down came to be wonderfully insightful and have helped ladies like me to achieve their desired goals. Your personal useful report indicates this much a person like me and somewhat more to my fellow workers. Best wishes; from each one of us.

I intended to post you the little bit of word to thank you very much again relating to the remarkable information you've discussed on this page. It is remarkably open-handed with people like you to present openly precisely what many of us could have made available as an e book to help make some profit for themselves, particularly given that you might have done it in case you desired. These basics also acted to become a good way to fully grasp that some people have the identical passion really like my very own to find out a little more when considering this problem. I'm certain there are millions of more fun times in the future for those who find out your site.

When I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get 4 emails with the same comment. Is there any way you can take away me from that service? Thanks!

I'm commenting to make you understand of the beneficial encounter our girl encountered going through yuor web blog. She picked up many pieces, which included what it's like to possess a very effective helping mindset to make many others very easily learn about specified specialized subject matter. You undoubtedly surpassed her desires. Thank you for showing the effective, trustworthy, edifying and even fun thoughts on the topic to Tanya.

My husband and i got very thrilled Raymond could carry out his analysis from your precious recommendations he made from your own web site. It is now and again perplexing just to find yourself offering procedures which usually others have been selling. And now we consider we've got the writer to give thanks to for this. The entire illustrations you made, the straightforward website navigation, the friendships you make it easier to foster - it's many unbelievable, and it's helping our son in addition to our family recognize that this matter is cool, and that is really mandatory. Thanks for the whole thing!

I not to mention my buddies happened to be digesting the best points from your web blog and then instantly developed an awful suspicion I had not thanked the blog owner for those tips. The boys happened to be consequently excited to read through them and have now in reality been having fun with those things. Many thanks for getting simply accommodating and also for pick out certain decent subjects millions of individuals are really wanting to understand about. My sincere regret for not expressing appreciation to you sooner.

I wish to get across my gratitude for your generosity giving support to persons that must have help on that area of interest. Your special dedication to getting the solution across became unbelievably invaluable and have surely made associates much like me to realize their targets. This insightful help means so much a person like me and still more to my mates. Thanks a ton; from each one of us.

I needed to post you this little bit of remark to give thanks the moment again about the incredible information you've featured on this site. It has been really strangely generous with you to convey unhampered precisely what most people could possibly have advertised for an e book in making some profit for their own end, even more so now that you might have done it if you ever wanted. These smart ideas in addition worked to be the fantastic way to recognize that the rest have a similar dreams really like my own to understand more with respect to this condition. I am sure there are many more pleasurable occasions in the future for individuals that examine your site.

Thank you for all your valuable work on this blog. Debby loves making time for investigation and it's easy to see why. Most people know all regarding the powerful method you present very important tips on your web blog and as well as welcome participation from some other people on this topic and our favorite child is without question becoming educated a lot of things. Enjoy the rest of the new year. You have been doing a splendid job.

I simply desired to say thanks again. I'm not certain what I could possibly have made to happen without the basics documented by you on such a field. Completely was a real frightening problem in my view, nevertheless being able to see the well-written mode you handled that forced me to jump for delight. I'm grateful for the service and then believe you recognize what a powerful job you're undertaking training other individuals thru a web site. I'm certain you have never encountered any of us.

I needed to compose you one little observation to finally give many thanks over again for your personal unique techniques you have featured on this website. It has been quite tremendously generous with people like you to present easily just what a few people could possibly have offered for sale for an e-book to make some profit on their own, especially considering that you could have tried it if you wanted. These secrets likewise acted to become fantastic way to realize that the rest have a similar eagerness just as my personal own to find out more when it comes to this condition. I am certain there are some more fun moments in the future for people who find out your blog post.

I want to express some appreciation to this writer for bailing me out of this type of crisis. As a result of surfing throughout the world-wide-web and seeing concepts which are not productive, I was thinking my entire life was gone. Being alive without the solutions to the difficulties you have fixed by means of your website is a serious case, as well as those that would have in a wrong way affected my career if I hadn't encountered your blog post. Your personal knowledge and kindness in maneuvering all the stuff was precious. I am not sure what I would've done if I hadn't come across such a solution like this. I can at this point look ahead to my future. Thanks very much for this skilled and sensible help. I won't think twice to endorse your site to any individual who will need guidance on this situation.

My wife and i got quite peaceful Albert could deal with his homework out of the precious recommendations he came across from your own web page. It's not at all simplistic just to choose to be handing out hints other folks have been making money from. So we already know we need you to give thanks to for that. Most of the illustrations you've made, the straightforward site menu, the friendships you help to engender - it is mostly fantastic, and it's aiding our son in addition to our family understand that matter is satisfying, and that's pretty mandatory. Many thanks for all!

I simply desired to appreciate you again. I do not know the things I might have made to happen in the absence of the concepts revealed by you on my industry. Entirely was a real terrifying difficulty for me personally, however , observing this skilled approach you processed it made me to jump for happiness. I'm just grateful for the advice and as well , pray you really know what a powerful job you are putting in instructing people today with the aid of your web blog. I am sure you haven't got to know any of us.

My wife and i got very fulfilled that Chris could finish off his basic research from your ideas he grabbed out of your weblog. It's not at all simplistic to just always be freely giving tips and tricks many others have been making money from. And we also figure out we've got the website owner to thank because of that. All the illustrations you have made, the straightforward site menu, the relationships your site make it easier to engender - it is all sensational, and it is assisting our son in addition to our family do think this situation is satisfying, and that is highly indispensable. Many thanks for all the pieces!

A lot of thanks for each of your effort on this web page. My mom takes pleasure in participating in research and it is obvious why. Many of us know all relating to the dynamic tactic you create helpful tactics on this blog and therefore invigorate response from some others on that concern then my princess has been being taught a whole lot. Have fun with the rest of the new year. You're performing a first class job.

I simply needed to appreciate you once more. I'm not certain the things I could possibly have made to happen in the absence of these thoughts shown by you regarding my subject matter. It was a very fearsome difficulty in my circumstances, however , considering this specialized avenue you managed it forced me to weep with delight. I am thankful for your assistance and thus wish you realize what an amazing job that you're doing teaching some other people through the use of a web site. I know that you've never met all of us.

An impressive share, I just given this onto a colleague who was doing just a little evaluation on this. And he in reality purchased me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love studying more on this topic. If doable, as you change into experience, would you mind updating your blog with extra details? It is highly helpful for me. Big thumb up for this weblog submit!

I want to show appreciation to this writer for bailing me out of this predicament. After surfing through the the web and getting advice which are not beneficial, I was thinking my entire life was well over. Being alive without the presence of strategies to the issues you've sorted out all through your posting is a critical case, as well as the ones that would have adversely affected my career if I had not come across the blog. Your good skills and kindness in handling all the details was vital. I'm not sure what I would have done if I hadn't come upon such a point like this. I can also at this time look ahead to my future. Thanks a lot so much for your skilled and result oriented guide. I won't be reluctant to propose your web site to anybody who needs guide on this area.

I discovered your weblog web site on google and check just a few of your early posts. Proceed to maintain up the superb operate. I simply additional up your RSS feed to my MSN News Reader. In search of ahead to studying extra from you in a while!?

Can I just say what a relief to find someone who truly knows what theyre talking about on the internet. You undoubtedly know the way to bring a difficulty to mild and make it important. Extra folks must learn this and understand this side of the story. I cant believe youre no more well-liked because you undoubtedly have the gift.

|On a hot summer's day, wearing your hair up can be fashionable and functional. Long, loose hair can get in the way during work or play. If you do not have time for a more elaborate style, just pull it into a cute bun.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.