In this article we are going to discuss how to design an audio meter by using Arduino UNO board. This meter enables us to see the intensity of left and right channels on the 16×2 LCD as bars which is provided as input to the Arduino UNO board. In this the Arduino analog pins are used for the measurement of levels of audio signals. The audio meter is designed by using Liquid Crystal Display (LCD) and VU meter or also known as standard volume indicator (SVI). The input of audio signals are provided on the A2 and A4 pins of the Arduino UNO board and these input can be a form of voice which is coming from microphone or directly coming from a music player.
Components for Audio Meter
Component needed for the project is as follows:
- Arduino UNO board.
- 16×2 LCD.
- 10 kilo ohm potentiometer or potmeter.
Arduino UNO board:
EN and RS pins of the LCD are connected to the pins 11 and 12 of the Arduino and pins D7, D6, D5 and D4 of the LCD are connected to the pins 2 to 5 of the Arduino board.
To display the input signal on the bars the LCD JHD162A is used it is a display module which consist of 4 bit interface. For this project only 4 data pins of LCD is being used.
In order to control the contrast of the LCD screen display a 10 kilo ohm potentiometer is used and it can be varied as per requirement.
Circuit diagram of Audio Meter:
At the Arduino UNO board the input i.e. analogue input signals is provided on the analog input pins A2 and A4. The input signals are then processed by the ATmega328 and after doing some comparisons output is sent to the LCD to display it as level bars.
Below is the circuit diagram of Arduino based audio meter:
Below is the picture of the prototype of Audio meter:
As shown in prototype the L is used on the LCD to display left channel and R is used to display right channel the height of the bars depend on the voltage of the input signals. The configuration of the A2 and A4 pins should be done carefully so that proper input channel is provided to the circuit.
Custom characters are used in order to display bars on the 16×2 LCD, which are explained in coding section.
Coding Section of Audio Meter:
The program of this project do the following things:
- First it initializes the circuit and LCD.
- Then welcome message is displayed on the LCD.
- Custom characters are generated for bars.
- Number of comparisons are done at the analog input pins with input signals.
- Then finally display the output on the LCD as bars those height varies according to the input signal.
Consider the following section of code:
Array p3 to p7 are used in this program to display bar height on the LCD and arrays L and R are used to display letters L and R on the LCD and array is used to display special characters at the end of both rows and LEEG is used to create characters for bar shape.
LiquidCrystal lcd (12,11,5,4,3,2);
This function is used to configure the LCD.
Following are the functions used in the code and their description:
|Void setup()||It is used to configure the pins of ATmega328 on the Arduino board.|
|Lcd.begin(16,2)||It represents the size of LCD.|
|Serial.begin(9600)||Used to enable serial communication with Arduino with 9600 baud rate.|
|Lcd.print(“VU METER”)||It is used to display welcome message on the LCD.|
|Void loop()||Used to enable task to run infinite times.|
|analogRead(inputPin)||This function will read the input from Arduino analog pins.|
Complete Code of Arduino based Audio meter:
Below is the complete code for audio meter: