Audio speaker !

30 Dec 2010 . Edited: 30 Dec 2010

Hi !


I currently trying to build an audio filter (with mbed, off course !)

But I am not an expert of signal processing....

When I still in analogue :

I connectedly my audio output (jack) to my speaker : Boney M is still singing !

When I go in numeric :

I connect my jack + on an input


DigitalIn in(p20);


My jack - on the GND, my speaker + on the p18.


DigitalOut out(p18);

my speaker - on an the GND


Let's go !

I just want (that just the beginning ) to copy the entry on the exit (that english wghen i write ?) The transfer function is 1 !




    float s =;

but no song ! I tried to multiply my voltage (by 40). But no result !


Somebody have an idea ? I have already looking for about ADC....


@Bientôt !

31 Dec 2010

Hi Gerald,

Don't use the DigitalIn and DigitalOut, use AnalogIn and AnalogOut of your embed.  Also, your mbed output does not have what it takes to drive a speaker directly.  If you connect the output of and mbed to an input of your stereo driving the speakers, then you might have more success,

Good luck,

31 Dec 2010

Hi !

user Mischa Megens wrote:

Hi Gerald,

Don't use the DigitalIn and DigitalOut, use AnalogIn and AnalogOut of your embed.

I use :

  • p20 : AnalogIn
  • p18 : AnalogOut

user Mischa Megens wrote:
If you connect the output of and mbed to an input of your stereo
precisely, I would like to use my mbed like an amplifier !



31 Dec 2010

You can use mbed like an amplifier but only for certain levels :(

something like AnalogOut = k * AnalogIn but when AnalogIn reach maximum value ... the amplifier is no longer an amplifier. :(

Also .. the output of the mbed does not provide speaker capabilities (whatever the amplification might be) .. like 8 ohms.. maybe piezo

So the mbed can only be used for low level amplification (with limitations mentioned above) and needs an external amp to drive the speaker(s)

31 Dec 2010 . Edited: 31 Dec 2010

Okay that clear !

May be, I think I need to make an external amplifier (why not with a TL081....).


  • if I transform my input not with a linear conversion (out = k*in) which makes saturations... ?
  • AnalogIn give a %of voltage in [0;3.3 V]... Why there are saturations when I pass this per cent in my AnalogIn ?
  • If I change my speaker to a higher impedance (60 ~ 70 ohm ?)

31 Dec 2010

I am not sure of the output drive capacity of the mbed, but its something less than 30mA (and if I remember correctly, that's for a DigitalOut, AnalogOut might infact be less.). If you use an 8 ohm speaker, it will draw about 400mA at 3.3V.a 60 ohm speaker will draw 50mA at 3.3V. The output would pretty much saturate no matter what..

While you might be able to actually hear something with a higher impedance speaker, this isn't really the way to do things. The AnalogOut is not designed to power anything. It simply provides a voltage out put with no drive capacity.

The simplest thing you could do is to get a pair of powered computer speakers and use that. TL081 is a start, but that's an opamp and is also not designed to drive a load. Try LM386.

Also, If I understand correctly, you are connecting a powered output to the input of the mbed? This is also not the way to do this because you are likely applying a larger signal to the AnalogIn that it could handle. You can't exceed 5V on any mbed input. Furthermore, the audio signal is likely AC so you are also applying negative voltages to the pin which could damage the mbed pin. I am not sure what the tolerance for negative voltages is to an input but it's probably less than one volt.

01 Jan 2011


You can use a resistor bias network and DC blocking capacitor to get the input audio into the range of the mbed ADC. Also you get aliasing noise on the ADC which can be reduced by adding a lowpass filter. I've successfully used this setup:

             o 3.3V
             R 100k
             |        1.5k
Jack o--||---+---------R---+---o AnalogIn
       0.1uF |             |
             R 100k       --- 1nF
             |            ---
             |             |
            GND           GND

Maybe add diodes to clip the input waveform if you might accidentally overdrive the input pin.