Go Down

Topic: How to capture voice and playback with Arduino (Read 8363 times) previous topic - next topic

un1x

Hi all.

I'm trying to make a (apparently) senseless experiment.
The idea is to capture voice and sound from a microphone and simply riproduce the sound
through a speaker.

I assume that both microphone and speaker has to be connected to the PWM in some way.

I also really don't know what Arduino can read from the microphone PWM and if it's possible to
send these values to the destination PWM.

Any suggests appreciated.

BYE !

Grumpy_Mike

Basically you do not have enough memory to store anything but a small fraction of a second of speech on an arduino.

Therefore you need to get into sound shields with things like SD cards and external d/A converters. There are commercial ones available.

WilliamK Govinda

Hummm, I wonder how fast is the max sample-rate of the analog input...

Depending on what he wants to do, there's no need for much memory. In any event, a cheap FLASH or EEPROM 2-wire chip could do the trick. Just don't know what would be the rates to record and read from those.

Wk

Grumpy_Mike

Quote
Hummm, I wonder how fast is the max sample-rate of the analog input

That is fine, it's not the problem.
You can't write to flash or EEPROM fast enough, especially over the i2c bus. You might just get away with SDRAM on i2c running at 400KHz but you still have the output side, PWM doesn't hack it.

Senso

In the arduino default code its something like 9.6Khz, the maximum is almost 15.2Khz.

un1x

Thank you very much for your replies.

Basically 9.6 Khz is enough for me, telephone quality is acceptable for this project.

I don't need to store the voice recorded but just "route" values from the analog in to the speaker.

Something like:

val = analogRead(..);
analogWrite(val,...);

My confusion is actually on signals and the pin to connect.

Microphone must be amplified and connected to an analog pin, but I don't know how to connect the speaker (PWM ?)
and how to convert analog values read from microphone to something useful and correct to write on the speaker pin.

MIC --> OP AMP --> ANALOG IN (?????) PWM --> SPEAKER

Is it right ?

Thank you very much.

Grumpy_Mike

Quote
I don't need to store the voice recorded but just "route" values from the analog in to the speaker.

So why have it going into the arduino in the first place, surely a piece of wire would do.

Analogue in returns a 10 bit number, the PWM needs only an 8 bit number so you have to convert the sample between reading it and spitting it out. Something like
analogWrite(13, analogRead(0) >> 2) ); would do it.

un1x


Quote
I don't need to store the voice recorded but just "route" values from the analog in to the speaker.

So why have it going into the arduino in the first place, surely a piece of wire would do.

Analogue in returns a 10 bit number, the PWM needs only an 8 bit number so you have to convert the sample between reading it and spitting it out. Something like
analogWrite(13, analogRead(0) >> 2) ); would do it.


Eh eh eh I'm studying this to get in confidence with different kind of signals.
Next step is to send the read value to another arduino via radio to play the voice with a remote speaker.

Grumpy_Mike

Quote
to send the read value to another arduino via radio to play the voice with a remote speaker.

That's the bit I told you that you couldn't do. Best of luck at doing it or redefining the success criteria.

un1x

Mmmmmh .. well, I can't believe isn't possible to build up something easy like a walkie talkie with Arduino  :)

Grumpy_Mike

Used many digital walkie talkies then?  ;)

Analogue transmission is a whole different ball game to digital transmission.

WilliamK Govinda

I think its totally possible, maybe even using a cheaper FM transmitter, but heck, in the Arduino you could use Xbee.

Wk

un1x

Well, for the transmission it's easy to use some radio module.

But I still don't understand if it's correct to send value read from the analag in to the module to the other board :D

And if it's possible to play back again to the speaker.

bye!

Luan

Hi un1x

My Last project (when I was a student) using a PIC record sound from a mic and the phone line the pic buffered it and streamed it to the PC.
I used a 20Mhz Crystal and were able to get 12Khz.

The Microphone Amplifier

A LM324N a low-cost operational amplifier is used to amplify the microphone to an audible level. Two stages are used the first stage gives a amplification of  +- 45 (R7/R2), R5 is set to +- 22K? and the second stage give an amplification of +- 22 ((R9+R5)/R8). The two stages combined give a total amplification gain of 990. R3 and R4 provide a center voltage of 2.5V for microphone and is connected to the first stage. C8 only lest the AC audio signal through.  R11 and R12 provide a center voltage of 2.5V which is connected to the ADC input  on  the Microcontroller.

Attached is the diagram for the MIC interface.

Regards

Luan

Grumpy_Mike

Quote
the pic buffered it and streamed it to the PC.

So how much memory did this PIC have?

Go Up