Voice Detector With Automatic Recording System Using Arudino With the IoT

by rakeshsai in Circuits > Arduino

1156 Views, 2 Favorites, 0 Comments

Voice Detector With Automatic Recording System Using Arudino With the IoT

Screenshot 2022-03-08 150602.png
Screenshot 2022-03-08 150654.png

Noise pollution is a growing problem in modern cities, rapid population growth, urbanisation and new technologies. Moreover, at times, a noisy neighbour or co-worker can drive you crazy and affect your well-being. Talking loudly is an annoying habit in an office environment. Having a loud co-worker can distract us from our work and harm our productivity.

To help solve this problem, we bring to you today a noise detector with automatic recording system. This device notifies users whenever it detects loud noise (when the sound crosses certain limits), as well as it automatically records the sound and saves this recorded sound in a file.

This Noise Detector System can be used in library, office and classroom environments to identify noisy people so that necessary action can be taken against them.

Supplies

WhatsApp Image 2022-03-08 at 2.46.48 PM (3).jpeg
r.jpeg
d.jpeg
arduino-nano-500x500.jpg
Screenshot 2022-03-08 224317.png

To build this device, we need to first collect a few components

Components Required :

1. Vibration motor/ Buzzer

2.Bluetooth HC 05

3.Sound sensor module

4.Wires

5. Arduino Nano

App Making

Screenshot 2022-03-08 222823.png
Screenshot 2022-03-08 222851.png
Screenshot (219).png
Screenshot (220).png
Screenshot (221).png
Screenshot (222).png

We are going to use the MIT app inventor for creating our app

In the first part,

we need to create a layout and add the following components

1) A list picker

2) A text level

3) 2 buttons

4) 1 text view

5) Sound recorder

6) Tiny DB.

7) Bluetooth client.

Circuits Connection

Screenshot 2022-03-08 150654.png

Connection

Now connect all the components as illustrated below (Refer Fig 6).

Arduino Nano Components

Pin A7 --> Sound Sensor Out

5v -->VCC Bluetooth & Sound sensor

GND -->GND Bluetooth & Sound senor

D4 -->RX

D3 -->TX

D12 --> Buzzer VCC

GND -->Buzzer GND

Coding

First, we will initialise the different variables in our code to store values and pin numbers and then include the Software Serial library. After this, we will set the Pin modes for the Arduino pins and the baud rate for Bluetooth. Following this, we will set a loop function where we will create an ‘if condition’ that checks the incoming number from Bluetooth. This number is used for setting the threshold level for noise sensor. Then the loop function jumps to other function (i.e. sensor) that collects the average sensor data .

int setpin=A7;
int buzzer=12;
long val=0;
long average = 0;
int threshold=20;

String answ;
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3,4);

void setup() {
  pinMode (setpin,INPUT);
  pinMode(buzzer,OUTPUT);
  Serial.begin(9600);
  mySerial.begin(9600);
  

}


void loop() {
  if (mySerial.available()!=0)
  {
    answ=Serial.readStringUntil('\n');
    threshold= answ.toInt();
  }
  sensor();
}




Coding

In sensor function, we will create a ‘for loop’ that collects the sensor data until the for loop ends (up to 160 times) and calculates the average of the collected data. After that an ‘if condition’ checks the average, if the average value is greater that the threshold value then it sends the value to an app that we are going to make in next part .


void sensor(){

 for (int i=0;i<160;i++);

 {

  average = average +analogRead(setpin);

   

 }

 val=average/160;

 average=0;

 delay(10);


 Serial.print(val);

 Serial.println(threshold);


 if(val>=threshold){

  mySerial.println(val);

  digitalWrite(buzzer,HIGH);

  delay(150);

  digitalWrite(buzzer,LOW);

  delay(150);

  digitalWrite(buzzer,HIGH);

  delay(200);

  digitalWrite(buzzer,LOW);

  delay(900);

   

 }

}

Testing

Screenshot 2022-03-08 154620.png

Testing Now, power the Arduino and connect the Bluetooth with your app. After successful connection, you can test it by making loud noises. When your sound level crosses the threshold value, the Noise Detector device will buzz to notify about it and at the same time the app will start recording the sound and it will go on recording until the noise level comes down below the threshold level.

Software Code Link

https://drive.google.com/drive/folders/1Bj7lIhb6srImDCeCpca2UD9KHqGXwnFN