Bass Boost

The questions below are due on Friday April 26, 2024; 05:00:00 PM.
 
You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.

In this lab, we're going to apply some of the ideas we've seen over the last few weeks to an authentic signal processing problem, implementing a "bass boost" filter for music. By the end of this lab, we should have a circuit that we can plug music into from an arbitrary source, and hear that same music but with the low frequencies amplified.

We'll bring to bear a lot of what we refreshed ourselves on in the prelab for this week, so if you haven't done that yet, it would be a good idea to do it now (though don't worry too much if you don't have a complete schematic for the system yet, as we'll work through one workable design in this document).

We'll approach this problem piece-by-piece, building up small "modules" to perform various analog computations, and then we'll combine those things together to make our overall circuit.

Our high-level outline will look like this:

  • We'll start by making a stable 4.5-Volt source (relative to the "-" sign of our battery) and do our work around that point, so as to avoid output limitations of the op-amp. For the rest of the time, we'll consider this to be our 0-Volt reference voltage (so all of the voltages discussed below are assumed to be measured with respect to this value).

  • We'll get two audio inputs from our TRRS connector, which we'll offset by this 4.5-Volt value to get the two signals we'll work with, V_L(t) and V_R(t); then we'll average them together (to get a single signal for the audio which we can then manipulate). Let's call this new signal v_a(t) ("a" for "average").

  • We'll then buffer v_a(t) so that we can make use of it in multiple places.

  • We'll use an RC circuit to filter v_a(t), making a version containing only the bass frequencies (let's call that new signal v_b(t), "b" for "bass").

  • We'll then amplify v_b(t) in such a way that we avoid output limitations of the op-amp, getting a new voltage kv_b(t).

  • Finally, we'll average together v_a(t) and kv_b(t) to get our final output (which should emphasize low-end frequencies while not losing high-end frequencies).

  • This new signal can then be hooked up to another TRRS connector so that we can listen to it via headphones :) but we'll want to be careful to subtract off our "virtual ground" value of 4.5 Volts.

This seems like a lot (and it is!), but like any big problem, we'll tackle it one small piece at a time as the lab goes on. And as you're working through, feel free to stop, think, and/or ask for help if you get stuck or if things aren't making sense.

Before we Start: Components

A few things to note before we get started:

  • Today's going to be a day for the big breadboards, rather than the small ones, given the amount of stuff we're going to have on our board by the end; we're going to be building a lot of pieces, and it might be a good idea to space them out on your board as well (rather than building all of the pieces in close proximity).

  • Today, we'll use a different kind of op-amp: the MCP6002. It has the same pinout as the TL082 we used before, which is shown here (and clicking it will open a copy in a new tab):

    Like with the other op-amps, a small dot on the surface of the chip marks pin 1. For any of these that you use, make sure to connect V_{\rm CC+} (pin 8) to the "+" terminal of the 9V battery and V_{\rm CC-} (pin 4) to the "-" terminal of the battery.

    We're going to be kind of abusing these op-amps today (if you read the datasheet carefully, they're only supposed to run with 6V, not 9V). They'll be fine, but be a little bit careful not to touch them while the battery is connected because they get really hot. fire emoji fire emoji fire emoji

    Note that the packages are labeled with "MCP6002" so you can tell that you've got the right component. DOUBLE-CHECK YOU'VE GOT MCP6002 AND NOT ONE OF THE OTHER KINDS WE'VE USED.

    And like the other op-amps, these packages should fit nicely right across the gap in the middle of the breadboard, like so:

Before we Start: Be Careful
BE CAREFUL AND FOLLOW DIRECTIONS!

If you don't do things carefully and correctly in this lab, there is a risk of messing up the sound card on whatever device you're working with. We'll steer you in the right direction, but just be extra careful to read everything, do all of the check yourself things, etc.

We're also happy to help with things, look over schematics before you start building, etc.

Additionally, it's a good idea to disconnect the battery every time you're building anything, and only plug it back in to test.

You may also wish to unplug the battery of your phone/laptop/whatever that you're using to play sounds when we get to that point; it'll dramatically reduce the risk of breaking anything.

1) Audio Signals

The circuit we're building here will involve processing audio, which we'll get from your computer/phone/whatever via a "TRRS" cable (tip, ring, ring, sleeve), named for the various regions of the connector, each of which carries a different signal. In order to grab those signals, we'll use a connector like this one, which will allow us to get access to those signals on our breadboard:

