couple of questions

Hey everybody,
I want to ask few questions about ARDUINO-Duemilanove 328, before I buy it.

  1. does it have DAC inside? ( NOT PWM, normal DAC of 8 or 10 bits to analog )?
  2. how many bits are in use on SPI?
  3. I want to work with sound so I need a quick work, do you think 16MHZ will apply me to work with 20KHZ of sound? ( because each command isn't 1 cycle ).

Thanks a lot,
Ofek

  1. No.
  2. It's serial - as many bits as you need.
  3. Incomplete question. 20KHz of sound for how long? How wide are the samples? What do you want to do with them?

arduino can do a 10kHz sample rate...

according to that shannon nyqist theorem that is good for frequencies up to 5kHz... so u would need a low-pass that has a sharp border frequency of about 5kHz...

i dont know if fast fourier transformation can be done in 1600 clock cycles... possibly not... :slight_smile:

but u could find out if the volume is higher than usual or such things...
i like to use this memory saving forumula for such things:

uint32_t avg = 0; // initial average value
avg = (avg*1023/1024+1) + sample;

-arne

The arduino is not good for sound as there is little memory for buffers. See this link for some work that has been done:-
http://interface.khm.de/index.php/labor/experimente/arduino-realtime-audio-processing/

arduino can do a 10kHz sample rate...

according to that shannon nyqist theorem that is good for frequencies up to 5kHz... so u would need a low-pass that has a sharp border frequency of about 5kHz...

i dont know if fast fourier transformation can be done in 1600 clock cycles... possibly not... Smiley

but u could find out if the volume is higher than usual or such things...
i like to use this memory saving forumula for such things:
Code:

uint32_t avg = 0; // initial average value
avg = (avg*1023/1024+1) + sample;

-arne

yeah, I'm gonna checking just the volume...
I put a value that I want to stabilize on him, so I need to check the volume to get higher or lower...

is this OK for this board?

yup - u can use that capacitor + voltage divider trick from grumpy's url...

and my little formula... i dont know if that kind of average has already a name... i call it quick&dirty average... :stuck_out_tongue:

oh - u should transform the sample value to a signed integer and then use the absolute value of it, because u just care for the amount of deviation from silence ("0" depends on the voltage divider)...

-arne

oh so 16MHZ is good for me just to check the volume and calculate the correct one I chose.

My project is like VGA ( Variable Gain Amplifier ).
I put a value ( in db ) which I want to balance on,
then I sample the sound from the mic.
and check if it's lower or higher than I need.
and output a value to change a resistance to an amplifier for changing the gain ( which I need to increase or decrease ).

can you tell me how can I output value in 8 or 10 bits from SPI ?

SPI: Arduino Playground - Spi

reading from a microphone:
maybe u need an amplifier?

just try it... :slight_smile:

e. g.: capacitor between mic amplifier (plus voltage divider) is connected to analog pin #0...

void setup() { Serial.begin(115200); }
void loop() { Serial.println(analogRead(0)); }

then u should c numbers that hop around the middle of the voltage divider...

Maybe u want to use this, 2 (in order to get a better resolution):

but that needs a change in the voltage divider...

-arne