8x8 Dot Matrix Sound Level Meter

by jandb86 in Circuits > Arduino

1707 Views, 13 Favorites, 0 Comments

8x8 Dot Matrix Sound Level Meter

00_Overview.jpg

Previously I introduced Arduino base Sound Level Meter circuit (From hereinafter as SLM) circuits using simple LEDs.

This time let’s change the visual effect with a more multifunctional 8x8 LED dot matrix display.

Although the previous SLM used Adafruit MAX4466 MIC-Amp break-out, this time the old is but good pre-amplifier circuit that utilizes op-amps (NE5534, TL071) is reused for capturing audio signal.

When using a single line (with 10 LEDs) of the sound level display, only present audio input is suddenly displayed and disappears quickly without showing any trend of sound strength changes.

That’s why I’m considering using an 8x8 LED dot matrix.

As the LED matrix support 8 lines of display space, it can show 8 times of sound level change when input data shift consciously to the left.

If you cascade two LED matrixes, you can see a total of 16 frames of audio sound level changes.

As a result, you see a change of sounds in a more interesting manner.

Let's look at more details about this new SLM device.

Schematics

01_Schematics_8x8.jpg

When you looked at the schematics above, the same old pre-amplifier circuit is reused instead of the Adafruit MAX4466 MIC-Amp breakout board.

The sound voltage captured by electrets MIC fed to pre-amplifier and subsequently connected to analog A0 port of the Arduino Uno board.

As this pre-amplifier requires 12V input voltage, the same voltage of the power supply is connected to the Arduino Uno board.

The Arduino Uno board has a circular-shaped power socket (Usually it is connected with a 9V~12V wall socket adapter) and output power from LM7812 is directly connected to this socket.

When you buy two units of hardwired 8x8 dot matrix display, you don’t need to solder anything.

But as bought two separate 8x8 dot matrix displays, I need to connect 5 lines (Vcc, GND, DIN, CS, CLK) of matrix modules.

Overall hardware wiring for this circuit is relatively easier than others as only 5 lines are connected between the dot matrix display and Arduino.

But controlling the two 8x8 dot matrices is not easy and entirely dependent on the sketch program that will be explained in other steps below.

For simplifying overall circuitry, I didn’t add 100K potentiometers used in the previous Arduino-based SLM shown in the project page link below.

 

https://www.instructables.com/Sound-Level-Meter-With-Arduino/

 

Instead of adding a complex sound level controlling mechanism (base and gap control) with two VRs, careful sound level calculation is carried out and applied to the sketch program.

I’ll explain in detail how LEDs are controlled with pre-defined sound level threshold values.

Parts

02_Parts.jpg

The most important part of this SLM is the 8x8 dot matrix displays that can be seen on the bottom side of the picture shown above.

As I bought two individual 8x8 dot matrix modules, 5 wires are soldered together and two displays are mounted on universal PCB and fixed together.

The following parts are used for this SLM circuit.

***

The pre-amplifier requires the following parts.

- FQ-057 electrets MIC

- NE5534, TL071 op-amp IC

- 1/4W 47K, 100K, 10k, 27K, 22K resistors

- Potentiometer 10K

- Electrolytic capacitors 2.2uF, 4.7uF x 2EA, 10uF x 2EA all rated more than 50V

- Film capacitors 100nF 50V

***

For the controlling and sound level displaying, the following parts are used

- Arduino Uno board, 5V

- 8x8 dot matrix module x 2EA

- LM7812 regulator

- 0.33uF film and 0.1 ceramic capacitors

- Wires, Pin-head, Universal PCB

- Acrylic boards, metal PCB supporters

***

As I introduced many other SLM circuits, I’ll not explain details about parts used, wiring components together, and soldering all parts on PCB.

You can see other Instructables for details about wiring and soldering of all parts explained above.

Digital Processing of Audio Signal

03_Processing.jpg
04_SD.jpg

As the audio sound capturing device is changed (such as from MAX4466 MIC Amp to an old op-amp-based pre-amplifier), the sound level pattern also changed.

But similar to the MAX4466, input audio signal voltage levels are about 30mV to 3.8V range.

Initially, I tried to figure out the signal range by viewing printed data on a 16x2 character LCD module.

But later I added an SD card reader to Arduino Uno to get the detailed data for 20 minutes length of various YouTube videos.

Firstly I started to capture sound data from common news broadcasting videos.

Subsequently, very noisy hip-hop music video and later capturing sound data level of documentary video.

When you look at the picture above, the sound levels (300~400) suddenly peak up from the middle part of the graph.

That part of the data was captured from the hip-hop music video.

The data included in the red box are showing the dynamic and active sound levels. (From 100 to 400)

As the active sound input range is about 300, this value is divided by 8 (LED display levels of 8x8 dot matrix).

Then the following sound level base and gaps between levels are defined.

***

All LEDs are off when level < 100

Turn on 1 LED among 8 LEDs (1 column of 8x8 matrix) when level > 100 and level < 137

