Arduino Decibelmeter

by SanderHesp in Circuits > Arduino

1003 Views, 6 Favorites, 0 Comments

Arduino Decibelmeter

Render 1.png
Render 6.png

In this instructable, I will explain how to make this Decibel meter using Arduino codes and some simple hardware.

we're going to divide this project into 2 parts, making the hardware and programming the software for the decibel meter,

First, we will build the hardware.
Second, we will cover the software.

Explain video:

Supplies

For this project you are going to need:

Hardware:
- Arduino Uno R3 + mounting case
- Grove shield for Arduino Uno
- 5x Grove LED module
- Grove loudness sensor
- Mini Servo with grove connector
- Grove button (rear-mounted)
- 5 LEDs (3mm) (2 Green, 1 Yellow, 1 Red, 1 Blue)
- 9V battery case + battery
- 7x Grove connector cable (10cm)
- 5x 4cm black wire, 5x 4cm red wire

Case:

- 200x200x5mm Plywood plate
- 23x 2mmx5mm screws

Tools:
- Soldering iron + Solder
- Accessibility to a 3D printer
- Accessibility to a laser cutter
- A pair of pliers
- Small screwdriver fitting to the screw of choice
- Wood glue
- Superglue

Lasercutting All of the Plywood for the Base

lasersnij.PNG

The first step is to make the base of the device where we will mount all of our grove modules etc.

You can download the added DXF file and use a laser cutter to make the plate, for this adjust the settings to first engrave all the black lines, then cut all the blue lines, and finally cut the red lines. After that, you need to glue the side button plate on the left side of the main plate, and the plate for the sound sensor on the top. The 2 red blocks need to be glued on the rectangles near the servo for the screws.

Parts/Tools:
- 200x200x5mm Plywood plate
- Accessibility to a laser cutter
- Wood glue

Soldering the LEDs to Have Longer and Adjustable Connectors

Knipsel.JPG
20200329_192224.jpg

To give us a little bit of room to play with, we need to elongate the pegs of the LEDs. Therefore we need to cut the pegs and solder a thin, insulated wire in between. After this, we can glue the LED in any place without having to count in the placement nor size of the GROVE module itself.

After you've modified all 6 LED's, you can glue them in the holes. I just used some superglue and it worked perfectly but all types of glue should work just fine. The 2 left LEDs will be green, the 3th will be the yellow one and the last should be red. The one in the right-most corner needs to be blue.

Parts/Tools:
- 5x 4cm black wire, 5x 4cm red wire
- 5 LEDs (3mm) (2 Green, 1 Yellow, 1 Red, 1 Blue)
- Soldering iron + Solder
- Superglue
- A pair of pliers

NOTE:
Make sure to pay attention to the polarisation of the LED. (The shorter/bent peg is the positive, so red)

Mounting All the Modules in the Right Places

20200329_191343.jpg

Now that you have all the LEDs in place and everything ready to mount, you can start working on mounting all of the remaining hardware. All of the right mounting places are engraved in the wood, with a short indication of which module should go where. You can use the small 2mm screws to mount everything in place. there is no need for any glue in this step.

If all of the modules are screwed in the right places, you can start connecting everything to the Arduino.
Analog Port 1: Sound sensor input
Port 2: Button
Port 3: Servo
Port 4: LED 1 (Green)
Port 5: LED 2 (Green)
Port 6: LED 3 (Yellow)
Port 7: LED 4 (Red)
Port 8: LED 5 (Blue)

Parts/Tools:
- Arduino Uno R3 + mounting case
- Grove shield for Arduino Uno
- 5x Grove LED module
- Grove loudness sensor
- Mini Servo with grove connector
- Grove button (rear-mounted)
- 9V battery case + battery
- 7x Grove connector cable (10cm)
- Small screwdriver fitting to the screw of choice
- 23x 2mmx5mm screws

NOTE:
I found it easier to start with the side-mounted button and top-mounted sound sensor, as these have a tight fit and are rather hard to reach when everything is in place.

- I designed everything to mount on 1 plate. This has the advantage that the decibel meter will remain easy to modify and adjust things as the code etc.

Designing/printing the Front Plate

JPG voorplate.JPG

To make the decibel meter a little bit nicer to look at, we can make the front a tiny bit more interesting by adding a design to the face of the device.

I made a simple concept in Illustrator that you can print out and attach using a thin layer of wood- or spray glue. I also added the Illustrator file so you could edit the design yourself

Making the Case to Cover All the Electronics

Render 2.png

Now that we've got all of the modules mounted and working, we need a way to cover up all of the exposed electronics.

I designed 2 versions to choose from, 1 with, and 1 without a clip at the back to hang the device to a belt, backpack or something similar.

You can download the one you prefer above, and use any 3D printer to print out the back housing to finish your device.

Parts/Tools:
- Accessibility to a 3D printer

Software

Tree tinkercad.jpg

Now that we've got all the hardware connected and setup, we can start working on the software side of things.

I created the base of the code in Thinkercad and added the "ResponsiveAnalogRead" library afterward.

The ResponsiveAnalogRead library smooths the input curve of the sound sensor so that the servo will react a lot smoother and more realistic.

You can download both the code with and without the extra library above.
Just download the code, open it in Arduino IDE and write it to your Arduino via USB type B.
If you've connected the modules and parts correctly, the decibel meter should start working right away.

Explanation of the base code:
First, the analog input of the sound sensor is split into 2 variables: The variable for the servo, with a range between 155 and 25 (GradenServo). And a variable for the LEDs, with a range between 0 and 100 (Ledwaarde)

After that, the code will turn the LEDs 1-4 on or off during specific values of the "Ledwaarde" and set the MiniServo to the correct amount of degrees based on the variable "GradenServo". The 5th LED (blue) will turn on if the variable gets really high. When this happens it also writes another variable called "resetLED" to a value of "1". This means that the blue LED will not turn off automatically.
This loop will repeat, and the blue LED will remain lit. But when the button is pressed, it will check if the variable "resetLED" is equal to "1" (so if the led is turned on) and if this happens, it turns off the Blue led, and writes the "resetLED" variable back to "0".
Now the blue led is turned off again and will remain like this until the "Ledwaarde" gets above 90 again

Another visualization can be found in the flowchart, which can be downloaded from the files added to this step.

NOTE:

If you want to use the ResponsiveAnalogRead, it will not compile, first you need to install the library on your computer, in the explanation video is shown how to install this. After the installation, you can also change certain values like the "setSnapmultiplier" to change how much the software will smooth the input, add a level for the smoothening to start, and much more.