icon

Arduino Bar graph Stereo VU meter on VFD display GP1287

   A VU meter, also known as a Volume Unit meter, is a device used to display the audio signal level in decibels (dB) in real-time. It is commonly found on audio equipment to help users monitor and control audio levels. Some time ago, in one of my previous videos , I presented to you Analog style retro look VU meter on VFD display. 
 

  This time, I will also describe a way to make a VU meter on the VFD Display, but this time in the form of a Bar Graph. A bar graph VU (Volume Unit) meter is a type of audio level meter that represents the intensity of an audio signal using a series of bars. These bars visually indicate the amplitude or volume of the audio signal across a range. 

 

In this meter, each bar corresponds to a particular volume level or decibel level. In this case, unlike the previous project, the response of the Vu meter in relation to the input signal is instantaneous (instantejnius). The display is again of the GP1287 type with a resolution of 256 by 50 points, and it can be obtained at a relatively cheap price.
 

 The device is extremely simple to build and contains only a few components
 - Arduino Nano Microcontroller
 - GP1287 VFD Display
 - 10K stereo potentiometer,
 - Four resistors,
 - and two capacitors and diodes 
 On the occasion of the upcoming Christmas and New Year holiydays visit the PCBWay Christmas Big Sales where you will found discounts of up to 50%, as well as many other prizes and benefits. PCBway is one of the most experienced PCB manufacturing company in China in field of PCB prototype and fabrication. They provide completed PCB assembly service with worldwide free shipping , and ISO9001 quality control system. Also, on their site there is an online gerber viewer where you can upload your gerber and drill files to render your board.

 The signal from both audio channels (left and right) is brought to the analog inputs of the Arduino microcontroller. After that comes a circuit called "Enveope Follower" with a filter. 
 

 

  As for the code, I took the idea from a similar OLED VU meter project, but it used the Adafruit_GFX library, which is not compatible with VFD displays, so I created a new code with the U8G2 library, which has support for this type of display. The sensitivity of the VU meter can be controlled with the potentiometer mounted on the back of the device.
 

 Due to the relatively high consumption of the display, it is preferable to power it through the power connector of the display itself, which is shown in the picture. 
 

The device is installed in a suitable box made of PVC material with a thickness of 5 mm and covered with colored self-adhesive wallpaper.

CODE
#include <U8g2lib.h>
#include <SPI.h>
 
U8G2_GP1287AI_256X50_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); 

 int  an_izm_r , an_izm_l ; 
 int  ur_l , urr_l , ur_r , urr_r ;


 void setup(void) {
  u8g2.begin(); 
  u8g2.setContrast(15); 
  u8g2.enableUTF8Print();
  u8g2.setFont(u8g2_font_7x14B_tf);
  analogReference(INTERNAL); 
  pinMode(A0,INPUT);
  pinMode(A2,INPUT);
 }

void  loop ( )  { 
  an_izm_r  =  analogRead ( A0 ) ; 
  an_izm_l  =  analogRead ( A2 ) ; 
   urr_l  =  an_izm_l ; 
   urr_r  =  an_izm_r ; 
  if ( urr_l < ur_l ) { ur_l = ur_l - 15 ; } else { ur_l  =  an_izm_l ; } 
  if ( urr_r < ur_r ) { ur_r = ur_r - 15 ; } else { ur_r  =  an_izm_r ; } 
 testfillrect ( ) ; 
 }

 void  testfillrect ( void )  { 
   u8g2.firstPage();
  do {
  u8g2.drawFrame(0,0,256,50);  
  u8g2.drawRFrame(2,2,252,46,3);
  u8g2.drawFrame(5,18,170,14);  
  u8g2.setCursor(16, 30); u8g2.print(F("-20"));
  u8g2.setCursor(77, 30); u8g2.print(F("-10"));
  u8g2.setCursor(140, 30); u8g2.print(F("-3"));
  u8g2.setCursor(8, 16); u8g2.print(F("R"));
  //u8g2.drawFrame(5,4,10,14);
  u8g2.setCursor(8, 44); u8g2.print(F("L"));
  //u8g2.drawFrame(5,32,10,14);
  u8g2.drawBox(18,5,4,11);
  u8g2.drawBox(18,34,4,11);
  u8g2.setFontMode(1);
  u8g2.drawBox(175,18,76,14);
  u8g2.setDrawColor(2);
  u8g2.drawStr(182, 30, "0"); 
  u8g2.drawStr(210, 30, "+3 db"); 

   u8g2.setColorIndex(1);
   for ( int  i = 20 ; i <= ur_r ; i += 4 ) { 
   u8g2.drawBox ( i ,  5 ,  2 ,  11 ) ; 
 }
    for ( int  i = 20 ; i <= ur_l ; i += 4 ) { 
  u8g2.drawBox (  i ,  34 ,  2 ,  11  ) ; 
   
   }
    }
    while ( u8g2.nextPage() );
 }
 
   
License
All Rights
Reserved
licensBg
0