This connector can act either as an input or an output (and we'll actually use two of them in this lab, one for each purpose). These connectors are designed to connect to a 3.5mm audio cable:

The various regions on the connectors carry different audio signals. Generally, these cables are meant to carry "stereo" audio signals, which have separate values for the left- and right- audio channels. TRRS connectors also generally have a connection for a microphone, but we'll ignore that here. The mapping for these signals is shown below:

For this lab, we're going to ignore the "sleeve" signal since we're not using a microphone here. Once we have audio playing through a cable plugged into this connector, we can model it like so:

The connector just wires us up (via the cable) to something in your device that is making sound (which comes to us as a voltage).

Ultimately, we'll use one of these connectors to get an audio signal from your computer/phone/whatever onto the breadboard somewhere, create a circuit to manipulate that signal, and then use another connector to send that processed signal to a set of headphones.

1.1) Soldering the Connectors

These connectors come to us without the pins connected, though, so as we mentioned in the prelab, we're going to have you solder the pins onto them.

Grab safety goggles and wear them when you're soldering! 🦺👷🐈

Soldering these pins can be a little tricky, but the method we're going to advocate for involves putting the headers into your breadboard, long-end down and away from the other components in your board (or feel free to grab another smaller breadboard for this part and put it back after you're done). Then you can slide the connector's PCB onto the pins and use the hot part of the soldering iron to both heat up the pad/pin while keeping the board more-or-less level. Do one pin first to hold the PCB in place and then do the other ones. This short video shows the whole process:

Just don't hold the iron there for too long or you'll melt the breadboard.

Once we have them both soldered, go ahead and turn your soldering iron off; we won't be needing it the rest of the day. Safety goggles are probably also not necessary after this point, but you're welcome to keep wearing them if you want (in addition to protecting your eyes, they're very chic!).

Ultimately, we'll use one of these connectors to get an audio signal from your computer/phone/whatever onto the breadboard, create a circuit to manipulate that signal, and then use another connector to send that processed signal to a set of headphones. So we can set up our breadboard like so (but don't plug in the audio source or headphones yet, that's just for illustration purposes):

2) 4.5-Volt Source

Alright, now we're actually ready to get rolling. For starters, we want to take our 9V battery and make a stable 4.5-Volt source (where "stable" here means that regardless of what we hook up to it, it remains at 4.5 Volts). For resistor values for this part, you probably want to use resistances around 10{\rm k}\Omega.

Check Yourself 1:
If you haven't already done so, sketch out a schematic for this circuit. We're happy to help if you're having trouble.

Once you have your schematic in hand, go ahead and build your circuit. Put it somewhere near the middle of your board, not all the way to one end.

Layout Tip

We suggest connecting both blue rails to the "-" side of the battery so that we have an easy way to get at that voltage.

We also suggest putting the "+" side of the battery (9V) on one of the red rails, and your new 4.5-Volt value on the other red rail, so that we have easy access to both of those as well. Then you can orient your op-amp so that its pin 8 is on the side of the breadboard where you connected the "+" side of the battery so that the connection to V_{\rm CC+} is easy to make with one of the orange or yellow pre-cut wires.

Check Yourself 2:
Use either the multimeter or the oscilloscope to measure this voltage (relative to the "-" side of the battery) and make sure it is what you expect; it won't be exactly 4.5V, but it should be close, and it should be almost exactly half of your battery's voltage (which won't be exactly 9V either).

Also make sure that this value doesn't change much if you connect, say, a 1{\rm k}\Omega resistor between your 4.5-Volt spot and the "-" side of the battery.

Check Yourself 3:
Are you 100% sure that this is working as expected? If not, feel free to ask a staff member for help; but it's not a good idea to move on if this isn't working.

2.1) "Virtual Ground"

For the rest of the lab, we're going to refer to this potential (halfway between the potentials at the battery's terminals) as our 0-Volt reference potential (below, we'll often refer to it as e_{\rm ref}), and, moving forward, we'll measure everything relative to that point.

So far, we've been thinking of the "-" terminal of the battery as 0V, the "+" terminal as 9V, and this new voltage as 4.5V. But moving forward, we're going to think of the "-" terminal of the battery as -4.5V, the "+" terminal as +4.5V, and the voltage we just made in the previous section as 0V.

3) Wiring Up the TRRS Connectors

We're going to connect the pin labeled RING2 to our reference voltage so that the voltages on the pins labeled TIP and RING1 can be thought of as being relative to e_{\rm ref}.

Check Yourself 4:
Grab one of the TRRS connectors you made and connect them up as described above. Use an audio cable (from the front of the room) to connect your computer or phone or whatever to the TRRS jack, and start some audio playing (at a high volume, probably). Then probe V_L and V_R relative to e_{\rm ref} using the scope.

Now, we would like to average these voltages together using the ideas from the prelab. Go ahead and do this, using resistances of around 100\Omega.

