+86 400-003-5559 CN


Swapping GPIO Pins On The Pi Zero For Audio | Hackaday

tags1206 resistor

The new Raspberry Pi Zero has caused a lot of discussion, especially along the line of "Why don't they include...?" A particular complaint is that audio is only available through the HDMI port. That is

Come out by Mrs. Ada at Adafruit.

Regarding the entire Pi series, one thing to remember is that the pins on Broadcom processors are multi-purpose. Does it increase confusion or power? whatever. But the main benefit is 

. For audio with Pis greater than zero (GTZPi), please use PWM0_OUT and PWM1_OUT on the GPIO pins 40 and 45 of the processor. On GRZPis, they feed into a diode, resistor, and capacitor network that terminates in the audio output jack. They do not appear on the GPIO connector, so they cannot be used on the zero position.

Broadcom processor's multi-pin multi-purpose function

Connect PWM0_OUT to GPIO 18, and connect PWM1_OUT to GPIO 13 or 19. Add a network from Adafruit comments, or check this option

– Look at the bottom right corner of the second page.

When checking Adafruit's audio hack, please read all of the following carefully: 

. Lady Ada describes zero and the necessary conditions to start using it very well.

If you are looking for zero hacking ideas, you can check out our review

Or about

. There are many hacker factories among them.

Love the way Mrs. Ada records the hacker. Set the standard for us:)

I also released an Ethernet hacking technique this week...

It is only 4 MBaud, but it is better than nothing.

Does anyone know how to issue RCA?

Place the RCA connector from the Pi base on the circuit shown above. The signal there is line level and is not ready to drive the headphones.

Do you mean composite video output?

These are the two pins labeled TV under the gpio header. There are two other pins between them, which will reset the Raspberry Pi when shorted

But this is not RCA...that is composite video.

RCA requires a lot of mathematics and programming to get good output. More information about it is here.

Pizero got a dedicated rca output-so you can expect audio output-I guess it's best to convert it to 3,5 jack out

what? You confuse the root cause analysis with the standardized electrical connector (quite old) that I invented before I was born.

In this case, RCA is not a video or audio format, but a connector. RCA connectors are used for line level audio (1Vpp), composite video and component video.

Or-you are boring and joking. Or-you are drunk and type.

The RCA video output cable can transmit composite video and 2-channel stereo. If you search for RCA using Google, you will get clicks on the RCA brand and the cable picture I described on the first page. I searched for RCA on Google, and went deep into 10 pages, but did not find the content of root cause analysis. I think you are just a bastard, he went 100 pages on Google and found the "short form" of RCA.

rca is just a connector for video, audio, digital audio, rf video and audio combination (nes, c64) and other signals. Composite video is usually a video standard carried through the yellow rca plug. Unless there are one or more other audio plugs, there is no audio.

Have you accidentally considered composite video and line level audio on trs connectors (such as pi2)?

Yes. But the rca type connection of the video requires 3 channels-LEFT-RIGHT-VIDEO..., if you view the RCA output on the Raspberry Pi Zero-these are two holes---> VIDEO CHANNEL ..... That's why The reason for the separate output. After all, the RCA connection requires audio (actually three cables – or a SCART TV variant) – – – – >> After all, that’s why I think both hacks merge the video’s new 3.5 jack into the channel – So you can use a simple cable like this...

The easiest way is:

, You can get the location of the RCA connector from Pimoroni.

RCA is a connector type, and composite video is a mixture of brightness and chroma with horizontal and vertical synchronization... The rca connector comes from: Radio Corporation of America, called RCA...

This is a wiki:

I guess the diode will short any voltage outside the 3.3 volt range of 0 to pi.

But how likely is this to happen? For what reason?


