www.NewsDownload.co.uk Page 21

Raspberry Pi Transistor Audio Amplifier

2013-05-24 13:47 By Jason Birch

A simple and cheap battery powered, transistor audio amplifier for the Raspberry Pi microcomputer. Powered from a rechargeable NiMH PP3 battery.

VIDEO
The video here demonstrates the project which this article describes how to build.

The article breaks the project down into several stages:

  • Circuit
  • Development
  • Build
  • Raspberry Pi OS & Software
  • Project Costing

Reference:


Circuit for Amplifier With Optional Volume Control Highlighted In Red

Circuit
I like to experiment with electronic components from time to time. I want to keep experimenting cheap so if I break components, or their legs finally fall off, it done't cost much to replace them. It also has the advantage that buying them in a larger quantity is cheaper too. In this project I have not sourced the most appropriate components for the application which explains why the transistor is a very generic transistor, rather than using one with characteristics more specialized towards audio amplification.

When the audio signal comes into the circuit, the left and right channel are kept separate for the first stage. The signal is passed though a decoupling capacitor and a relatively high value resistor. This was done in order to protect the source of the signal as much as possible, as well as protecting the input stage of the amplifier from anything unexpected which may occur from the source of the signal.

The left and right channel are then merged behind a resistance, after the first stage of amplification. There are then a further two stages of amplification. The maximum gain of the transistors used is around 200 times. Each stage amplifies the amplified signal from the previous stage. Each stage is a Class A amplifier, information on classes of amplifier can be found here.


A large capacitor has been placed across the power supply, this is so that when the amplifier needs to draw a lot of current for a loud or bassy sound, there is extra power in reserve for a short period of time, to reduce the audio distortion. This also helps when the battery starts to loose it's charge.

A capacitor of increasing value has been placed on the output of each stage. The intention of this is to produce a low pass filter, in order to increase the bass response and reduce the treble response of the amplifier. This is because I find small speakers generally produce tinny sound, and I wanted a more bassy output.
Development
A prototyping breadboard was used to develop the circuit. Though it can get confusing with all of the wires and components, it is very handy for trying out different component values and configurations swiftly.

On the breadboard a volume control was placed in the circuit, but this component was not used in the final build of the circuit. This is because the Raspberry Pi has a software application to adjust volume levels. In addition the omxplayer software, used to play audio and video files, recognizes the '+' key to increase volume and '-' key to decrease volume.


Build
The project is placed into a case which is identical to the one used to house the Raspberry Pi. This provides a package which can be plugged in and aligns well with the Raspberry Pi case. The speaker, PP3 battery and electronics fit reasonably well in the case.


The components can be arranged quite efficiently on the strip board and only a couple of wire links are required, which can be made from cutoff leads of the components. A couple of wires are required to wire the speaker to the strip board.

The amplifier runs from a 9V PP3 NiMH rechargeable battery. It is known as a class 'A' amplifier design, which is not very efficient. The PP3 battery lasts about 3 hours from a full charge.

In order to get the best volume and sound quality from the speaker it is essential to mount the speaker in a case. The front of the speaker should be sealed against the front of the case with adequate material removed from the speaker area of the case, while maintaining a sealed edge around the circumference of the speaker. The case needs to have a complete back panel with no holes and a relatively small hole in the front or side of the speaker. This is so the pressure generated by the action of the speaker can push against the back of the housing, but also allowing movement of air in and out of the housing so the movement of the speaker is not restricted.
Raspberry Pi OS & Software
The Arch Linux OS distribution has been used in the demonstration, this is because it is very light weight and fast to boot. At the time of writing the Arch Linux distribution does not have the omxplayer package included, as far as I am aware. But the files required can be taken from the current Raspbian distribution, or the Raspbian distribution can be used.



To run omxplayer under Arch Linux the following files need to be transferred from Raspbian:
  • omxplayer
  • omxplayer.bin
  • libswscale.so.2.1.101
  • libswscale.so.2
  • libavformat.so.54
  • libavdevice.so
  • libavcodec.so.54.56.100
  • libavformat.so
  • libswresample.so.0.15.100
  • libavfilter.so
  • libavfilter.so.3
  • libswresample.so.0
  • libavcodec.so
  • libpostproc.so.52.0.100
  • libpcre.so.3
  • libavfilter.so.3.16.106
  • libavdevice.so.54.2.101
  • libpostproc.so.52
  • libavutil.so.51
  • libavcodec.so.54
  • libavdevice.so.54
  • libavutil.so.51.73.101
  • libavformat.so.54.27.101
  • libpostproc.so
  • libswresample.so
  • libavutil.so
  • libswscale.so

Project Cost
Item Reference Qty Each Cost
PP3 Battery Clip BitsBox 1 £0.16 £0.16
Stripboard 95 x 64mm 37 holes x 24 holes BitsBox 1 £0.85 £0.85
3.5mm Stereo Jack Plug BitsBox 1 £0.42 £0.42
Speaker 8 Ohm 500mW BitsBox 1 £0.89 £0.89
BC337 NPN Transistor BitsBox 4 £0.09 £0.36
10nF Polyester film Capacitor BitsBox 2 £0.11 £0.22
100uF Electrolytic Capacitor BitsBox 2 £0.07 £0.14
10uF Electrolytic Capacitor BitsBox 1 £0.07 £0.07
1uF Electrolytic Capacitor BitsBox 1 £0.07 £0.07
470R Resistor Carbon film 1/4W 5% BitsBox 3 £0.04 £0.12
100R Resistor Carbon film 1/4W 5% BitsBox 3 £0.04 £0.12
100K Resistor Carbon film 1/4W 5% BitsBox 2 £0.04 £0.08
(OPTIONAL) 100K Linear Potentiometer BitsBox 1 £0.64 £0.64
(OPTIONAL) Playing Card Case eBay 1 £0.99 £0.99
(OPTIONAL) Plastic Snap Rivets 10 Pack Maplin 1 £1.49 £1.49
TOTAL (£6.62 With Options) £3.50

Loading...