One Transistor Audio for Pi Zero W




The Raspberry Pi Zero (and Zero W) are amazing devices for such a low cost. But they are missing one feature needed for many projects. That is sound. The only audio they have by default is via HDMI TV monitor. They support “earphone” audio, but lack the jack and audio filter circuitry that the bigger Raspberry Pi’s have.

I wanted simple audio, good enough for speech and sound effects, but not necessarily high fidelity. There are plugin modules for adding sound (including high quality stereo) available, such as this one: but I was after something simple from spare parts I already had.

This describes a one transistor mono amplifier capable of driving a small speaker and providing decent sound, much better than just a buzz or beep. All that is needed are a few resistors and capacitors, a 2N2222 NPN transistor and a small speaker. It runs off the Raspi’s 5V power and only needs 3 wires to connect to Pi.

Step 1: Parts List

  • 1 – 2N2222 NPN transistor
  • 1 – 270 ohm resistor
  • 1 – 150 ohm resistor
  • 1 – 8 ohm resistor (use 1/2 watt if continuous playing expected)
  • 1 – 15K resistor
  • 1 – 0.01uf capacitor
  • 1 – 10uf capacitor
  • 1 – small 8 ohm speaker 2" or less.

Small Perf board or breadboard plus wire.

A Raspberry Pi Zero or Zero W with Raspbian Jessie installed.

For smallest size, all you need is a postage stamp size perf board, but requires soldering skills.

Step 2: Wiring Instructions

  1. Wire up the components as shown in the schematic.
    If you are using a breadboard, you can also look at the fritzing breadboard diagram.

    Note that the values are not especially critical, so if you can’t match exactly, just use close.

  2. You can connect to the Pi Zero GPIO connections either with header pins or solder wires directly to the appropriate pins as in the GPIO figure above.

Step 3: Software Configuration

No special software beyond Raspbian Jessie is needed. But you should use the latest version and will need command-line access such as via SSH. You DO NOT need the GUI for this to work, so you can use Jessie Lite, if desired. Also, you DO NOT need Internet connection for this project, other than to originally install Jessie and update it to the latest version.

1) Log into your Pi Zero via terminal or SSH.

2) You have to remap the Pulse Width Modulation (PWM) pins to alternates so to be accessible from the GPIO connector. To do this execute the following to edit the config file:

$ sudo nano /boot/config.txt

Append the following line to the bottom and save the change:


3) Note that this will allow stereo, but only one channel is actually used by this amp.

4) Redirect the audio to the (non-existent) audio jack:

$ sudo raspi-config

Go to ADVANCED -> AUDIO -> FORCE 3.5mm headphone jack

(See screen shots above.)

5) Click FINISH to exit

6) REBOOT your Pi to pick up the changes

$ sudo reboot

Step 4: Testing

Assuming all went well with the hardware and configuration changes, try it out:

$ aplay /usr/share/sounds/alsa/Front_Center.wav

You should hear audio now!

If you need to adjust the volume, use:

$ alsamixer

Use the Up/Down arrows on the keyboard to set the volume as high as desired.

Press ESC key to exit.

Step 5: Finally

You can play any type audio file that the “aplay” program handles. I suggest .WAV files.

$ aplay myaudio.wav

There are also other programs like "mpg123" for mp3 files and even Google Text-to-Speech (but this requires Internet connection):

$ sudo apt-get install pip mpg123
$ sudo pip install gTTS
$ gtts-cli "Hello there my wonderful friend" | mpg123

Note that there may be slight buzz or hum as the filtering is minimal here.

Also the audio is MONO only (or one side of stereo).

You could duplicate the circuit and connect the second input into GPIO pin 18 for Stereo, but you would probably be better off with one of the higher quality (and cheap) stereo add-on boards such as from Adafruit. These start as low as $3.95 and can give more high fidelity stereo audio and drive larger speakers.


Many "thanks" goes to Learn Adafruit tutorial for audio config details used in this document:



  • Pets Challenge

    Pets Challenge
  • Growing Beyond Earth Maker Contest

    Growing Beyond Earth Maker Contest
  • Backyard Contest

    Backyard Contest

10 Discussions


Question 8 weeks ago on Step 5

Hello, could i replace the 2N2222 by a BC547? I got plenty of BC's. I see that the power dissipation is pretty much the same in both, but collector current is 600mA for 2N2222 and only 100mA for the BC547. I am only looking for playing some sounds in a cheap small speaker i will put in a star wars lego. I understand such a small 8 ohm speaker consumes 500mW, which means 100mA for the 5V that is applied. so the BC547 should be just sufficient. Do you agree?

1 answer

Answer 8 weeks ago

This circuit is so simplistic, that transistor should be fine. Even the resistors and capacitors can be varied quite a bit. I suggest just breadboarding the circuit and adjusting components up and down + - 50% or more in value one at a time, if the audio isn't acceptable.

You can probably even get away without R4 the 8 ohm resistor; it's mainly there to limit max current, but unless your audio is a constant high volume tone (like an alarm), it probably won't matter.

Vishal Dhayalan

3 months ago

hi, I have a 2" 3.5ohm speaker (measured the impedance with a DMM as it didn't specify). Would that work? and would it be louder due to the lower impedance than the 8ohm used in the instructable? Many thanks :)

2 replies
Vishal DhayalanVishal Dhayalan

Reply 3 months ago

Also, please advise any changes I need to make to this circuit to use this 3.5ohm speaker instead of an 8ohm speaker. Thanks

rgrokettVishal Dhayalan

Reply 3 months ago

The 3.5ohm speaker should work fine. No changes needed.
This simple amplifier is very forgiving on the values of it components. Any values even remotely close should work.


6 months ago

Thanks for this. It works quite well. Easy to make, I only had 10k resistor for the collector and 33mf cap for base to ground. Still works well.


10 months ago

I built it and it works perfectly. I wish someone would post more detailed perf board shots...

By the way, this way is louder than the example on adafruit and works much better for me.


1 year ago

Neat solution to the Pi Zero's lack of non-HDMI audio.

I built it and it works great. The zero in this photo is running Volumio 2.x and streaming a web radio station.

Thanks for the project!


1 year ago

You dont have to do annything to get the sound in stereo just activate Bluetooth to a

Bluetooth device speaker or headphone.



2 years ago

Great solution. I use a cheap USB stereo audio plug now but will try this out. Perfect for minimal size solution to get sound feedback in Kodi GUI i think.