9 years, 1 month ago.

Line level audio sine wave output

Hello everyone. I have an older amateur radio that does not have CTCSS capability, and instead of purchasing a module, I'm considering creating my own with an STM32 board. The technical side is extremely simple - the board would produce a steady sine wave tone (range between 65 and 250 Hz) which is injected line-level into the radio's audio that it transmits. The software side is very simple. So here are my questions: 1: Can I do this with PWM using just the STM32 board (does not have analog out), or do I need a D/A converter? 2: Would I need any kind of filter or switching transistor between the MCU and the radio?

Thanks!

PWM doesn't output sine wave but square wave. It's hard to convert from square wave to sign wave by filters. You'd better to use DA converter and low pass filter.

posted by Yoichi Hamazaki 19 Mar 2015

1 Answer

9 years, 1 month ago.

You can create (low frequency) sinewaves from a PWM output by modulating the pulsewidth. Some example code is provided here.

See also discussion here.

The result will be a sinewave with voltage between 0V and about 3V. You will need a low pass filter to get a smoother signal and you may need a blocking capacitor to get a sine which is symmetric around 0V.