In this two part Instructable we take you through the process of using a "solderless breadboard" to prototype an electronic circuit. Once we are happy that the circuit works we'll use the same components in a subsequent Instructable and solder the circuit on stripboard - sometimes called veroboard - to create a more robust, permanent circuit, without having to shell out or spend the time designing a printed circuit board. We'll go through some techniques for soldering on stripboard that should make your life easier too.
We decided a little portable amplified speaker you can use with your phone or MP3 player would be a great circuit to build, since it may well come in handy ...
- at parties
- at picnics
- on your bedside table
- not on public transport
You may well be wondering what a "Breadboard" is and why, of all things, it would find its way into an electronics project. Nowadays solderless breadboards, to use their full title, generally consist of a plastic board with a grid of holes arranged either side of a central channel. One plugs the leads (wires/legs) of electronic components into these holes to build an electronic circuit in a temporary way. The advantage they provide is that components can be plugged in or removed, or replaced, or swapped. It's this ability to edit and experiment with circuits relatively quickly and without involving solder that makes breadboards so great.
We'll talk about how breadboards work shortly. For now let's have a look at the schematic and get our parts together.
Step 1: LET'S TAKE a LOOK AT THE SCHEMATIC
First things first, we should have a careful look at the schematic for this project.
Never seen (or understood) a schematic before?
At the center of the schematic we have the single "integrated circuit", or IC used in this circuit. This particular IC, LM386, is specifically designed to be used in audio amplifiers.
We've drawn it here as it appears in real life, so you can see which of the 8 legs is which. Notice how the numbers start on the top left, beside the notch and count up as you go counter clockwise. This is generally how the pins on ICs are numbered. The triangle in the middle is the schematic symbol for something called an operational amplifier. This will do the job of taking a small voltage waveform coming from your headphone jack and boosting it to a higher power waveform capable of driving a small speaker.
The lines on the schematics connect the components electrically.
Look at the line from LM386, pin 1. It connects to one end of C1, a component that has a symbol with a flat line and a curved line. That's the symbol for an electrolytic capacitor. The curved line is the negative end of the capacitor and the flat one is the positive end. This capacitor has a capacitance value of 10uF or ten micro-Farads. If you follow the lines you'll see that the negative end is connected to pin 8 of the LM386.
Now look at the line coming from pin 6 (Vs). You'll see that this line intersects another line and we've drawn a blob or dot called a "junction" over that point to show they are connected electrically. Just below this you'll see that these two lines have a bridge shape where they jump another line coming from pin 5. That bridge shape shows that they are not connected. Sometimes schematics don't include this bridge shaped bit. In that case, when two lines cross you have to assume that they are not electrically connected unless that junction symbol is present to show that they are.
Some other symbols;
- Look for R1 and you'll see a zig zag line, this is the American symbol for a Resistor. This particular resistor has a fairly low resistance of only 10 ohms.
- Right above R1 you'll see a capacitor, C3, with a value of 47 nano-Farads. This symbol has two flat lines. In this case the capacitor is a ceramic capacitor, so it doesn't have a positive and negative side.
- In between C2 and C3 you'll see the symbol for a battery with it's positive and negative ends.
- Look for VR1 and you'll see the symbol for a resistor with a little arrow at it's midpoint. This is the symbol for a potentiometer - or pot for short - , a kind of adjustable resistor which we'll use as a volume control.
- On the far left of the schematic is the symbol for a jack connector, while on the far right we have our speaker.
As we build the circuit on the breadboard we will highlight the parts of the circuit we are working on. Successful prototyping is all about breaking circuits down into manageable chunks. The order in which we'll build this circuit is how we would normally approach breadboarding a circuit of this size and complexity.
Step 2: LET'S TAKE a LOOK AT a BREADBOARD
If you already know how a breadboard works you can skip this part.
Time to get acquainted with your breadboard!
The fastest way to really understand how a breadboard works is to peel back a little section of the adhesive backing on the underside. You will be able to see the strips of metal that act as both electrical conductors and clips.
If you orient your breadboard as shown you will have 2 rows of 30 vertical columns either side of a central channel.
Each of these columns contains 5 holes, which are all connected electrically. For example, holes a,b,c,d, and e in column 30 are all connected. If you want to connect leads from two components, you simply put the leg of one component in one hole in a column, and the leg of the other component in another hole in the same column
The columns are not connected across the channel, meaning that holes a,b,c,d,e in column 30 are not connected to holes f,g,h,i,j. The purpose of this channel is to let us insert ICs across the channel to avoid electrically connecting any of the pins to another pin.
The holes in the middle part of the board are not connected in the horizontal direction. For example hole 30a is not connected to hole 31a... or any other hole in the a row for that matter.
At the top and bottom of the breadboard, however, there are rows marked with a + or a - symbol and a red or blue (or sometimes black) stripe. In these rows the holes are all connected in the horizontal direction, but not in the vertical direction. These longer horizontal strips are intended to be used as convenient rails for the power sources in your circuit, but you can use them for other purposes. In fact, we will be using one of them to carry the output signal to the speaker.
Take a moment to look at the picture above. You can see that I've used a small red wire to connect one of those horizontal power rails to one of the pins on the IC at column 16. On the other side of the channel, I've used a small blue wire to connect the minus power rail to another pin in column 17. I've also inserted a small red wire that joins column 17 and column 15. Electrically speaking this is exactly the same as connecting column 15 to the blue power rail above, or even the one on the bottom of the board, since they are already connected by the longer blue wire to the right of the board.
Step 3: LET'S GET ORGANISED
Looking at the schematic we can work out what components we will need and make a list. We can call that list a "Bill Of Materials" or B.O.M. for short.
We will need ...
- 1X 10 Ohm Resistor - R1
- 1X 10 K Ohm Audio Taper (A10K) potentiometer - VR1
- 1X 10 micro-Farad electrolytic capacitor - C1
- 1X 100 micro-Farad electrolytic capacitor - C2
- 1X 47 nano-Farad (473) ceramic capacitor - C3
- 1X LM386 Audio amplifier IC in DIP8 package; can be LM386 N-1 or greater
- 1X 8 Ohm speaker
- 1X PP3 (9V) battery clip with wires
- 1X 3.5mm TRS (tip ring sleeve/stereo) Jack Socket
Tools and other bits
- A soldering iron and solder
- A solderless breadboard (the one used is "Half Sized" but a larger one will be fine)
- Solid core wire, 24 AWG is a good size, and multiple colours are helpful
- Optional; Jumper wires for breadboards, alternatively make your own from solid core wire
Step 4: LET'S MAKE OUR FIRST CONNECTIONS
We'll start by placing the IC, designating some rows for our ground and positive voltage rails, and making sure the IC is appropriately connected to these power rails.
I have taken the liberty of highlighting the particular parts of the circuit we are about to build. You can see this on the schematic and also on the breadboard, where I have highlighted the terminal rows involved in any particular connection. Hopefully this will clarify what is connected to what.
- We are placing the IC (orange) , connecting pin 4 to ground (blue), pin 6 to the positive rail (red), and placing a filtering or bypass capacitor (green) between the positive rail and ground.
- Place your breadboard as shown, so the blue voltage rails sit above the red rails.
- Connect the blue rail on top to the blue on the bottom; both of these will be ground rails. Do not connect the red rails (only one of these will actually act as a power rail).
- Place the IC in the middle of the breadboard - notice that the notch is facing LEFT so that pin 4 is facing the ground rail below and pin 6 is facing the positive voltage rail above.
- Use small jumper wires to connect pin 4 to ground (blue) and pin 6 to the positive rail
- Place the 100nF capacitor, C2, with the shorter, negative lead in the ground rail and the positive lead in the positive voltage rail above the IC. This capacitor helps smooth out ripples and variation in the supply voltage.
** NOTE: For the next steps we will be turning the breadboard around by 180 degrees, such that the notch in the chip is on the right **
Step 5: LET'S ADD THE GAIN CAPACITOR AND GROUND THE OPAMP
Now we're going to add capacitor C1 across pins 1 and 8 of the IC. According to the datasheet for the LM386 placing a 10uF capacitor across these pins bypasses a resistor within the IC and sets the gain of the amplifier higher; experiment with taking this capacitor out and plugging it back in again later on to hear the effect.
- We'll be connecting C1 between pins 1 and 8 (orange, purple) and connecting the inverting input of the amplifier to ground (red).
- **NOTE : We are looking at the breadboard from the other side now, with pin 8 facing down ** Use a wire to connect pin 8 of the IC to an unused row near to pin 1 on the other side of the channel. Doing this is nicer and neater than stretching a capacitor over the top of the IC.
- Place 10uF capacitor across this wire and pin 1. The positive side should be connected to pin 1.
- Connect pin 2 to ground; Here we're doing this by connecting pin 2 to the row pin 4 is in since it's already connected to ground. You could connect it directly to the ground rail if you prefer - the electrons don't care either way.
Step 6: LET'S BUILD THE OUTPUT CIRCUITRY
Now we're going to add the connections and components that will get our amplified signal to the speaker. We need to do some things to output signal to make it sound nicer and also to make sure the signal won't damage the speaker.
- We will be taking the output (green) from pin 5, filtering away some nasty sounding high frequency noise through C3 and R1 (purple), and protecting the speaker from potentially harmful direct current (DC) using nice big "AC coupling" or "DC blocking" capacitor, C4 (orange).
- Use a jumper wire to create a path for the output signal from pin 5, away from the IC and over the channel to the other side of the breadboard like I have here with the green and yellow wires. You could just use one wire if you prefer.
- Place C3, the 47nF capacitor, with one end connected to the output path as shown and the other end in a free row. Connect the 10 Ohm resistor R1 from the free end of the C3 to ground as shown.
- Place C4, the 100uF capacitor with it's positive leg attached to the output path and the negative leg attached to the red rail as shown. Note this particular red rail is not being used as a power supply rail like the one we attached to the chip, but to carry the speaker signal.
C3 lets unwanted high frequencies bleed through direct to ground rather than passing through the speaker. You can experiment later on by removing C3 or R1 to hear what the effect of this "low pass filter" has.
C4, on the other hand allows frequencies above a certain point to pass onwards to the speaker, but blocks continuous DC from flowing through the speaker. DC can damage speakers and other audio equipment.
Step 7: LET'S DO SOME SOLDERING
Before go much further we'll need to solder some wires onto some components.
It's generally a good idea to "tin" wires before soldering them onto or into something else.
The idea behind tinning is that it ensures that the solder has a good bond with the metal of the wire and the thing you soldering the wire onto. Stranded wire, in particular, benefits from tinning as it will stop the strands from fraying as you try to work with them and it ensures the solder is distributed between all the little strands. It also allows you to plug stranded wire, which is more flexible than solid core, into your breadboard.
The first picture sequence shows a nice technique for tinning wires
- First get a nice blob of fresh solder going on the end of the iron
- Drag that blob of solder along the exposed wire and off the end as you add more solder to provide ample flux
- You might be left with a blob of solder at the end of the wire. You can just snip this off.
- Tin all the ends of all the wires you are about to use
Now let's solder the wires onto the component
- We'll be soldering wires to the "tip" and "ring" conductors of the jack socket (yellow), the pins of our audio taper potentiometer (yellow, orange, blue), and the terminals of the speaker (black)
- Solder a wire onto the "sleeve" conductor of the jack socket (blue wire in photo). This will be attached to ground in our circuit. Solder another wire of the same length to both the tip and ring conductors. These carry the left and right audio signals respectively. This is a mono amplifier so we are mixing (summing) both signals together to be played through one speaker.
- Your jack socket may look different to this, look up the datasheet for yours to see which pin is which
- The jack socket I used was a "switched" jack, I just looked at the datasheet and pulled the pins that acted as the switch part out. You don't have to do this.
- Solder wires onto each of the pins or lugs of your 10K audio taper pot. Use different colours if you have them. The colours used correspond to those in the schematic.
- Solder a wire through each of the lugs on your 8 Ohm speaker. Be careful not to touch or damage the speaker cone or get solder on the little copper wires (seen here behind/underneath the lugs) that connect the lugs to the speaker's voice coil.
Step 8: LET'S CONNECT THE SPEAKER, JACK AND VOLUME CONTROL
Now let's hook the wires we just soldered into our circuit.
- We'll be adding the speaker (black), jack socket (blue and yellow) and potentiometer (blue, orange, yellow) to our circuit.
- Plug one wire from the speaker into the red rail that we plugged C4 into earlier. Plug the other into the adjacent ground rail.
- Plug the wire from the sleeve conductor of the jack socket into the same ground rail as used above. Plug the wire from the tip and ring conductors into a free row on the breadboard.
- Audio potentiometer: Got to get this bit the right way round!
- Plug the wire from the clockwise pin (yellow wire above) of the potentiometer into the same row we used for the tip and ring of the jack
- Plug the wire from the counterclockwise pin of the potentiometer into the ground rail (blue wire above)
- Plug the wire from the center pin (wiper) of the potentiometer to connect it to pin 3 of the IC (orange wire above)
That potentiometer is being used as a "voltage divider". The signal, which is a voltage waveform comes from the tip and ring of the jack through the yellow wires to the clockwise pin of the potentiometer. The voltage divider formed by the potentiometer leaves us with some fraction of the input voltage at the wiper pin. The size of that fraction depends on the position of the knob... et voila we have volume control!
We could have used a "linear" potentiometer here, but when dealing with volume controls in audio we use audio taper pots which have a logarithmic position to resistance relationship. Why? Because we perceive sound on a logarithmic scale. So what sounds to us like a linear change in volume is in reality a logarithmic change in sound pressure.
If you have a 10K linear potentiometer (it would say B10K rather than A10K) you can give it a more logarithmic sounding response by soldering a 68K resistor between the counterclockwise and wiper pins.
Step 9: LET'S POWER IT UP AND TURN IT ON!
Finally, all we have to do is plug in our battery and plug in an MP3 player or phone to test the circuit out.
- We're just adding the battery (blue and red) and plugging in some signal source or other.
- Hook up the battery clip (mine was already tinned).
- Red is positive. Plug this into the red, positive voltage rail on the opposite side of the breadboard from the speaker; the one that the speaker is plugged into is NOT a positive voltage rail!
- Black is negative and will be attached to ground in this circuit. plug the black wire into the black or blue ground rail.
- Plug in your sound source using a 1/8" or 3.5mm jack cable.
- Turn the volume halfway up on your device and on the volume knob and play some music!
Not working right? Don't panic. In practice electronics is somewhere between 30% and 80% troubleshooting.
Step 10: LET'S DO SOME TROUBLESHOOTING
Troubleshooting is a fact of life in electronics, and is the main reason for prototyping circuits on a breadboard.
In all likelihood, if somethings wrong it will be a misplaced component here or there. To make the process more straightforward it's best to break things down into some distinct troubleshooting steps.
Now is the time to have a walk and a cup of tea.
Can you hear music playing?
Yes, but it sounds awful!
- Check your taste in music... If it tastes bad, it probably is bad, try something else.
- If the sound is distorted or "clipping":
- Measure the voltage of the battery with a multimeter. If your battery is running low, the voltage across theterminals will be low, and the output waveform will be cut as it nears the peaks.
- Check the speaker to make sure nothing is rattling against it, or that it isn't damaged in some other way.
- Check the capacitors and resistors around the output, meaning C3, R1, C4. Are they the right values, are they connected as they should be?
No, can't hear anything...
This could be anything really... settle in!
- Start by making sure the IC is powered correctly. The positive rail should connect to pin 6 and the negative or ground rail should connect to pin 4.
- Next, work your way around each pin of the IC making sure that each pin has the correct components connected to it. For instance, pin 1 connects to pin 8 via C1 etc..
- Check the "signal path" starting with the input;
- The sleeve of the jack connector should connect to ground
- The tip and ring go on to connect to the clockwise pin of the potentiometer
- The signal comes out of the middle pin of the potentiometer and goes on to pin 3
- The signal reappears at pin 5, amplified
- from here the signal meets C3 and C4.
- From C4 the signal goes through the speaker, the other end of which should be attached to ground/negative.
- There is a small chance -especially if you connected the IC the wrong way round- that the IC is damaged, and so a new one will be needed.
If you had to do some troubleshooting, you'll hopefully appreciate just how useful breadboards are. In the follow up Instructable we'll be soldering this circuit on stripboard. Troubleshooting a stripboard circuit is a bit more tricky and frustrating. This dry run on a breadboard should help with understanding the circuit. We'll use a nifty trick in the next Instructable to help us avoid missteps and errors.
For now though, well done!