Blog Home

Arduino speaks without any special hardware

Arduino TeamAugust 24th, 2023

We see many Arduino projects that feature audio output, but they tend to require a substantial amount of additional hardware. Audio files take up a lot of storage space, so they require something like an SD card adapter. Audio signals are analog, so they require a DAC (digital-to-analog converter) to get good quality. And then, to make the audio signal powerful enough for a speaker, these usually need amplifiers. But Scott W Harden found a way to make an Arduino UNO Rev3 talk without any additional hardware beyond the speaker.

In this case, the Arduino can speak any number, from zero to nine, out loud through the speaker. This is possible because those are very short words (most only a single syllable) that are recognizable when the quality is very low. This audio quality wouldn’t be suitable for music or even general language, but it is enough for a sequence of numbers. By reducing the audio quality as much as possible and making the clips short, Harden was able to create audio files small enough to fit in the 32KB flash memory of the UNO‘s ATmega328 microcontroller with room to spare for the sketch.

Harden started with normal MP3 recordings of the spoken numbers. He then performed a 100Hz to 2.5kHz band-pass on the clips, resampled them to 5kHz, and then converted the waveforms to eight-bit unsigned values to store in program memory. The Arduino can then play those waveforms through PWM (pulse-width modulation). A low-pass filter, comprised of a capacitor and resistor, helps smooth the PWM output into something closer to a true analog waveform. An optional LM386 chip can amplify the output, but Harden found that he was able to drive a speaker directly without that.

Boards:Uno
Categories:Arduino