12 years, 9 months ago.

admp401

I am using admp 401 breakout board( sound sensor) from sparfun. I want to use in on my mbed lpc1768. is it possiable my connection are AUD to AnalogIn p20 GND to GND Vcc to Vout(3.3v)

can someone help me with the code please. i am thinking of using teraterm for display.

regards

2 Answers

12 years, 9 months ago.

Yes you can connect it to any AnalogIn pin. You could then output that to Teraterm, however I doubt you will get useful information from that. For sampling human speech you need to output it at least at 10kHz or something like that, so you would see only number flashing by really fast on TeraTerm.

that is true my values are useless i can't do anything with it...what would you suggest i use instead??

posted by Krishna Ale 08 Mar 2013

That depends on what your goal is with the sensor.

For example you could compare the analogIn value with a threshold value, when it is higher than the threshold value you enable a LED, and start a TimeOut object for lets say 1 second. To that TimeOut object you attach a function which disables the LED. That would probably be the simplest thing you can do with such a sensor, then you effectively detect if the sound is above a certain value.

posted by Erik - 08 Mar 2013

my aim is simply read the output from the sensor and get the output when some sound is applied. thats all i am trying to do. i have only used this mbed for few weeks so i am not sure of the code not really experienced on coding, this is what i am using just now. and it just gives me 0.50. on teraterm. i don't know what to make of this results and it doesn't change when the sound is applied. i am pretty sure my code is not right though. if you see anything please correct me. regards

include "mbed.h"

AnalogIn ADMP(p20);

DigitalOut P16(p16); DigitalOut P17(p17); DigitalOut P18(p18); DigitalOut P19(p19); DigitalOut P15(p15);

Serial pc(USBTX,USBRX);

int main() { float audio;

while(1){

audio = ADMP. read();

Serial pc(USBTX,USBRX);

printf("Audio = %5.2F dB\n\r",audio);

wait(0.5); } }

posted by Krishna Ale 08 Mar 2013

0.5 could be possible, but if you make enough sound (or just with your finger tapping it), it should move to something else than 0.5.

Btw code tags make your code easier readable <<code>> and <</code>>

posted by Erik - 08 Mar 2013

does my code look ok.

posted by Krishna Ale 08 Mar 2013

Start with <<code>> on a seperate line, end with <</code>> again on a seperate lane.

Your second definition of Serial pc makes no sense (from your while(1) loop). Besides that it should work, not very useful, but it should function. Tap it with your finger and I expect you see other values.

posted by Erik - 08 Mar 2013

i changed few things in my code and the value does go up now,pretty random but its something. that serial pc is meant to be a a comment. i am still learning. thanks for your help. much appreciated regards

posted by Krishna Ale 08 Mar 2013
Krishna Ale
poster
12 years, 9 months ago.

i need help with code the most.