Andrew BerryJack DuffSpivey
Published

Airbnb Noise Level Monitor

This is a tutorial showing you how to use a Wia Dot One and Grove sound sensor to monitor noise and send you a notification when it is loud.

BeginnerFull instructions provided19 minutes499

Things used in this project

Hardware components

Wia Dot One
Wia Dot One
×1
Wia Micro USB Cable
Wia Micro USB Cable
×1
Arduino Grove Sound Sensor
×1

Software apps and online services

Wia
Wia

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Wia Dot One Case Main

This is a case which fits the Wia Dot One and the Grove Sound Sensor

Wia Dot One Case Lid

This is a lid for the case case which fits the Wia Dot One and the Grove Sound Sensor

Code

Noise Sensor Code

C/C++
This is the code for the code project on the Wia platform for the noise sensor.
#include <WiFi.h>
#include <Wia.h>

const int pinAdc = 33; // input pin from the sensor
int startTime = 0; // used to track time 
int averageSound = 0; // this is the average in a certain time frame
int iterations = 0; // this is used to calculate average

Wia wiaClient = Wia(); // this is necessary for the Dot One to funtion properly

void setup()
{
    WiFi.begin(); // this connects the Dot One to the wifi
 		delay(2500);
}

void loop()
{
    long sum = 0; // this sums data
    for(int i=0; i<32; i++)
    {
        sum += analogRead(pinAdc); //this adds each reading from the input pin to sum
    }
    averageSound += sum; // this adds up the sums which later is converted to an average
    iterations++; // this is used to know how much you should divide average by 

    if(millis() - startTime >= 300000) // this occurs every five minutes
    {
      
      averageSound = averageSound/iterations; // computing average
      averageSound >>= 5; // shifting average for cleaner data
      // 700 is a number I selected for being too loud but you can raise or lower it based on your own needs
      if(averageSound >= 700) //if the average sound is over 700 then create an event
      {
        wiaClient.createEvent("Turn it down");
        delay(1000);
      }
      iterations = 0; // reset iterations
      startTime = millis(); // start the timer again
    }
    delay(50);
}

Credits

Andrew Berry

Andrew Berry

25 projects • 4 followers
Jack Duff

Jack Duff

32 projects • 3 followers
Man of the people. Champion of the downtrodden. Marketing magic @ Wia. Becoming a maker by learning, building, and exploring
Spivey

Spivey

82 projects • 51 followers
Tourist in a Tutu || US Born || Melbourne/Mexico/California Raised || New Yorker at ❤️ || SF to Dublin to be COO of Wia the best IoT startup

Comments