# vu meter with 74hc595

hi,

i want to do a vu meter like that

but i don't know how to do

thanks for your help ; )

How much programming of the Arduino have you done ?

It seems like you need to get the value to be displayed into a 16 bit variable then shift it onto the 2 shift registers for display. You obviously found the image of the circuit on line. Has the site where you found it got any code ?

What is the purpose of the 8 LEDs at the bottom right ?

i found it here

http://www.arduino.cc/en/Tutorial/ShiftOut

forget the 8 LEDs at the bottom right it's not important

so if you have got a code to a vu meter using 2 74HC595, i m here ; )

I don't have any VU meter code and even if I did I would expect you to have made some effort before letting you have it. Have you tried the examples on the page you linked to ?

There is one important error in that circuit diagram. The sound signal from the phone (or whatever source) swings around 0V (it’s an AC signal). The ADC of the Arduino reads values between 0 and 5V. The audio signal will for a significant portion of the time (around 50%) be in the negative voltage range. This will be outside the specifications of the input to the Arduino.

You should isolate the phone with a capacitor, then shift the signal up 2.5V using a voltage divider.

Then what you want to do is program something that does the following:

2. Subtract 512 from the value (the 2.5V offset), and take the abs() value (discard the sign) of the value.
3. Map the value to 0-16
4. Convert that value to a 16-bit value for the LEDs you want on (say 2x-1)
5. Shift that value out for display on the LEDs.
6. Repeat

I’ll leave you to work out what you can program from that and what you need help with.

yes i have try the examples.

i have done a 1° vu meter with this code :

``````int led[14] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; // Assign the pins for the leds
int leftChannel = 0;  // left channel input
int left, i;

void setup()
{
for (i = 0; i < 14; i++)  // Tell the arduino that the leds are digital outputs
pinMode(led[i], OUTPUT);
//  Serial.begin(9600); // Uncomment to enable troubleshooting over serial.
}

void loop()
{
// Serial.println(left);  // uncomment to check the raw input.
left = left / 50;    // adjusts the sensitivity
//  Serial.println(left);  // uncomment to check the modified input.
// left = 1500;  // uncomment to test all leds light.
// left = 0;    // uncomment to check the leds are not lit when the input is 0.

if (left == 0)  // if the volume is 0 then turn off all leds
{
for(i = 0; i < 14; i++)
{
digitalWrite(led[i], LOW);
}
}

else
{
for (i = 0; i < left; i++) // turn on the leds up to the volume level
{
digitalWrite(led[i], HIGH);
}

for(i = i; i < 14; i++)  // turn off the leds above the voltage level
{
digitalWrite(led[i], LOW);
}
}
}
``````

(just with my arduino uno outputs)

now, i would like to do a similar vu meter but with more outputs.

but i begin in the programmation and i need help to do this new project

as i said, i m not the best in the programmation

so i have not idea to do this :fearful:

All the individual operations are well documented with examples. Find an example that does the part you want to work on, and see from that how it does it. Adapt it into your own program.

For instance, the reading of the analogue value would be done with analogRead(). The mapping of the values could be done with the map() function, etc.

An alternative to using an Arduino and shift registers - do a Google search for LM3915 VU meter.

dannable: An alternative to using an Arduino and shift registers - do a Google search for LM3915 VU meter.

That's no fun though :P

I have already tried to do this but the "Shifting-Out" with 74HC595 it s to dificult for me :.

Everything you need to know about shifting is here: http://arduino.cc/en/Tutorial/ShiftOut

i know

i have already read that but to program a vu meter it s not easy

thanks dannable for your answer but i realy want to use arduino

Sorry to burst your bubble, but actually programming a VU meter is child's play.

I have given you the sequence of what you need to do - most of those steps equate to just one or two lines of code.

i have found this

``````int current;
int highest = 350;
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
int volume[9] = {0b00000000, 0b00000001, 0b00000011, 0b00000111,
0b00001111, 0b00011111, 0b00111111, 0b01111111,
0b11111111};

void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
current = map(analogRead(A0), 0, highest, 0, 9);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, volume[current]);
digitalWrite(latchPin, HIGH);
}
``````

but that don't work.

do you know why ?

What happens when you run the code ?

No, I don't know why.

In what way doesn't it work? Doesn't it compile? Does it compile but not give you the output you expect...?

Is your system wired the same way as for that code?

How about adding some serial debugging so you can see what the values are it comes up with...

when i put it into the arduino, that don't work.

im sure my installation is good

and there is that :

"Taille binaire du croquis : 2 824 octets (d'un max de 30 720 octets) avrdude: stk500_getsync(): not in sync: resp=0x00"