Go Down

Topic: Voice Recorder using Lilypad (Read 4222 times) previous topic - next topic


recently I get a Lilypad Arduino, a microphone (http://www.sparkfun.com/commerce/product_info.php products_id=8669) and an sd module ( http://www.sparkfun.com/commerce/product_info.php?products_id=8567). My idea is to build my personal voice recorder. I'd like to record voice over long period of time. At the moment, I sample the microphone at 8KHz and put the value in a block of 512 bytes in RAM. When the buffer is full, I store the block in the sd memory writing data at 115200 bps ( it seems to be possible do it). When I recover the data, I can hear a very noisy version of my voice (...something good )  but, in some parts, data are lost ( due to the time lost for writing in the SD, I think!). Is there a way to improve the system at hardware and/or software level? Maybe, it should be better program the Lilypad in assembly. Is it possible?
Thankyou very much!


Dec 17, 2008, 10:12 pm Last Edit: Dec 17, 2008, 10:19 pm by yorx Reason: 1
since I haven't a solution for your problem (maybe some passband frecuency analog/digital filter) :P I'm very much interested in learn how to code it to sample at 8kHz

If you don't mind you could post your code  ;)


void setup(){
        int microphone = 1 ;

void loop(){
       for (int i = 0;i<512;i++){

More or less this is the code. The mapping is for coding with 8 bit. 125 microseconds is ( 1/8kHZ ). That's all.


Using serial communication in that loop is probably using more time than the 125 uS delay, and messing with the 8kHz timing.


it works perfectly if you want to record "more or less" at 8khz and if you don't want the loop to do anything else (can be solved calling another record function "for/while" based)

didn't know map function, interesting...

otherwise you throw it by serial port instead of memory it in the RAM (I'll suppose you did it only for the exaple you post  :))

the sd module seems to powerful because my datalogger only records .txt files  >:(


for MikMo: Looking ad the compiled version of my code ( in the .elf file ), I saw that the line
        buffer = map(analogread(microphone),0,1023,0,255)))
is compiled in 10 instructions. So I really wait 122 microseconds. I put 125 in that code for explaining that 1/8Khz is 125 microseconds.

for yorx: i store the values in ram and after i write the block to the sd. I send to serial port using this code :
In this way, i write in the sd memory at low level. After, when I recover data, I create the "real" file wave! So, i think that if you write your data at low level, your sd also can be such powefull! :)

thankyou for answering!

Go Up