# Lab 10

The questions below are due on Friday April 17, 2020; 05:15:00 PM.

You are not logged in.

Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.

Music for this Lab

Goals:Today we're going to do some magic. We're going to light a string of lights that normally need a lot of voltage using only 3.3 V.

Before starting this lab check that your function generator is in High-Z mode by pressing Shift, Enter, the right arrow three times, down arrow twice. If it shows 50 Ohm, use the left or right arrows and Enter to switch to High-Z.

## 1) The challenge

As the field of microelectronics advances, the supply voltage ($V_{CC}$) continually decreases. What a few years ago was 5 V is now 3.3 V and getting to 2.7 V and then 1.8 V. The reason for the decrease is to save power, since the power consumed goes as the square of the supply voltage. However, the downside is that those low voltages make it more difficult to power sensors and actuators. Today we're going to use our knowledge of resonance and RLC circuits to make a large voltage from a small one.

What we want to do is light up a string of lights. We're using holiday lights. Each of the bulbs in the string is an LED bulb, which is a diode. We haven't covered diodes in class yet, but they are devices with a symbol and current-voltage characteristic like so:

The take-away here is that when a voltage of the proper polarity and magnitude is applied, current will flow. For the lights we're using, the turn-on voltage is around 2.4 V. Normally these lights are plugged into the wall, which provides 120 VAC, or 120 V sinusoid at 60 Hz (the actual peak voltage is higher, as 120 V refers to the RMS value, but we move on). LEDs operate under DC voltages, but to keep costs down, the manufacturers use a very simple circuit, something like the following:

According to this schematic above, found from here, the manufacturer puts a bunch of LEDs in series, and then puts those series combinations in parallel. At the end of each series substring is a resistor to set the current (we'll see how this works in a few weeks) and a blocking diode to protect the lights during the reverse phase of the AC voltage. So what happens is that during the positive portion of the sinusoid, the LED string lights up when the voltage reaches a certain value, which is ~2.4 V times the number of lights in series, which in our case is 50 lights (~2.4 \cdot 50 \approx 120 V). Then the lights go back out when the voltage falls too low, and during the negative-going part of the cycle, the lights are off. Like in this figure below:

Thus, it should appear that the LEDs flicker. However, since your eyes can't see the on-off cycle at this frequency, it appears to you that the lights are just on. In fact, your eyes are acting as a filter to create an "analog" signal from the "PWM" light signal. Very cool.

With our 3.3 V Teensy, we can light up at most 1 or 2 of these light bulbs. That's lame. We can do better.

## 2) Our RLC driver circuit

We're going to be using an RLC circuit that looks like the one show below:

What type of RLC circuit is this?

We use this circuit instead of a series RLC because our resistor, in this case the LED strip, is large. So we want a circuit where v_R will get larger as R increases, as opposed to a series RLC circuit, where the for high Q one needs to minimize R.

We're going to drive this circuit with a sinusoidal steady-state voltage. Well, not really. We're going to drive it with 3.3 V square wave from the Teensy. That means we're driving it with:

v_S = V_{DC} + v_{SW}

where V_{DC} = 1.65 V DC, and v_{SW} is the 3.3 V peak-to-peak AC square wave. By superposition, the particular response of the circuit will be the sum of the responses to the two signals. You should be able to verify that the particular response to V_{DC} will be v_R = V_{DC}, but that's not the interesting part.

What we care about is the response to v_{SW}. If you've had a class that introduced Fourier series, you'll remember that a square wave is created by an infinite sum of sinusoids, and that the most prevalent sinusoid is the one at the fundamental frequency of square wave. So if the square wave is at 10 kHz, then there will be a sinusoid at that frequency as well. In the figure below (taken from here) shows exactly that, if one adds up the right amplitudes and frequencies of sinusoids, then you can get a square wave. That's what we'll use to excite our circuit.

In driving this circuit at resonance, we want to maximize the Q of the circuit. If Q was infinite, the circuit be maximally responsive at resonance. To hit resonance, the drive signal frequency should match the damped resonant frequency \omega_d, which, since our Q will be larger than approximately 5 (hopefully much larger than that!), will be about equal to \omega_0.

Set up the differential equation for this circuit. From that, determine \omega_0, \alpha, Z_0, and Q in terms of R, L, and C. Remember, characteristic impedance, Z_0, was discussed in lectures 11 and 12. Note, you can also do this via impedance methods, though that's probably a bit new for most folks in the class.

\omega_0 =

\alpha =

Z_0 =

Q =

You may be able to see that Q is actually equal to R/Z_0. Does that make sense?

It turns out that if you solve the circuit for the sinusoidal state response to a signal v_S = V_0 \cos\left(\omega t\right), you will get that:

Set up an impedance divider such that
\tilde{v_{R}} = \tilde{v_s}\frac{Z_{C||R}}{Z_{C||R}+Z_L}
The impedance of an inductor is Z_L = j\omega L. The impedance of the parallel combination of the capacitor and the resistor i:
Z_{C||R}=\frac{Z_CZ_R}{Z_C+Z_R} = \frac{\frac{R}{j\omega C}}{\frac{R}{j\omega C}+R}= \frac{R}{1+j\omega RC}
. Plug in and solve:
\frac{Z_{C||R}}{Z_{C||R}+Z_L} = \frac{\frac{R}{1+j\omega RC}}{\frac{R}{1+j\omega RC}+j\omega L}
Simplify to:
\frac{Z_{C||R}}{Z_{C||R}+Z_L} = \frac{R}{j\omega L - \omega^2LRC + R}
So
\tilde{v_{R}} = \tilde{v_s}\cdot \frac{R}{j\omega L - \omega^2LRC + R}
Evaluating this at resonance (\frac{1}{\sqrt{LC}}), leads to the expression simplifying to:
\tilde{v_{R}}\rvert_{\omega=\omega_0} = \tilde{v_s}\cdot \frac{R}{j\sqrt{\frac{L}{C}}}
The magnitude of that signal will then just be:
v_{R,pk} = V_0\cdot R\sqrt{\frac{C}{L}}

v_{R,pk} = Q \cdot V_0

So, the Q directly scales the input voltage to create a larger output voltage.

## 3) Design the resonator

We don't have much control over $R$. In our case, $R$ comes from the string of LEDs. Now, the LEDs are diodes, and thus their resistance is not so easily defined. In fact, it is a function of the applied voltage, and is nonlinear with voltage. But before the LEDs light up, the current through the diodes is ~0 (see that plot above), and thus the resistance is large. Take a look at the expressions for $Q$. Does a large $R$ help? What happens to the circuit if $R \to \infty$?

Based on other measures, we do have an estimate of R, which is ~50-70 k\Omega when the LEDs are off, independent of the number of LEDs. When the LEDs turn ON the resistance drops, as evidenced by the i-v curve above, but it's OK to use the OFF resistance in your design. Just be aware that once the LEDs turn ON and the resistance drops, that the resistance will scale with the string length, so it will be easier in fact to light up a longer string than a shorter string, as far as R is concerned. Of course, lighting up a longer string will require higher output voltage, so there is a limit.

We also don't have much control over L. We have some inductors in the lab. They are roughly 47 mH, and that's what we'll use. Of course, if we really cared, we could buy inductors with all sorts of inductances and all sorts of specs (such as the series resistance). But this inductor will be fine.

But we can pick C. Broadly, there are two constraints:

1. In terms of maximizing Q, do we want a big C or a small C?

2. The other consideration is the current that needs to be supplied to drive the circuit. We recall that Z_0 gives the ratio of peak capacitor voltage v_{C,pk} to peak inductor current i_{L,pk}. We also know that v_R = v_C, and that i_L is supplied by the Teensy. Thus:

Z_0 = \frac{v_{R,pk}}{i_{L,pk}} = \sqrt{\frac{L}{C}}

The current from the Teensy is limited. In a past lab we found it to be 25 mA. Thus, to maximize v_{R,pk}, do we want a small C or large C?

Based on these considerations, pick a C. Which one of these constraints matters more? There are many approaches to take here, so play around a bit, and ask for help if you get stuck.

Checkoff 1:
Explain your design to the staff.

## 4) Build

Obtain a 47 mH inductor from the staff table.

Pick up the nearest C value from the cabinet. Most capacitors in the cabinet at the back of the lab are rated for 50 V, which is sufficient, but if you see a cap rated at 6.3 V or 10 V, don't use that!

Once you've picked C, create the circuit on a breadboard, omitting the lights (and thus R). This is now a pure LC tank circuit, and if we drove it at resonance we would theoretically get infinite capacitor voltage. We won't, for at least three reasons:

1. The inductor we have has a pretty high series resistance (10's ohms).

2. Teensy cannot supply the infinite current that would be needed.

3. The signal generator has a 50 \Omega output resistance

Drive the circuit with 3.3 Vpp square wave from the signal generator and use the scope to probe v_C. As you sweep the frequency, you should be able to find the resonance frequency. Measure it and compare to your calculations. Write down the resonance frequency you measure, and the peak-to-peak voltage at resonance, and thus Q. You should be able to make ~40+ Vpp. Cool, eh?

## 5) Sweep the leg

We're going to hook up to the Teensy in a minute and then to the lights, and when we do that we'll want to be able to tune just like we can on the function generator. So we'll use a potentiometer to do this, which you can get from the staff table. Here's the circuit we want to create:

The potentiometer is a variable resistor that should be in your kit. The two outer legs have a circular resistance between them (10 k\Omega in this case) and the middle leg is connected to a wiper that sweeps across the circular resistor, picking up an intermediate resistance that depends on the angle of the knob.

First set up the circuit not connected to pins A9 and 21. The 3.3 V should come from the Teensy. Use the multimeter to make sure that the voltage on the middle pin goes between 0 V and 3.3 V as you turn the knob clockwise.

Once it works, hook up the middle pin to Teensy pin A9. And hook up the LC tank circuit to Teensy pin 21.

The code on the Teensy will read the voltage from the potentiometer, and use that to alter the frequency of the square wave that we output on pin 21. Pretty simple stuff. We use the tone command to create the square wave because it outputs a square wave at a desired frequency.

Download this week's code. Extract the zip. In the Teensy code, you'll want to adjust the parameters MINIMUM_FREQ and MAXIMUM_FREQ to be a 1-2 kHz below and above the measured resonant frequency. Upload the code and try it out. On the screen you'll see the output frequency. Use the scope across v_C to find the resonance again. As you find the resonance it can be helpful to narrow the frequency range in the code to make it easier to hit the actual peak.

## 6) Light up my life

Now it's time to make some noise. Actually, make some light. Based on the **peak** voltage (not **peak-to-peak**) you get, determine whether you want a 10, 15 or 20 length string of lights. Get a string from the staff table. Hook them up in parallel with the capacitor. Do they light up?

Once you get your lights lit up, maximize the brightness by adjusting the frequency with the pot. Then, determine Q and thus R of the string of lights.

Checkoff 2:
Show your working light string to the staff.

## 7) And just for fun

Get out your prox sensor from lab 5 (or make a new one). Hook it up to your Teensy. Set PLAY to 1 in the code.

Now, the code will measure capacitance and use that to command the frequency. You may need to tweak the CMIN and CMAX values since your sensor may have changed.

## 8) Cleanup

Before you leave, it's time to clean up again! Steps for cleanup:

• Return the string of lights and inductor to the staff table.
• Carefully pick up your system and place into its plastic case.
• Throw away loose wires on your desk.
• Throw away paper, food, etc. on your desk.

Checkoff 3:
Show your cleaned-up lab space to a staff member.