Receive terminal voltage? (Jack's audio)

There are two reasons-

Diodes are used for the reasons you mentioned and help prevent someone from applying voltages beyond the range you mentioned or generating small static electricity.

The diode will also clamp the peak value of the sine wave you are trying to generate from the PWM line, limiting its maximum value to twice the forward voltage drop of the diode. In this case, the forward voltage drop ranges from 0.715V to 1.25V, depending on the current flowing through the diode. Therefore, in this case, the center of the sine wave will be located at 1.65V above the ground and is limited to a peak-to-peak value of about 1.43V. This is usually done to prevent damage to audio equipment that someone might try to amplify the signal. C34 and C48 are essential for DC blocking. If there is no DC offset, the DC offset will cause a diode in each channel to continuously conduct.

Thank you. I read and considered your explanation. I can't figure out "how the diode clamps the peak value of the sine wave you are trying to generate from the PWM to twice the maximum value of the forward voltage".

Do you mean "peak to peak"?

If so, does this mean that 1.43 v is the maximum swing (p2p) specified by some specifications for audio input?

(I originally thought ~3v3's peak2peak is ok, but obviously there is a limit. Maybe 3v3 is too high although I think it is very low.)

thank you for your help!

Yes, peak to peak. If the positive of the sine wave (1.65V with respect to the midpoint) exceeds the forward voltage of a diode, it will turn on a diode, so the final positive part of the sine wave with a maximum value of 1.65 is obtained. V + 0.715V (the forward voltage drop of the diode) = 2.365V.

If the negative value of the sine wave (relative to the 1.65V value) exceeds the forward voltage of the diode, it will turn on a diode, so the final negative value of the sine wave is 1.65V – 0.715V (the positive value of the diode) Voltage drop) = 0.935V.

Therefore, the maximum peak-to-peak value of the signal is 1.43V. If a different diode is used, the exact value will vary and depends on the amount of current flowing through the diode.

The peak-to-peak maximum input amplitude of the line-level audio input on most home stereo equipment is 1V, but it can withstand an absolute maximum of 1.5V, even if the amplifier is distorted by clipping the peak on the sine wave.

Hmm... I asked the above question, thinking that the polarity of the diode is opposite to the picture. But it seems that your explanation also believes that they have been revoked.

Therefore, this is a follow-up/replacement question (ie, if it makes sense, please answer my previous question):

How does the diode short out any *signal* outside the 1.43 peak 2 peak range? The signal centered in the middle of 3v3 will never be lower than 0 or higher than 3v3. And if it is within this range, the diodes will never conduct because they are reverse biased.

Thank you!

The signal does not need to be higher than 3.3V or lower than 0V. Unless the signal exceeds the forward voltage of the diode, the diode usually does not conduct, so as long as the peak-to-peak value of your signal is below ~1.43V, you will get a sine wave from the circuit. If you switch between ~1.43V peak-to-peak, the top of the sine wave will start to be cut off and the audio will sound distorted.


Connect the negative lead of the upper diode to 3v3. Therefore, the anode lead of the diode (connected to the signal) must reach 3v3 plus ~0.7 volts to conduct electricity. But how does the signal exceed 3v3?

Oh, this time I have always assumed that the maximum value of pwm0 is 3v3. Maybe it will be higher... I will look at the specifications.

Thanks for the explanation!

Therefore, – the cathode of the upper diode is connected to 3.3V, but its anode is connected to the 1.65V virtual ground (as described by Dave below), so the anode only needs to reach 2.365V to start conducting. The voltage is related to the constantly changing virtual ground of the sine wave, so it is difficult to observe.

But looking from the other direction, if you accidentally apply a voltage of 5V to that connection, or if there is electrostatic discharge, a positive voltage of 3.3V + ~ 0.7V will turn on what you call the upper diode. Or, if you apply a negative voltage greater than ~0.7V, the lower diode will conduct.

If the duty cycle is set to 100%, the PWM output can generate 3.3V, but the resistors R20 and R21 will eventually divide the voltage to about 1.1V. R21 is also part of C20's low-pass filter.

"The cathode of the upper diode is connected to 3.3V, but its anode is connected to the 1.65V virtual ground (as Dave described below), so the anode only needs to reach 2.365V to start conducting. 


But...but...but, compared to the actual ground, the anode of the upper diode has only one actually measurable voltage (actual ground = the anode of the bottom diode).

So the cathode of the upper diode is 3.3v, and the anode of the diode is 2.365v. It is reverse biased. How should it proceed?

I thought I knew how diodes work...very patient!

I can see how it will turn on if 1.65 is added to 2.365 (= 4.015), because in the correct flow direction of the diode, the potential of 4.014v drops the entire diode. And 4.015-3.3 is equal to the forward bias voltage drop of the diode (.715v)

In this case, reverse bias makes no difference, because they will not conduct unless the forward voltage is exceeded (except for leakage).

The sine wave is changing the value of the virtual ground created by two diodes in series. If there is no sine wave, it is usually 1.65V, but the sine wave will increase or decrease the value as the sine wave passes.

This feature is not unique to Broadcom or Raspberry Pi. Almost all modern ARM SOCs have multi-purpose reconfigurable pins. This is a bit like having the flexibility of an FPGA without the pain of synthesizing IP (at least in terms of pin assignment). Modern Allwinner, Rockchip and many other companies have this feature. Your Orange Pi, Bananna Pi, Cherry Pi, Shepards Pi and you have anything. Just ask for the data sheet and find it yourself.

Not even a novice to ARM socs. Old as a mountain. It's even on Atmel parts!

Aha, why is there no Shepards Pi? Maybe it's Pi, I think Shepards is outdated.

Is it available on all versions of pi?

It is available on all Pis, but on Pi B and A, you only have mono output.

On pi B+, A+, 2B, zero, cm, you have stereo output


Remove features and expose them, critics will complain, and hackers will become creative.

I want to think that complaining and creativity are not unique to hackers

Ok. More likely, when people who like to call themselves hackers or "real engineers" complain, those who are actually hackers and engineers are busy.

And it's done.

So... the past few days...

Gosh... no internet.

Wifi dongle peeled and soldered: parallel to USB

Oh no. .. only one USB .. doooooooomm

Hub skin, integration and testing.

Now.. But how can I make a sound.. It's useless.

The sound is already there, just switch from HDMi sound to GPIO.

Good thing, because the complainant gets clickbait early. Because now every complaint article can have many solution links

I really didn't get these things. If you want audio FFS, please purchase Raspi A+, B+.

Isn't this the purpose of I2S pins? If you want to place the component on an external PCB, place an I2S DAC on it and get a decent sound, not PWM crap.

Are these the correct components to recreate the filter?

Please be kind and respectful to help make the comment section great. (


The site uses Akismet to reduce spam.


By using our website and services, you expressly agree to our placement of performance, functionality and advertising cookies.