Turn on 1 and 2 LEDs among 8 LEDs when level > 137 and level < 174

Turn on 1, 2 and 3 LEDs among 8 LEDs when level > 174 and level < 211

….

Turn all LEDs when level > 359

***

For each 37 (0.037V) audio input level, one more LEDs are turned on to show the present sound strength level.

When the recording volume of a certain YouTube video is very high (such as more than 300), the 10K potentiometer included in the pre-amplifier can adjust the amplification ratio to get a reduced (200~300) level of audio signal voltage.

This method is more simple and more intuitive than using a complex control mechanism with two potentiometers (setting base and gap values) in the previous SLM project.

The Sketch Program

05_sketch.jpg

As explained in the step right before, the audio signal voltage is recalculated (ex: level = volts * 100) to produce a sound level value.

Subsequently, the calculated sound level mapped to the number of LEDs to be turned on.

For an 8x8 dot matrix display, an internal controller chip (MAX7219) decodes how many LEDs are turned on like below.

***

// bar pattern

byte bit0 = 0x00; // All LED turn off

byte bit1 = 0x80; // LED 1 turned on within column (8 LEDs in the one column)

byte bit2 = 0xC0; // LED 1, 2 ON

byte bit3 = 0xE0; // LED 1, 2, 3 ON

byte bit4 = 0xF0; // LED 1, 2, 3, 4 ON

byte bit5 = 0xF8; // LED 1, 2, 3, 4, 5 ON

byte bit6 = 0xFC; // LED 1, 2, 3, 4, 5, 6 ON

byte bit7 = 0xFE; // LED 1, 2, 3, 4, 5, 6, 7 ON

byte bit8 = 0xFF; // LED 1, 2, 3, 4, 5, 6, 7, 8 ON

***

As shown on the top right side of the picture above, each LED pattern and its hexadecimal code is depicted.

According to the calculated sound level values (multiples of 37), LED pattern values are calculated from t1 to t8 times like below.

***

if (level > 100 && level < 137) {

    audio = bit1;

    // Serial.println("*");

}

else if (level > 137 && level < 174) {

    audio = bit2;

    // Serial.println("**");

}

else if (level > 174 && level < 211) {

    audio = bit3;

    // Serial.println("***");

}

else if (level > 211 && level < 248) {

    audio = bit4;

    // Serial.println("****");

}

else if (level > 248 && level < 285) {

    audio = bit5;

    // Serial.println("*****");

}

else if (level > 285 && level < 322) {

    audio = bit6; 

    // Serial.println("******");

}

else if (level > 322 && level < 359) {

    audio = bit7;

    // Serial.println("*******");

}

else if (level > 359) {

    audio = bit8;

    // Serial.println("********");

}

else if (level < 100) {

    audio = bit0;

    // Serial.println(" ");

}

***

Among two 8x8 dot matrices, eight LED pattern data (byte) are stored in the left byte array while another 8 LED pattern data are stored in the right byte array.

As shown in the picture above, the first sound level data is entered and stored in the right byte array like below at t1 time.

***

Byte array right = (

0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0xF0 }

***

When second sound level data is entered at t2, shifting (to left) all data in the right byte array to enter new data like below.

***

Byte array right = (

0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0xF0, 0xF8 }

***

Likewise, each data in left and right byte arrays are shifting when new data is entered from t1 to t8 as shown in the picture above.

At each time slot from t1 and t2, the 8x8 dot matrix display is updated with the following “LedControl” library codes.

***

int i = 0;

for(i=0;i<8;i++) {

     lc.setRow(dev,i,character[i]);

}

***

According to the LED pattern hexadecimal codes stored in the left and right byte array, the “LedControl” library setRow command turn on one column of the 8x8 LED matrix.

Until now I keep saying column of 8x8 matrix, but actually, the command mentioned above is a row!

It seems like a mistake in the code above.

But many Chinese 8x8 dot matrix manufacturers are usually making the device (wiring internally) as 90 degrees rotated clockwise.

Therefore, if you want to display a column then you should use setRow command.

Then it makes the same result of rotating display as 90 degrees clockwise! (I know this explanation will make it confusing. But it’s true!)

In a conclusion, before displaying the LED pattern on the 8x8 matrix, you can shift sound level hexadecimal data and insert newly captured values to the left and right byte arrays.

Actual LED pattern showing happen after changing data.

This way you can show continuously shifting LED patterns on the two cascaded 8x8 dot matrix displays.

Operating and Conclusion

06_Operation.jpg

You can see the operation of this SLM in the following video link.

 

https://drive.google.com/file/d/11DEErkeX5OD9tWxHEpNY4DoFcYqWqzkd/view?usp=sharing

 

Actually, a similar 8x8 matrix LED pattern displaying method is utilized for making bicycle backlight in other Instructable below.

 

https://www.instructables.com/Bicycle-Backlight-With-Arduino/

 

Only one 8x8 LED matrix is used for making the backlight.

But LED pattern-making method is the same as explained in the step above.

 

Thank you for reading this story.