I’m looking into a DIY walkie talkie project. Is this practical with a microcontroller?
Would an ATmega328P be enough?
XBee supports up to 256 kbps, 22050 Hz audio (16 bit) would take up ~300 kbps. Any easy way to reduce that? I don’t think I can run a voice codec on the microcontroller.
UNO:
The sound quality would be low 8bit as the ADC is 10 bit and I think approx 3-4 KHz
This should be sufficient for low quality speech (think old landline phone).
Robin2:
A cheap off-the-shelf walkie-talkie would almost certainly be much better as well as cheaper and less trouble.
...R
Sure, that is true but I would like to do this for fun
Thanks robtillaart. I doubt 3-4 KHz would be sufficient for very low quality speech, would be just a mess. I thought the 328 can sample the ADC faster though, 200KHz theoretical? I would need about 20Khz
I do have a bit of basic question, would I be able to play sound like this:
Device 1 gets input from microphone ADC (10 bit 20 KHz)
Sends to device 2 via Xbee (215kbps, under 256kbps). No error checking needed.
Device 2 plays (amplifier needed?) it directly to speaker through DAC output
My understanding is that this should be practical for 20 KHz (actually 40 KHz, input and output) - with 16MHz, I would have enough clock cycles, right? And I can read directly from a microphone with ADC, and write to a speaekr via DAC?
thank you, really appreciate the help
Also, I will be writing and attaching the interrupts myself to get rid of the Arduino overhead.
I doubt 3-4 KHz would be sufficient for very low quality speech,
Why do you think that?
3kHz has been standard telephony bandwidth for decades.
The audio bandwidth could be as low as 3000 Hz (from 400 - 3400) and still be intelligible but the digital representation may need more bandwidth. I thought that 64 kbps each way was the bandwidth generally reckoned to be needed for ordinary telephone quality uncompressed voice calls using a naive encoding (for example 8 bit sampling at 8 KHz). How close you could get that to 3kbps without losing quality would depend on how cleverly you encoded (compressed) it. I wouldn't assume that an Arduino could do any clever audio compression/decompression in real time. I haven't experimented with it myself, but my guess is to get good enough audio quality out of an Arduino to make it usable (as opposed to picking words out of the static) would need nearer to 64kbps than 3kbps.
I believe it is practical to support 64kbps, and some simple compression can be done (if two 10 bit samples are the same, which would happen somewhat frequently, don’t transmit it again. Can be done with a little overhead by simply referencing which samples to duplicate at the start of each chunk).
In any case, my biggest question is if I can sample the audio from a mic using ADC, and on the other device send the output using the DAC of the ATMega microprocessor to a speaker and it would play.
I've just done this, using (effectively) the Adafruit MCP4922 Wave Shield, and the MAX9814 Electret Mic breakout.
XBee is only 32 kbit/s user data throughput. That is the limiting factor. Nothing about the AVR ATmega is going to limit this application. I'm getting about 24 kbit/s reliably out of the XBee, which is enough for (quite) low quality voice. But, it can be understood and it does get the message through.