Audio Amplification using microcontroller???

Former Member
Former Member

Hi everyone!!! i'm new to STM32f4. i was wondering if this microcontroller can amplify an input analog signal through audio jack i.e an audio signal and produce amplified voltage at any gpio pin...

Parents
  • Hi nomikhan,

    It's hard to give a definite answer to your question. Some will say yes some will argue and say no. The reason for this is you specifically stated "produce amplified voltage at any gpio pin..."

    If we answer yes to your question, how is the audio signal processed?

    At the input you have to convert the signal from analog to digital. At the output you need to convert the digital samples back to analog. Typically, you will need a DAC (external or internal to the MCU), filter, and driver. The use of the term "GPIO pin" is where the argument will arise.

    Digital-to-Analog Converter

    As daith stated he doesn't believe you will be able to do the amplification because STM32F4s don't have a DAC (please post the particular STM32F4 that you have; the STM32F410 for example have a 12-bit DAC, some members of the family may even have 2). However, microcontrollers can implement a class D amplifier and note that Cortex-Ms can be run at high clock rate. If we use the strict definition of GPIO then you can implement the class D amplifier in software (usually this is done only as exercise not in practical application). If you loosen the specification at the output, you can use a timer (preferably with PWM capability) instead of GPIO to alleviate the CPU of the processing burden.

    Filter

    For high-fidelity audio application, filtering of PWM signal is difficult but for the purpose of showing that your question can be answered yes, simple filters are adequate. I remember that Norton Diagnostics (a diagnostic program for microcomputers in the DOS era) includes a speaker test that sends a short digitized speech to the PC's speaker. The speaker is only controlled through the programmable interval timer and a gating signal. The speaker circuit does not have a special filter; the speaker is connected to the driver only through a limiting resistor; in some cases capacitive coupling is employed to prevent DC-driving the speaker. I admit though that the audio output is often hardly intelligible.

    Driver

    Microcontroller (GPIO) pins have modest drive level but they are capable of driving small speakers.

    Of course Class D amplifiers are used in applications where efficiency is a crucial factor. Instead, I suggest that you use a DAC (PWM is also a form of digital-to-analog conversion but I am referring to circuits which can produce multiple voltage levels corresponding to the code at the input) for your early experiments in processing audio signals using microcontrollers. In addition if you want higher level of amplification you need a driver/amplifier.

    Regards,

    Goodwin

Reply
  • Hi nomikhan,

    It's hard to give a definite answer to your question. Some will say yes some will argue and say no. The reason for this is you specifically stated "produce amplified voltage at any gpio pin..."

    If we answer yes to your question, how is the audio signal processed?

    At the input you have to convert the signal from analog to digital. At the output you need to convert the digital samples back to analog. Typically, you will need a DAC (external or internal to the MCU), filter, and driver. The use of the term "GPIO pin" is where the argument will arise.

    Digital-to-Analog Converter

    As daith stated he doesn't believe you will be able to do the amplification because STM32F4s don't have a DAC (please post the particular STM32F4 that you have; the STM32F410 for example have a 12-bit DAC, some members of the family may even have 2). However, microcontrollers can implement a class D amplifier and note that Cortex-Ms can be run at high clock rate. If we use the strict definition of GPIO then you can implement the class D amplifier in software (usually this is done only as exercise not in practical application). If you loosen the specification at the output, you can use a timer (preferably with PWM capability) instead of GPIO to alleviate the CPU of the processing burden.

    Filter

    For high-fidelity audio application, filtering of PWM signal is difficult but for the purpose of showing that your question can be answered yes, simple filters are adequate. I remember that Norton Diagnostics (a diagnostic program for microcomputers in the DOS era) includes a speaker test that sends a short digitized speech to the PC's speaker. The speaker is only controlled through the programmable interval timer and a gating signal. The speaker circuit does not have a special filter; the speaker is connected to the driver only through a limiting resistor; in some cases capacitive coupling is employed to prevent DC-driving the speaker. I admit though that the audio output is often hardly intelligible.

    Driver

    Microcontroller (GPIO) pins have modest drive level but they are capable of driving small speakers.

    Of course Class D amplifiers are used in applications where efficiency is a crucial factor. Instead, I suggest that you use a DAC (PWM is also a form of digital-to-analog conversion but I am referring to circuits which can produce multiple voltage levels corresponding to the code at the input) for your early experiments in processing audio signals using microcontrollers. In addition if you want higher level of amplification you need a driver/amplifier.

    Regards,

    Goodwin

Children