Vignesh Jeyanthan.NPalaniappan.T
Published

IoT-Based Power Decibel Meter

This project can sense a sound level using mic, convert that sound into its corresponding dB, and then upload it to the cloud.

IntermediateProtip3 hours14,372
IoT-Based Power Decibel Meter

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Bluetooth Low Energy (BLE) Module (Generic)
×1
SparkFun Atmospheric Sensor Breakout - BME280
SparkFun Atmospheric Sensor Breakout - BME280
×1

Software apps and online services

Arduino IDE
Arduino IDE
ThingSpeak API
ThingSpeak API

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Block diagram of power decibel meter

Chart of noise from crackers

Code

Coding for Sound Decibel meter

Arduino
#include <SoftwareSerial.h>

SoftwareSerial BTserial(0, 1); // RX | TX
const double dBAnalogQuiet = 10;//envelope - calibrated value from analog input (48 dB equivalent)
const double dBAnalogModerate =  12;
const double dBAnalogLoud = 17;
#define PIN_QUIET 10
#define PIN_MODERATE 11
#define PIN_LOUD 12
#define PIN_ANALOG_IN A0
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
  // put your setup code here, to run once:
BTserial.begin(9600);
pinMode(PIN_QUIET, OUTPUT);
pinMode(PIN_MODERATE, OUTPUT);
pinMode(PIN_LOUD, OUTPUT);
 //lcd.begin(20, 2);
 // lcd.print("The sound in db");
}

void loop() {
  // put your main code here, to run repeatedly:
int value, i;
float decibelsValueQuiet = 49.5;
float decibelsValueModerate = 65;
float decibelsValueLoud = 70;
float valueDb;
value =  analogRead(PIN_ANALOG_IN);
if (value < 13)
{
 // Serial.println(value);
  decibelsValueQuiet += calculateDecibels(value, 'q');
  //Serial.println(decibelsValueQuiet);
  valueDb =  decibelsValueQuiet;
 BTserial.println(valueDb);
}
 else if ((value > 13) && ( value <= 23) )
  {
  // Serial.println(value);
   decibelsValueModerate += calculateDecibels(value, 'm');
  // Serial.println(decibelsValueModerate);
   valueDb = decibelsValueModerate;
    BTserial.println(valueDb);
}
else if(value > 22)
{
 //Serial.println(value); 
 decibelsValueLoud += calculateDecibels(value, 'l');
 //Serial.println(decibelsValueLoud);
  valueDb = decibelsValueLoud;
   BTserial.println(valueDb);
 
}
delay(500);
}


float calculateDecibels(int x, char c)
{
  float decibelsCalculated;
  
    if (c == 'q')
      decibelsCalculated = 20 * log10(x/dBAnalogQuiet);
    if (c == 'm')
      decibelsCalculated = 20 * log10(x/dBAnalogModerate);
    if (c == 'l')
      decibelsCalculated = 20 * log10(x/dBAnalogLoud);  
  
  return (decibelsCalculated);
}

Credits

Vignesh Jeyanthan.N

Vignesh Jeyanthan.N

3 projects • 3 followers
Palaniappan.T

Palaniappan.T

3 projects • 1 follower

Comments