1

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

Leoc
  • 1,393
  • 1
  • 9
  • 21
  • Build an LC Low Pass Filter with cutoff frequency around 40kHz. This is the basics of [Class D amplifier](https://www.youtube.com/watch?v=3dQjIeYoIdM). – Unknown123 Apr 16 '19 at 04:10
  • Sounds good, ill give it a shit tomorrow, why not use a RC? and wouldn't a DAC be a viable option as well? – Leoc Apr 16 '19 at 04:13
  • 2
    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. – Randy Nuss Apr 16 '19 at 04:26
  • 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 – Leoc Apr 16 '19 at 04:32
  • 2
    @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. – Chris Stratton Apr 16 '19 at 05:14
  • Updated the main post, look for edit 1 – Leoc Apr 16 '19 at 13:14
  • @Pllsz Nevermind, I overlooked that the PWM frequency is already high so you don't need much effort to filter it. See the difference between LPF RC and LC in [here](https://electronics.stackexchange.com/questions/234695/using-lc-filter-instead-of-rc-filter-in-mains-powered-circuits). – Unknown123 Apr 20 '19 at 11:29
  • Also, 1st order Butterworth LPF RC filter tool in this link with integrated transient response with PWM input may help you. http://sim.okawa-denshi.jp/en/PWMtool.php – Unknown123 Apr 20 '19 at 12:39

3 Answers3

1

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

winny
  • 13,064
  • 6
  • 46
  • 63
analogsystemsrf
  • 33,703
  • 2
  • 18
  • 46
0

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.

Justme
  • 127,425
  • 3
  • 97
  • 261
0

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.

Unknown123
  • 804
  • 1
  • 5
  • 14
  • 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 – Leoc Apr 21 '19 at 17:50