Audio Visualizer With An LCD Display
Audio Visualizer With An LCD Display
by Applexanand
Music visualization is greatly seen on EDM concerts, where artists team up with VJs (or video jockeys) to create visual
spectacles, that can attract and mesmerize the audience. This can be done with video editing and e ects software such
as Davinci Resolve Fusion and Adobe After E ects. However, this can also be achieved using hardware.
In this Instructable we're gonna create a simple and easy-to-make audio visualizer using an Arduino UNO, a sound sensor
or a microphone, and a 16x2 LCD display. So without further ado, let's get started
Supplies:
Here are the list of components required for creating this project
16x2 LCD display
Arduino UNO (or Nano)
Two 1kΩ resistors
LM393 Sound Sensor Module
Jumper Cables and Breadboard
A computer for uploading the code
Here are the following connections for both LCD and Sound Sensor Module to the Arduino UNO. This breadboard
diagram was made on a software called Fritzing.
I won't be going on too long with the technical details here, just where you need to connect and why.
LCD Connections
1. VSS and VDD to 5V and GND respectively, to power the LCD.
2. V0 connected to a 1k resistor and then to GND. We are not changing the contrast of the LCD here, so the
LCD will show the characters clearly.
3. RS (Register Select) to pin 13. It is con gured to give value HIGH so that Data Register is selected (you
don't need to know what a Data Register does, just that it helps in transferring data to the LCD)
4. R/W (Read/Write) to GND. We con gure the R/W pin to value LOW so that we can write data to the LCD.
5. E (Enable) to pin 12. This is used to latch (keep all the data coming from the Arduino to the data pins.
6. pins D4-D7 are connected to pins 11 to 8 respectively. They are the data pins which will transfer data from
Arduino to the LCD display
7. LED+ is connected to 1k resistor and then to 5V, and LED- to GND. This is for the LED backlight, which will
cause the LCD display to glow.
Audio Visualizer With an LCD Display: Page 3
Sound Sensor connections
The Sound Sensor Module detects the sound via a microphone and feeds into an op-amp (LM393-dual comparator). It
has 4 pins
VCC - Powered by +5V
GND - Ground
Analog pin (AO) - Analog output connected to analog input of microcontroller
Digital pin (DO) - Digital output connected to digital input of microcontroller
After following the steps exactly as mentioned, you are good to upload the program.
The above image is the schematic of the circuit, also made on Fritzing.
I have created a program for the same circuit. If you have followed the exact steps for building the circuit, you can upload
the code directly to the Arduino Board, or you need to change some parameters according to your connections.
Following is the code for my circuit.
#include <LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
int soundsensor = A0;
void setup() {
// put your setup code here, to run once:
pinMode(soundsensor, INPUT);
Serial.begin(9600);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Audio Visualiser");
delay(2000);
}
void loop() {
// put your main code here, to run repeatedly:
long sum=0;
int sensorVal= analogRead(soundsensor);//Input from soundsensor
Serial.println(sensorVal);
for(int i=0;i<100;i++){
sum+=sensorVal;
}
sum=sum/100;
/* here we are comparing the soundsensor values with the pre determined values (selected at random). If it goes above the pre dertermined value, the character will be displa
yed*/
if(sum>195){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("#");
lcd.setCursor(0,0);
lcd.print("##");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("#");
delay(t1);
}
if(sum>200){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("##");
lcd.setCursor(0,0);
lcd.print("####");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("#");
lcd.setCursor(0,0);
lcd.print("##");
delay(t1);
}
if(sum>205){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("###");
lcd.setCursor(0,0);
lcd.print("#####");
delay(t);
}
else{
lcd.clear();
Audio Visualizer With an LCD Display: Page 5
lcd.clear();
lcd.setCursor(0,1);
lcd.print("##");
delay(t1);
}
if(sum>210){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("####");
lcd.setCursor(0,0);
lcd.print("######");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("##");
delay(t1);
}
if(sum>220){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("#####");
lcd.setCursor(0,0);
lcd.print("########");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("###");
delay(t1);
}
if(sum>230){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("#######");
lcd.setCursor(0,0);
lcd.print("#########");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("###");
delay(t1);
}
if(sum>240){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("########");
lcd.setCursor(0,0);
lcd.print("#########");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("##");
delay(t1);
}
if(sum>260){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("############");
lcd.setCursor(0,0);
Audio Visualizer With an LCD Display: Page 6
lcd.print("##########");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("#");
delay(t1);
}
if(sum>280){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("##############");
lcd.setCursor(0,0);
lcd.print("############");
delay(t);
}
else{
lcd.clear();
lcd.setCursor(0,1);
lcd.print(" ");
delay(t1);
}
Serial.println(sum);
}
You can also modify the code to obtain di erent results. Feel free to post your modi cations in this Instructable
If you have any problems in uploading the code from the code box, I have also attached the code le, which contains the
same program as in the code box.
Download
https://www.instructables.com/ORIG/F52/XG79/L3ZW07DL/F52XG79L3ZW07DL.ino
https://youtu.be/jtUPyxDADf8