I'll start by saying I'm completely new to the Arduino and circuitry in general but have a project I need to complete for work and was hoping I could get some guidance on my current roadblock. I'm looking to take an error sound generated from a computer and use the 3.5mm output from the computer as an input into the Arduino; then perform an output that would send a signal to a controller on a conveyor to shut down.
According to one of our electrical guys, the controller is older and we're unable to set a minimum threshold for what voltage would trigger the shut down. Initially I thought I could put together a VU meter from a tutorial and then modify it to take an output from one of the last lights to use as my signal wire to the controller. After setting up the meter though I'm measuring around 0.1v at the end of the 200 ohm resistors. When a sound is played the voltage jumps up to about 1v like I expect but I still need to clear any voltage off the line when a sound is not being generated.
I've put together the VU meter from this tutorial: http://arduinoarts.com/2011/08/uv-meter/
Here is a drawing of how I have everything laid out.
Below is the code I have loaded into the Arduino right now, taken from the tutorial I linked above:
/* UV Meter (via Headphone Output)
- @author: Javier Lander
- @hardware: Javier Lander
- www.mrlndr.com
- twitter: @mrlndr
*/int pinArray[] = {2, 3, 4, 5, 6, 7};
int count = 0;
int timer = 10;
int sensorValue = 0;
int countmax;
int knockSensor = 5;
int val = 0;
int statePin = LOW;
int THRESHOLD = 100;void setup(){
for (count=0;count<6;count++) {
pinMode(pinArray[count], OUTPUT);
}
}
void loop() {
sensorValue = analogRead(knockSensor);
if (sensorValue < 100) {
countmax=1;
}
else if (sensorValue < 300) {
countmax = 2;
}
else if (sensorValue < 350) {
countmax = 3;
}
else if (sensorValue < 400) {
countmax = 4;
}
else if (sensorValue < 450) {
countmax = 5;
}
else if (sensorValue < 500) {
countmax = 6;
}
for (count=0;count <= countmax;count++) {
digitalWrite(pinArray[count-1], HIGH);
}
for (count=6;count > countmax;count--) {
digitalWrite(pinArray[count-1], LOW);
}
}
From what I've tested, this voltage is present even when I don't have the input from the 3.5mm hooked up to the board. Do you all have any recommendations on what I could do to filter out that small amount of voltage I'm picking up? Would a different size resistor take care of this, or am I looking at scrapping what I've got and starting over with a different design and code?
Any help or advice is greatly appreciated.
Thanks