1
\$\begingroup\$

I am trying to make a Raspberry pi Bluetooth receiver. I finally got the raspberry pi to output audio via bluetooth, however the output seems like it is a modulated PWM. The width of the PWM seems to change (The falling edges shakes) when I start playing music. I dont know how to recover the audio.

I tried using a DAC but I have no idea how to even use it.

The Dac I have MAX544

EDIT 1: I have tried using a low pass filter with a cutoff frequency around 40kHz. I noticed something strange. I have put in a buffer for the signal (PWM) and as I checked the output its a triangle wave? Is this due to the op amp slew rate or is there actual filtering happening within the op amp? OP amp in question MCP601 Otherwise the low pass filter seems to work well.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Build an LC Low Pass Filter with cutoff frequency around 40kHz. This is the basics of Class D amplifier. \$\endgroup\$ – Unknown123 Apr 16 at 4:10
  • \$\begingroup\$ Sounds good, ill give it a shit tomorrow, why not use a RC? and wouldn't a DAC be a viable option as well? \$\endgroup\$ – Pllsz Apr 16 at 4:13
  • 2
    \$\begingroup\$ Definitely try a simple RC filter. From the numbers on the scope shot, the PWM frequency is around 750kHz. Should be easy to filter that out. A DAC won't help here. That's for converting a sequence of digital values to a sequence of analog values. A PWM signal is essentially an analog representation of the underlying signal. Just filter it and see what you get. \$\endgroup\$ – Randy Nuss Apr 16 at 4:26
  • \$\begingroup\$ I shall 100% try a RC filter, but I am curious as to why a DAC wouldnt be that good here? Isn't technically changing sequences? The falling edge of the PWM is rapidly/constantly moving I just didnt get a good snap of it but its for sure rapidly changing \$\endgroup\$ – Pllsz Apr 16 at 4:32
  • 2
    \$\begingroup\$ @Pllsz this is a type of DAC. The signal you have is not one you could readily feed to a different type. A pi is probably not what you want for your application, but there are plenty of pi "sound card" hats with ordinary Audio DAC's for sale. \$\endgroup\$ – Chris Stratton Apr 16 at 5:14
1
\$\begingroup\$

Use a low-passRC at 16 kHz thus putting the PWM energy at 40:1 down. Perhaps two cascaded RCs.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Is there a difference in using a dac? \$\endgroup\$ – Pllsz Apr 16 at 4:50
  • \$\begingroup\$ The DAC will have steps in the output voltage. Those should be filtered, tho you could let the mechanical inertia of the speaker or earphones provide some filtering. \$\endgroup\$ – analogsystemsrf Apr 16 at 10:24
  • \$\begingroup\$ Updated the main post, look for edit 1 \$\endgroup\$ – Pllsz Apr 16 at 13:14
  • \$\begingroup\$ Don't buffer the PWM. My suggestion. \$\endgroup\$ – analogsystemsrf Apr 17 at 0:17
  • \$\begingroup\$ This is correct, everything is working perfectly thank you so much \$\endgroup\$ – Pllsz Apr 17 at 4:44
0
\$\begingroup\$

RC filter is cheapest way to get any audio out. Other options include getting a USB sound card or Audio Shield as there contain a real DAC.

\$\endgroup\$
0
\$\begingroup\$

To add,

The waveform is already in DAC form. PWM is a type of DAC. You're asking if DAC is a viable option while you already have a DAC output signal. It's just like you're asking "where's my spoon?", while you've already hold it in your hand.

If you're asking another type of DAC which doesn't require filtering. Then you need dedicated Audio DAC for your Raspbery Pi. There are tons of its module in the google if you're searching with just keyword of "audio dac raspberry pi". You can also build it by yourself from scratch using IC such as from Texas Instrument here.

Moreover, there are also available pre-built-in DAC + Amp module if you need to directly connect it into the speaker.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the break down. I didnt know the output was already in DAC form as you would imagine it to be an analog output instead of a "PWM" looking wave form \$\endgroup\$ – Pllsz Apr 21 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.