I'm trying to detect variances in sound levels and pass this info to a processing sketch, so that it can use it to draw an image. To do this I purchased the Shifty VU shield, as I figured it was already set up for taking a sound input. the Shift VU site says that the shield 'provides ready to use voltage levels on the Arduino analog pins 2 and 3'. I'm using the following short script to try and get the value coming in on analogue pin two and pass it out via the serial connection to processing:
//Simple Sketch to read a light senor and make shit happen
#define MIC 2
int val = 0; //to pass value coming from MIC
void setup()
{
//Set pin 2 to input
pinMode(MIC, INPUT);
Serial.begin(9600); //Open port 9600
}
void loop()
{
//Pass the input value from port 2 to the integer val
val= analogRead(MIC);
// Print the variable to the serial port
Serial.print(val, BYTE);
// wait 100 miliseconds before repeating
delay(100);
}
The problem is that when I use the println command in Processing to read the value coming in, I get 0.0. Where am I going wrong? I have to admit to being very new to the electronics side of things so if I'm making some kind of obvious error, my apologies in advance. I have looked for example code for working with the Shifty VU, but can't find any. If anyone has a link to online resources, please do share them.
First, I'd look into using analogReference(INTERNAL); in setup{}. Make sure the REFSEL jumper has nothing selected.
Next, you'll need to play with the two pots next to the input jack to get a good sound level for your application.
Finally, what are you plugging into this? It's specced for stereo audio intended for headphones etc. If you're plugging an unpowered dynamic microphone, or even worse an electret microphone for a computer (expects power supply on jack), then there isn't enough signal. Maybe someday we will have a Shifty VU with option mic pre-amp but until then you will need to use another audio source or an external mic amp.
We got it working. It's a very handy bit of kit. We're inputting a powered stereo signal. Thinking of trying a signal from a mixing desk into it to see how it works, though slightly worried about damaging the board. I need to find out what the power from the outs on a mixing desk is. also, what is a safe range with the Shifty.
but a very handy little bit of kit, and well worth the money.
It's unlikely you'll damage it; the op-amps are high impedance and capacitively isolated, all you could do is burn out some resistors. Since the resistors are high value, you'd need high voltage in order to do that. Still, I'd try to avoid putting more than 5V into the audio jack.
macegr:
It's unlikely you'll damage it; the op-amps are high impedance and capacitively isolated, all you could do is burn out some resistors. Since the resistors are high value, you'd need high voltage in order to do that. Still, I'd try to avoid putting more than 5V into the audio jack.
Can this board be set to relays to control a VU meter on 120vac (with relays)?
It is basically a board that filters some stereo audio and makes the result available on two analog pins. Beyond that, it has a ShiftBrite connector and a prototyping area. The ShiftBrite connector is really just some power pins and four SPI pins, could be used for anything. If you wanted to control a bunch of relays you could easily chain up some TPIC6B595 shift registers and directly connect relay coils to that (assuming relay coils are around 150-200mA). That gives you audio input, and a method to turn a lot of relays on and off...the rest is all up to your code. Personally, using this method to build a VU meter with 120VAC light bulbs sounds pretty easy based on previous experience.
macegr:
It is basically a board that filters some stereo audio and makes the result available on two analog pins. Beyond that, it has a ShiftBrite connector and a prototyping area. The ShiftBrite connector is really just some power pins and four SPI pins, could be used for anything. If you wanted to control a bunch of relays you could easily chain up some TPIC6B595 shift registers and directly connect relay coils to that (assuming relay coils are around 150-200mA). That gives you audio input, and a method to turn a lot of relays on and off...the rest is all up to your code. Personally, using this method to build a VU meter with 120VAC light bulbs sounds pretty easy based on previous experience.
This board is sounds really really awesome.
Would you be interested in trading some of these 12" leds (about 200 LEDs in each sign) for 1 Shifty VU?
macegr:
It is basically a board that filters some stereo audio and makes the result available on two analog pins. Beyond that, it has a ShiftBrite connector and a prototyping area. The ShiftBrite connector is really just some power pins and four SPI pins, could be used for anything. If you wanted to control a bunch of relays you could easily chain up some TPIC6B595 shift registers and directly connect relay coils to that (assuming relay coils are around 150-200mA). That gives you audio input, and a method to turn a lot of relays on and off...the rest is all up to your code. Personally, using this method to build a VU meter with 120VAC light bulbs sounds pretty easy based on previous experience.