HOW TO MAKE: Raspberry Pi 5 ANALOG AUDIO&VIDEO outputs and inputs

Опубликовано: 15 Октябрь 2024
на канале: PC USB Projects
9,947
95

Raspberry Pi CEO Eben Upton recently made an interview with Raspberry Pi chief technology officer for hardware James Adams. Asked why Raspberry Pi 5 lacks an analogue audio jack unlike all of its predecessors, James explained that there was simply not enough room on a small printed circuit board. Instead of a bulky audio output jack, there is a one lane PCIe connector for fast extension cards and two connectors for a digital camera or a display. But there are still a number of relative cheap quality solutions to implement analog stereo output and input on Raspberry Pi 5.
James added that Raspberry Pi 5 also supported composite video output for older TV-sets through two pins on position J 7 between HDMI 1 port and camera-display one connector. A video cable or a connector may be soldered to J 7 pins, if needed.
However, many would still prefer an audio output jack to connect the little computer to a powerful old-fashioned audio amplifier. If you are already rushing to a computer store to buy a quality USB to analog audio interface dongle, let me tell you that there are two types of them. Some just support an analog audio output, but the others also have an analog microphone input. They are usually a much better and compact solution than any of Raspberry Pi hats, but you have to sacrifice a USB 2.0 port. If you lack USB ports, you can also use the dongle with a USB hub. There is also a three-port USB hub inbuilt into the original Raspberry Pi keyboard. When buying an USB analog audio dongle for Raspberry Pi it is a good idea to check, whether it supports Linux. Some makers even explicitly specify Raspberry Pi support.
HDMI audio extraction dongle is probably less a known solution, but costs about the same as USB dongle. Most of the dongles have a HDMI plug connected to a small casing with analog audio output and a HDMI port for connecting a monitor. Some also support a VGA output, but these usually lack an output HDMI port and are intended for older monitors and TV-sets. The only setback is lack of analog audio input. Most of HDMI audio dongles have a full sized HDMI plug, so a HDMI to a mini HDMI converter will be needed to use them with Raspberry Pi 4 or Raspberry Pi 5. HDMI dongles also require a separate power source. A 5-volt USB-C power supply is usually included with a new dongle.
When buying a HDMI dongle it might also be a good idea to verify its maximum supported resolution. Raspberry Pi 5 supports resolutions up to 4 K. However, you may get away with any kind of dongle, if you sacrifice one of micro HDMI ports for audio, only.
What about audio hats? HDMI audio extraction dongles and USB analog audio dongles can be used with any computer with an appropriate HDMI or USB port. However, hats can only work with Raspberry Pi models and versions that they've been designed for. A hat completely covers Raspberry Pi, which may obstruct its cooling. Though Raspberry Pies are often photographed with a hat on top, but without any kind of cooler underneath. Such configuration my work efficiently for ventilator cooled Raspberry Pi 4 with a small cooling rib on each of its hottest chips, but it would almost certainly conflict with a large Raspberry Pi 5 cooler. An adaptor cable may be needed to mount a hat sideways to allow proper for cooling of Raspberry Pi 5.
Okay! Is it possible then to add missing elements and recreate older Raspberry Pi's audio jack functionality on Raspberry Pi 5?
Let's take a look at Raspberry Pi 4's original analog audio jack implementation, which is included in its reduced schematic. Analog stereo audio signal is produced from two pulse width modulated signals, one for the left and one for the right channel. The signals are also available in 40-pin extension port. It is though no wonder why some electronics enthusiasts complain about a lost audio when using PWM zero and PWM one outputs to drive their custom hardware. However, the PWM signals are not directly feed to audio jack, but they are first amplified and then filtered to produce a clear analog signal in a hearing frequency range. Amplification also allows for 32-ohm headphone to be connected directly to the audio jack.
There are two types of analog audio Hats for Raspberry Pi 5: The simplest use the same principle as older Raspberry Pi's audio jack outputs.
No drivers are needed to use this hat, though boot configuration file must include a proper PWM pin configuration. RP1 chip draft document specifies nine different configurations for each of 28 general purpose input-output pins available through 40-pin extension port. It is important to set general purpose input-outputs 12 and 13 correctly in boot configuration file to enable analog audio through the Raspberry Pi extension connector.
An I2S hat requires a special Linux driver. But the most popular audio hats from rapberrypi.com internet store such as DAC Pro and DAC plus, already have drivers ready in the latest distributions of Raspberry Pi OS...