Check Yourself 5:
Use your scope to probe the resulting average voltage (v_a) relative to e_{\rm ref}, and you should see a similar wiggling voltage.

4) Buffer

We're going to use this voltage v_a in a couple of different ways, and so we'll want to make sure that it's not susceptible to loading effects as we connect various things up to it. As such, we'll make a buffer to create a copy of this voltage that won't change when we connect things up to it. Go ahead and do that.

4.1) Virtual Ground Revisited

But, wait...why did we even bother making that e_{\rm ref} voltage? Why not just use the - terminal of the battery for everything? Let's go ahead and do a little experiment to see why this is such a useful abstraction:

  • Turn off any music you had playing, open up https://onlinetonegenerator.com/binauralbeats.html on your laptop/phone/whatever, set both numbers to 500, and hit play
  • Temporarily, connect RING2 to the - terminal of your battery instead of to e_{\rm ref}.
  • Use CH1 to measure the input to your buffer, relative to the - side of the battery. You should see a nice, clean sine wave on the scope.

Check Yourself 6:
You should see a nice, clean sine wave on the scope. If not, you may wish to talk with a staff member.

Now, hook up CH2 to measure the output of the buffer, again relative to the - terminal of the battery.

Check Yourself 7:
Why does the output voltage look the way it does?

TAKE A PHOTO OF THE OUTPUT ON YOUR SCOPE BEFORE CONTINUING; WE'LL WANT TO TALK ABOUT IT IN CHECKOFF 1.

Then put RING2 back where it belongs, and move your probes so that you're measuring the input and output of the buffer relative to e_{\rm ref} instead. You're likely to see a dramatically different shape.

Check Yourself 8:
Why are these two results so different?

Check Yourself 9:
Given that the op-amp is powered by the the "+" and "-" sides of the battery, why was it necessary to offset the left and right audio signals? Why could we not have left those relative to the "-" terminal of the battery?

4.2) Another Test: Listening

OK, now turn off that sine wave and start your music playing again. Since this lab is about audio, let's go ahead and listen to some, to make sure things are working! Plug your other TRRS connector into the breadboard. On this one:

  • TIP and RING1 to each other, and also to your buffered v_a
  • connect RING2 to e_{\rm ref}

We'll connect this up to headphones so that we can hear our audio. If you have headphones that have a 3.5mm audio connector (that fits into the TRRS connectors), you can feel free to use those; if not, we have some at the front of the room (which you can keep). And, if your audio source (computer or phone) doesn't have a 3.5mm headphone jack, we also have USB-C to headphone converters.

Start some audio playing. Feel free to use whatever audio you like, but something with a good bass line is probably a good bet. Our recommended song for this lab is "Toxic" by Britney Spears, since it has a really nice bassline that our circuit will be able to emphasize.

Other suggested songs if you're unsure of what to use are: "Superstition" by Stevie Wonder, "I Want You Back" by the Jackson 5, "Cruel" by St Vincent, or "Always Straight Ahead" by This Day and Age. But definitely feel free to choose something you like, too, don't just blindly go with whatever songs we suggest. Be your own person.

Once you have things connected like this and have some music playing, we'll get a voltage drop proportional to v_a - e_{\rm ref} across the headphones, which should result in audible music!

Check Yourself 10:
Make sure you can hear the music in both earphones. If not, we're happy to help!

Once you're satisfied, take the earphones out of your ears and then disconnect the battery from your circuit until we're ready to test again.

5) Schematic

Check Yourself 11:
At this point, if you haven't already, add everything you've built so far to your schematic drawing. We'll want to see a full schematic of everything at the checkoff, so it's a good idea to keep it up to date as you're working through things.

Checkoff 1:
Discuss the results of your experiments so far with a staff member.

6) RC Low-Pass Filter

Here's where the real magic is going to start to happen. We're going to take that buffered v_a signal and connect it up to a circuit like the following:

6.1) A Sine of Great Things to Come

Let's call the potential in between the resistor and capacitor v_b, as shown above.

Think back to this week's lectures, where we saw that, if v_a were a pure sine wave, the v_b would (after some small amount of time) be a pure sine wave at that same frequency, but shifted and scaled down by some amount. And as the frequency of v_a increased, the amplitude of v_b would decrease. In particular, we found that if v_a = V\cos(\omega t), then:

v_b(t) = \left({V\over \cos(\phi) - RC\omega\sin(\phi)}\right)\cos(\omega t + \phi)

where \phi = \tan^{-1}(-RC\omega)

In a second, we're going to try an experiment. But before we do that experiment, we need to make sure we know what to expect.

