Page 8 of 8

Re: PWM Audio Guide

Posted: Sat Nov 11, 2017 12:59 am
by emaborsa
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.

Re: PWM Audio Guide

Posted: Sat Nov 11, 2017 6:46 am
by shesaysidontlisten
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!

Re: PWM Audio Guide

Posted: Mon Dec 18, 2017 11:27 am
by NealXu
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

Re: PWM Audio Guide

Posted: Tue Apr 17, 2018 5:54 pm
by Theconartist03
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

Re: PWM Audio Guide

Posted: Sat Jun 30, 2018 2:24 am
by brigghius
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 18276 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

Re: PWM Audio Guide

Posted: Mon Jul 02, 2018 7:10 am
by emaborsa
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.

Re: PWM Audio Guide

Posted: Sun Jan 13, 2019 5:01 pm
by BorealBlizzard
how would I implement this to work with a mono speaker? would I just use either L or R channels?

Re: PWM Audio Guide

Posted: Mon Jan 21, 2019 6:56 am
by tinkerBOY
BorealBlizzard wrote:
Sun Jan 13, 2019 5:01 pm
how would I implement this to work with a mono speaker? would I just use either L or R channels?
You can just use one PWM audio and just downmix from stereo to mono sound.