Few days ago, I went crazy when I saw the news about the zero version of RPi, I thought "hey, this is going to have a lot of potential", I rapidly became sad when I discovered that there weren't any analog audio or video in the board (I mean RCA and 3.5mm), but my hopes for a solution were too strong to throw the towel soon, so I googled a lot and found a solution. There are two unpopulated pins on the board for RCA, Yeah!, it's a matter of soldering two cables.... but still nothing for audio (lets talk truth, if I need to make a robot or anything that implements audio output, is too expensive to buy a HDMI to Analog Audio converter) so, I kept looking a way to archive this, and TA-DA!
So... I have a PWM unfiltered audio source, what should I do? EASY! you can do a RC filter with one resistor and two capacitors.all you need is access to PWM0_OUT and PWM1_OUT, which are...on GPIO #40 and #45 and are not brought out on the Pi Zero. Tragedy? Give up? No! You can get to PWM0 on GPIO #18 (ALT5) and PWM1 on GPIO #13 (ALT0) or GPIO #19 (ALT5)
This is the original audio filter in Raspi Boards.
Note that PWM0 is the Right Audio Source and PWM1 is the Left Audio Source.
Here is a much simpler RC audio filter circuit, this is the one I tried.
Getting access to PWM0 and PWM1
Take a look at this link, especially GPIO 18,13 and 19.
You can see that GPIO18 is present in the old 26 pin headers and 40 pin headers in the BOARD pin 12, this are good news.
But... is you see GPIO13 and 19, you can note that these pins where not present in the old 26 pin header, instead, become present in the new 40 pin header (guess what? Raspi Zero has this connector!!) so you can easily use GPIO13 in BOARD pin 33, or GPIO19 in BOARD pin 35, these are better news than before, we have access to PWM0 and PWM1!!
But the hard part is coming now... if we saw the Elinux link, we can see that PWM0 is the Alternative Function Number 5 of GPIO18, PWM1 is in the Alternative Function Number 0 in GPIO13 and Alternative Function Number 5 in GPIO19.
What is an Alternative Function?
GPIO pins of the Raspi can be used as input, output, pwm, I2c, etc...but, how can you switch a GPIO between its diferent functions? many people do it in C++ compiled programs, or changing the "device tree overlay", I found this to be a time consumption duty (especially those people new to electronics and programming), so I must thank two developers out there, those two who made "Wiringpi" and "PIGPIO" that give us the easy of "one line command" that changes the function of the GPIO. I used Wiringpi, im not going to cover PIGS this time..
Changing GPIO Function using WiringPI
To do this, first we need to install Wiringpi if you don't have it.
Now is time to change those GPIO functions!sudo apt-get update
sudo apt-get install git-core
git clone git://git.drogon.net/wiringPi
(if cant compile, be sure you have the build-essential package)
Now, connect the GPIO18 to the right audio filter.Now go to command line, you dont need to be root user!
gpio -g mode 18 ALT5 (This links PWM0 to GPIO18)
gpio -g mode 13 ALT0 (This if you want PWM1 in GPIO13)
gpio -g mode 19 ALT5 (This if you want PWM1 in GPIO19)
and that's it!
connect the GPIO13 or GPIO19 (the one you select before) to left audio filter.
Be sure everything is fine and ground is properly connected between Raspi, the audio filter and the speaker!!.
This is the 40 pin header pinout, look for the GPIOs we are going to use, be careful, dont make a short circuit!.
Now the real test!
Go to command line, download a mp3 audio test file and play it.
If you hear a singing voice you made it! if don't, be sure to have omxplayer and be sure that your distro is configured for analog audio output, you can try in a normal Raspi with jack, if no luck, go to bibliography and go to raspberry audio usage link.wget https://goo.gl/XJuOUW -O example.mp3 --no-check-certificate
Now you can solder the RCA pins and have Analog Audio and Video!
I hope this help you out there wishing to extract all the juice from this new board, have a nice day!
Some problems and details i must tell
1) I tried this in Raspi 1 B rev.2 using the new Jessie distro.
2) My first try was in a OSMC for Raspi 1 B rev.2, i used PIGS and Wiringpi, but when I switched the alt. function, the system got stuck, I made many tries but no luck, maybe is the distro used to build the OSMC? is weird because is Jessie too... maybe someone can help me solve this, I dont have a Pi zero right now, im planning using it for Mini Media Center, but this problem stops my beloved idea
Edit: After pulling all my hair from the head, I discovered the reason why OSMC crashed when switching alt. functions, OSMC uses LIRC (a kernel module that allows you to connect a infrared receiver to your raspi, so you can use a remote control to drive the interface), the problem was that GPIO18 were configured as the receiver pin, thats why the Raspi crash when changing alt. func. The solution is either disable IR REMOTE or change te GPIO number used for the receiver.
3) I have only tried PWM0 in GPIO18, because is a 26 pin header, maybe it works too on Pi 2?
EDIT: I tested it in Raspi 2, both PWM0 and PWM1 works like a charm, i think the original filter would sound better....
Edit: Yep! the original filter sounds a lot better, is up to you the choice of filter.
4) I speak spanish, so please bear my english, I will try to improve this tutorial in that meaning.
5) Have fun hacking