Tag Archives: RBPiZW

Audio HAT for the Raspberry Pi Zero

The Raspberry Pi Zero (RBPiZ) and its successor, the Raspberry Pi Zero Wireless (RBPiZW) are very small single board computers. The Pi Foundation wanted to keep their cost and size to the low side, so they did not include either a 3.5 mm audio jack or any other audio port. Although this may seem like a setback for many users, some of them were went ahead and figured out how to get audio out of the board with a little hacking.

Another reason for not including an audio port is the Broadcom chipset used for the RBPiZ and RBPiZW does not have a true analog output. Instead, there are two pulse width modulated (PWM) pins that spew out digital output at very high speeds. To get audio out of these two PWM output pins, one has to filter the signal to the audio frequency range. This allows one to fake an audio signal by adjusting the duty cycle of the PWM pins.

According to physicists, for simulating any analog frequency from a PWM signal, the PWM frequency should necessarily be at least ten times higher than the highest frequency to be replicated in the analog range. As the audio signals humans can hear range from 20 Hz to 20 KHz, the minimum PWM frequency should ideally be about 200 KHz. However, the PWM output from the two RBPis is 50 MHz, so we can comfortably filter out the audio part while suppressing the higher frequencies.

The schematic of the audio HAT for the RBPis shows that the two stereo audio channels, left and right, are designated as PWM0_OUT and PWM1_OUT. On the PWM0_OUT, R21 and R20 are two resistors acting as a voltage divider to bring down the 3.3 V signal to about 1.1 V peaks. The corresponding voltage divider on the PWM1_OUT is formed of R27 and R26. Therefore, the stereo audio line level can give an output of 1.1 V peak-to-peak.

The RC low-pass filter that prevents the high frequencies from passing through is made up of capacitors C20 and C26, working in conjunction with R21 and R27 respectively. With the values of the components used on the board, the cut-off frequency for this RC low-pass filter is 17865 Hz, which is very close to the upper limit of audio frequencies, or 20 KHz.

That still leaves the DC voltage part of the signal on the lines, and one must remove it to prevent damage to any speakers or headphones subsequently connected to them. This is done by capacitors C48 and C34, which allow only AC part of the signal to pass through, and block all DC voltages.

As the PWM pins are being taken to the outside of the board, one must also protect the RBPi from ElectroStatic Discharge (ESD), which can travel back and destroy the RBPi. This is taken care of by ESD protection diodes.

All the above sounds very good and simple, but on the RBPi, the actual PWM0 signal on pin #40, and the PWM1 signal on pin #45, are not available, as they have not been terminated into exposed pads. To circumvent this problem, the PWM0 signal has to be rerouted through software to GPIO pin #18, and the PWM1 signal to GPIO pin #19.

Treat Yourself to a Raspberry Pi Zero W

The launch of the Raspberry Pi Zero W (RBPiZW) by the Raspberry Pi Foundation recently has added two features many fans of the RBPi have been requesting for a long time. The two features, built-in Wi-Fi and Bluetooth, added to the wonderful RBPi Zero have improved the functionality of the tiny single board computer.

After all, the RBPiZW is only a variant of the RBPi Zero, and therefore, does not merit a full length, in depth review. However, we will focus on the new features the RBPiZW brings to the users.

Keeping with the tradition of the RBPi family of SBC, there is no case or anything to enable the user to treat the RBPiZW as a commercial product. Just like the other RBPi products before it, the RBPiZW is a complete single board computer, bare bones, versatile, and cheap. The Foundation has created the board this way so all hobbyists and professionals can use it with equal ease to make anything they want.

As with the original RBPi Zero, the RBPiZW also has its System-on-a-Chip (SoC) near the middle of the board, while the bottom of the board has the various mini and micro ports. For instance, rather than a full sized HDMI port, the board has a mini-HDMI port for the display to be connected. At the bottom, you will also find two micro-USB ports. One is used for supplying power to the board, and the other to carry data in and out. Therefore, if you wish to connect peripherals such as a mouse or a keyboard, you will need to use a micro-USB B male to USB A female adapter.

On the left side of the board, you will find the micro-SD slot. As with the other RBPi boards of the family, the RBPiZW also does not have built-in flash memory. Therefore, for the Operating System and data storage, you must use a micro-SD card else, you will not be able to boot the tiny computer.

Although there is an Ethernet port on the RBPiZW to connect to the Internet via an Ethernet cable, the presence of the on-board Wi-Fi precludes the use of a USB Wi-Fi dongle. That means even if you do not have a ready Ethernet cable, the RBPiZW will not face any difficulty in surfing the net.

To enable to RBPiZW to start running, you will need to supply it power from its power supply through the micro-USB cable. You must also have a micro-SD card of at least 8 GB capacity and the relevant OS stored on it. If you are going to connect a monitor to the RBPiZW, you will also need a mini-HDMI to HDMI adapter, and an HDMI cable. As you have used up one USB port for power, there is only one more micro-USB port available. Therefore, to connect a keyboard and mouse, you will additionally need a small USB hub. Of course, if you have a Bluetooth mouse and keyboard, the single micro-USB port is enough, and you can dispense with the USB hub altogether. For headless applications, you can also discard the monitor, and the HDMI connectors/cables.