PWM Audio Guide

Various user-contributed guides for hardware-related things
emaborsa
Posts: 27
Joined: Sun Oct 02, 2016 1:58 am
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: PWM Audio Guide

Post by emaborsa » Sat Nov 11, 2017 12:59 am

Generally an amp should go just before the speakers and all the rest before the amp. In this cases, due to the low current and voltage, it doesn't really matters...
Regarding low pass filter, I removed it completely. Try it out with and without, in my case I did not notice any difference, and since in the game boy case there isn't a lot of free space, I decided to remove it.

shesaysidontlisten
Posts: 104
Joined: Wed Sep 13, 2017 5:24 pm
Has thanked: 19 times
Been thanked: 8 times

Re: PWM Audio Guide

Post by shesaysidontlisten » Sat Nov 11, 2017 6:46 am

emaborsa wrote:
Sat Nov 11, 2017 12:59 am
Generally an amp should go just before the speakers and all the rest before the amp. In this cases, due to the low current and voltage, it doesn't really matters...
Regarding low pass filter, I removed it completely. Try it out with and without, in my case I did not notice any difference, and since in the game boy case there isn't a lot of free space, I decided to remove it.
This PWM audio guide seems to show it before the pot. I put up a post in Hardware Help about how my potentiometer started smoking when I did this. Ack! I knew audio was gonna be hard!

NealXu
Posts: 1
Joined: Mon Dec 18, 2017 11:21 am

Re: PWM Audio Guide

Post by NealXu » Mon Dec 18, 2017 11:27 am

Hi...i am a new user here. In my case I don't plan to have a headphone jack at all, just a single speaker that was pulled from an old laptop. I'm not exactly a connoisseur of gameboy beeps and bloops at 8-bit or whatever it was encoded at, and mono will be just perfect for that. Also I don't think the original had stereo speaker output at all, it only affects the headphone jack I think.

pcb assembly

Theconartist03
Posts: 5
Joined: Mon Apr 16, 2018 9:31 am

Re: PWM Audio Guide

Post by Theconartist03 » Tue Apr 17, 2018 5:54 pm

DirtyBullets wrote:
Mon Jun 06, 2016 2:34 pm
dam i don't have 33n's got i have 47n's but to far apart i think?
You can use a 10nf ceramic capacitor

User avatar
brigghius
Posts: 32
Joined: Fri Apr 28, 2017 8:53 am
Has thanked: 15 times
Been thanked: 5 times

Re: PWM Audio Guide

Post by brigghius » Sat Jun 30, 2018 2:24 am

SP33 wrote:
Sun Jun 05, 2016 11:15 pm
This guide covers the basics of PWM audio on the Raspberry Pi Zero
It was based off of this article
https://learn.adafruit.com/adding-basic ... o/overview

Parts Needed:
10UF ELECTROLYTIC CAPACITOR ( x2 for stereo)
0.033UF MONOLITHIC CERAMIC CAPACITOR ( x2 for stereo)
150 OHM RESISTOR ( x2 for stereo)
270 OHM RESISTOR ( x2 for stereo)

I ordered my parts from Tayda Electronics you can click on the links above to see the exact parts I ordered. Keep in mind you must have $5 in your cart to be able to order from them but they are a very good company. You may buy from your favorite electronics site and just use the links for reference as well. There are also slightly varying parts you could use.

Schematic:
https://learn.adafruit.com/assets/28851

Simplified schematic:
Image

Note: The orientation of 270R, 150R and 33N do not matter.
10U Must be oriented correctly, the negative pin is usually denoted by a dashed line on the side of the capacitor and a shorter post.
If you want only left or right channel audio just split the schematic at the ground and only use one side.

My implementation:
Image

Software End:
Add the following text to the end of /boot/config.txt and reboot your pi

Code: Select all

dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
You should be able to cut out the part you don't need if you are using only the left or right channel but I will not provide it since it varies based on which you choose.
Thanks to @tindalos for this method

You should now have audio! If you have any questions about anything in the guide or concerns with how I implemented it please let me know!
hi all, i have a problem with my setup on my GBZ (recalbox, usb audio).
i want to try this config, but i have a question.
for the input i used the gpio in this way:
gpio contact.jpg
gpio contact.jpg (82.31 KiB) Viewed 138 times
can i used 2 free gpio pins or i must to use 13 and 18? on 18 there is Y button

ty far all

emaborsa
Posts: 27
Joined: Sun Oct 02, 2016 1:58 am
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: PWM Audio Guide

Post by emaborsa » Mon Jul 02, 2018 7:10 am

As you red in the post you quoted, there is a config in order to define the two audio pins dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4. It allows to change the stardard ones, but I don't know if all pins are suitable.
Another possibility would be to use a usb-audiocard.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests