hi all,
i'm working on class project , need (urgent!) in figuring out. have microphone goes through low pass filter. if run 1000hz sound our phone, on oscilloscope giving amplitude of 300 mv , if run 10k hz sound through microphone, giving amplitude of 30 mv or so. however, unable detect amplitude of these sine waves on arduino, , realized analogread function giving dc-rms voltage(1.6v in case) both frequencies. need know how figure out amplitude can differentiate between 1k , 10k hertz frequencies our phones. here's test program i've been writing figure out:
i'm working on class project , need (urgent!) in figuring out. have microphone goes through low pass filter. if run 1000hz sound our phone, on oscilloscope giving amplitude of 300 mv , if run 10k hz sound through microphone, giving amplitude of 30 mv or so. however, unable detect amplitude of these sine waves on arduino, , realized analogread function giving dc-rms voltage(1.6v in case) both frequencies. need know how figure out amplitude can differentiate between 1k , 10k hertz frequencies our phones. here's test program i've been writing figure out:
code: [select]
int sensorpinlowpass = a3;
int sensorpinhighpass = a0;
int sensorvaluelowpass = 0;
int sensorvaluehighpass = 0;
float counter = 0;
float sum = 0;
int counterfinal = 10000;
int testnum = 1000;
int testcounter = 0;
void setup() {
serial.begin(9600);
}
void loop() {
while( counter < counterfinal){
// read value sensor:
sensorvaluelowpass = analogread(sensorpinlowpass);
//sensorvaluehighpass = analogread(sensorpinhighpass);
//serial.println("amp low pass");
//serial.println(sensorvaluelowpass);
//serial.println("amp high pass");
//serial.println(pow(sensorvaluehighpass, 2));
sum += pow(sensorvaluelowpass, 2);
//serial.println(sum);
counter++;
}
if(counter == counterfinal && testcounter < testnum){
float finalval = sqrt(sum/counter);
serial.println("finalval");
serial.println(finalval);
sum = 0;
counter = 0;
testcounter++;
}
}
quote
and realized analogread function giving dc-rms voltage(1.6v in case) both frequencies.no not, giving sample can anywhere between maximum , minimum peak values.
to envelope need either:-
1) put envelope follower between audio output , arduino input. can simple series diode , capacitor ground.
2) sample quick possible , record maximum value , hope somewhere close peak value. analogue digital converter can sample @ 10khz probbly not close this.
Arduino Forum > Using Arduino > Project Guidance > Amplitude Detection
arduino
Comments
Post a Comment