Introduction: Connected Noise Sensor

Picture of Connected Noise Sensor
  • What about a product which will stop students making noise ?

We thought about this real issue and decided to develop the connected Noise Sensor. This device can easily be attached to the ceilling in the middle of classroom for sensing noise levels (dB) each second.

  • How does it work ?

The device is equipped with LCD screen where noise level (dB) is displayed in green while sound volume threshold is not excedeed. Otherwise, the backgroud screen becomes red.

Moreover, the product is equiped with red beacon which is set off only when the overage of the ten last value sensed is higher than the threshold.

Finally, you will be able to monitor sound volume threw your computer if you are connected to a network.

Step 1: Equipments

Picture of Equipments

1. Module Wifi ESP 8266 and ModeMCU card :

Thanks to a Wifi connection, this Wifi module allows you to connect to the UBIDOTS website. Here is the photo of the ESP 8266 module. This module ESP8266 is directly implanted on a card NodeMCU on which we load our code.

2. Sound sensor SEN 12642 :

Our project is based on a sound sensor Gotronics Ref: 32606, this sensor aims to measure the sound noise more or less close to the microphone.

The sound sensor must be powered between 3.5 and 5V and has 3 outputs:

  • Audio: This output is the audio output of the detector, which directly detects the audio voltage from the microphone
  • Envelope: On this output there is an analog voltage which plots the amplitude of the input sound. Very useful because the higher the input level, the higher the voltage.
  • Gate: This output goes to 1 (at about 5V) when a sound is detected and at 0 when there is no noise

3. LCD Screen :

The LCD screen is a simple screen. It has a supply voltage, a ground, a SCL pin and an SDA pin. These two pins control the information displayed on the screen.

4. Flash :

The flash is a simple led that comes on when there is voltage at its terminals. This flash is alimented by 12V.

5. Booster Converter :

This converter booster converts a power supply from 5V to 12V. The 5V is recovered from the USB port.

6. Relay :

The relay is used to control the flash power. Indeed, it functions as a switch that allows the voltage to pass over a given logic level.

7. Switch :

The switch selects the power mode of the NodeMCU card. Indeed when the switch is OFF you can directly power the card via USB and load a new code. Disconnect the USB from the NodeMCU board before switching the switch back to the ON position.

Step 2: Wiring of the System

Picture of Wiring of the System

In this part, we will explain the Hardware Design of our product.

  • I- The 5V supply

First, we made a line of 5V supply and a line of ground. To achieve this, we took a standard USB cable and we took the 5V supply and the ground signal. After that, we can connect the nodeMCU and our equipments to this lines.

  • II- The LCD screen

The LCD screen is connected with four wires. First, it is supplied with 5V and the ground. Then, it is connected at the nodeMCU by a I2C bus. We chose the D1 and D2 pin of the nodeMCU.

  • III- The SEN12642

The sound detector is connected with three wires. It is supplied with 5V and the ground. Moreover, the Enveloppe pin is connecter on an analogic input of the nodeMCU. We chose the analog input A0.

  • IV- The flash
  • a) The 12V supply

The flash is supplied with 12V and the ground. We only had a 5V supply. In order to make a 12V supply, we used a booster (regulator) which transform 5V into 12V.

  • b) The command

The flash is working when the average value of the sound is 70dB.

So, we must not supply it everytime. For the command, we use a relay. It is working like a simple interruptor. When the average value is high (70dB), the nodeMCU send a signal which establish the connexion between the 12V and the flash.

  • V- The general interruptor

We use a general interruptor which is places on the top of the box. Its goal is to choose if we want to flash a new code in the nodeMCU. This interruptor cut the 5V supply on the nodeMCU.

Step 3: Arduino Code

Picture of Arduino Code

The aim of this part is to intoduce you the logic and main ideas of the source code.

  • I- Prerequisites:

a) Libraries

At the begining of the code, we need to add at least these 4 libraries:
- : this librairie allows you to communicate with i2c
- "rgb_lcd.h" : the LCD screen librarie
- "math.h" : allows you to use mathematical functions
- : provides the connection to the ESP

b) Network Environment

As you can see in the source code, we decide to use a personal mobile network to create the connection. A WIFI network could also be used.

c) Hardware connections

- We create all PIN's associations (see more in source code)

- threw this order rgb_lcd lcd: we create the LCD object

  • II- Initializations - Setup()


    a) LCD screen Initilization

    - lcd.begin(16,2) : create a LCD sreen with 2 lines et 16 column

    - lcd.setRGB( colorR, colorG, colorB): set the background screen color

    b) Configuring PIN

    We configure each as INPUT or OUTPUT threw these orders:

    pinMode(LEDPIN, OUTPUT);
    pinMode(PIN_GATE_IN, INPUT);

    c) Network Connection

    The connection to the network is really established threw this order: WiFi.begin (ssid, password) --> ssid and password are defined at the begining of the code.

    d) Initialization of a table

    We create a table of 10 empty cells called tab.

    We will see later the aim of this table.

    • III- Main program - loop ()

    a) Connection to a web page

    Data are available thanks to graphs threw the web page : detecteur.mybluemix.net

    b) Value ? dB ? moyenne ?

    First of all, the value picked up by the noise sensor is stored in the variable value:
    -- > value =analogRead(PIN_ANALOG_IN) )

    Then, this value is converted to db an strored in the variable db:
    --> db = 20*log10(value) + 2
    This instantaneous value has a direct impact on the background color of the LCD screen.

    Finally, the variable moyenne is an average of the last ten db value picked up. To calculate this overage, we use the table tab initialized before, where are stored the last 10 db values. We create this variable in order to monitor the red flash which is initiated only when moyenne is higher than 70.

    c) Sending data to bluemix

    We send the db value each second threw a HTTP request
    --> client.print( String ("GET") + ..... )

    Step 4: Noise Remote Monitoring

    Picture of Noise Remote Monitoring

    As we work with a WIFI module, we decided to create a web page which processes the data of our noise sensor. To make our web page more attractive we decided to show these data in decibels on a real time graph and on a gauge to be able to follow the progress of the noise in a classroom.

    Node-red is a Bluemix application which allows us to process ou data in a graphic way. In a first place, we used an HTTP request "get" to

    Step 5: Tutorial

    1. Switch on the system
    2. Wait for the code to be loaded
    3. Connect to the website below :

    https://detecteur.mybluemix.net/ui

    Comments

    DIY Hacks and How Tos (author)2017-03-26

    It would be interesting to see the student's reaction to it.