Consider the circuit with the specific values of R and C from above. If the input wave v_a had an amplitude of 1{\rm V} and a frequency of 20{\rm Hz}, what would be the expected amplitude of the output wave v_b, in Volts? Enter your answer as a single number, accurate to within 10^{-3} Volts.

What if the input wave had a frequency of 1{\rm kHz} instead? What would be the expected amplitude of the output wave v_b, in Volts? Enter your answer as a single number, accurate to within 10^{-3} Volts.

6.1.1) Run the Experiment!

Now let's try an experiment to make sure that reality matches our expectations!

Turn off any music you had playing and open up your favorite new website https://onlinetonegenerator.com/binauralbeats.html again on whatever device you were using to play the sound. Leave the audio cable connected to the TRRS jack, and then set both outputs on that page to 20Hz and click play.

Using your scope, measure both v_a and v_b (on separate channels), and use the scope to verify your experiment from before. Use the cursors to measure both the frequency and the amplitude of each wave and make sure that everything matches your expectations. Take a photo of your scope output so that we can talk about it during checkoff.

Then on that website, set "right ear frequency" to 1000Hz and click "Play" again. Note that v_a now looks like the sum of a 20Hz wave and a 1000Hz wave. What does v_b look like? Take a photo of your scope output so that we can talk about it during checkoff.

Something cool is happening here. When our input is a single sine wave, it gets scaled and shifted in a particular way according to the formula we found above. When our input is a sum of sine waves, they are each scaled and shifted by that same formula, independently of each other.

6.2) Play That Funky Music

Here, we're going to exploit that property of this circuit. We can think of v_a, when a song is playing, as being a sum of a whole bunch of sinusoids (you can take 6.300 or other classes about Fourier analysis to learn more of the theory behind that assertion!), and our little RC circuit works on each of those sinusoids independently; this has the effect of letting the low frequencies in v_a through roughly unchanged (things with low pitch in the song, like bass guitars and other low notes, or bass drums), but heavily attenuating the higher frequencies (higher pitches, the vocals, etc).

Check Yourself 12:
Now turn off the output from that web site (close the tab) and start playing music again. Use your oscilloscope to measure v_b and v_a at the same time, both relative to e_{\rm ref}.

How do v_a and v_b relate to each other? What are the obvious similarities/differences?

Try listening to it as well!

Checkoff 2:
Show your results so far to a staff member. Be prepared to discuss your results (including audio and oscilloscope outputs), as well as a schematic drawing of your circuit so far and a description of how it is working.

7) Booooost

Since our goal is not just to isolate the low frequencies but also to amplify them, we're going to add another piece here, to scale up v_b by some amount. We can do this with a non-inverting amplifier offset by our e_{\rm ref}, something like the following:

We're also going to get a little bit fancy here and make it so that we can adjust the gain by turning a knob. We'll do this by using a potentiometer to create a variable resistance and use that resistance as part of our amplifier setup. Remember that a potentiometer consists of two variable resistances that change as we turn a knob:

Here, we'll use a 220\Omega resistor for R_2. For R_1, we'll use one leg of a 10{\rm k}\Omega potentiometer, for example the \alpha R_{\rm P} one. Thus, as we turn the knob on the potentiometer, then, R_1 will vary from approximately 0\Omega to approximately 10{\rm k}\Omega.

Check Yourself 13:
Think of this output as a value k\times v_b. What are the biggest and smallest gains k we can achieve?

Now go ahead and add this module to your breadboard.

Layout Tip

The pots fit nicely into one side of the breadboard without needing to bend their legs at all, leaving one row of holes on either side of the breadboard to which you can connect wires.

Given this layout, it's a good idea to put the pot off on its own somewhere and run wires from the op-amp's terminals over to the pot and back, rather than trying to make the pot fit in the same rows that the op-amp's terminals are occupying.

8) Output

Finally, use 100\Omega resistors to average v_a (the output of our buffer from way near the start of the lab) and kv_b (the output of the non-inverting amplifier from the last section), and connect that output to TIP on the TRRS so we can hear it (and make sure that you've also removed any previous connections you made to that spot).

Also connect your probes to measure this average relative to e_{\rm ref}.

Check Yourself 14:
Try this with a few different songs. What happens to the music as you turn the knob? How does this show up on the oscilloscope?

On one extreme end, the song should sound unchanged, but on the other end we should hear a lot more bass!

Checkoff 3:
Show your results to a staff member, and be prepared to discuss not only your results but a complete schematic drawing of the circuit, as well as describing how it accomplishes the result we see.

Everything is yours to keep if you want it (including the circuit, the headphones, the connectors, cables, op-amps, breadboard, battery, etc)!