# Prelab 2

If you are a current student, please Log In for full access to the web site.

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.

#Prelab

**Goals:**In Lab 2 you will create a digital-to-analog converter, or DAC. In the process of doing that, you'll need to analyze circuits using superposition, which we'll get some practice with in this optional prelab.

## 1) An initial circuit

The overall goal with our DAC circuit is to create voltages that are within the ranges of our digital circuit. Our Teensy, for example, runs at 3.3 V (this is known as V_{CC}), and so it is excellent at setting pins to 0 V or 3.3 V. But what if we want to create a voltage of 1.65 V? Or another voltage? We need a DAC to do that.

Let's first analyze a circuit that will be useful in Lab 2. Examine the circuit below and determine the output voltage V_O when V_1 = V_{CC}.

**For the questions below, use VCC for V_{CC} and R for R. Do not use V_1 in your solution, since V_1 = V_{CC}.**

## 2) Superposition

Now, what happens if we have the following circuit instead:

We now have two sources. In practice these two sources will be two output pins from the Teensy, and so will each be able to be independently set to 0 V and 3.3 V (V_{CC}).

First, let's analyze an easy question about this circuit. Determine the output voltage V_O when V_1 = 0 V and V_2 = 0 V.

Now let's look at what happens when both sources are not 0V.

Circuits with multiple sources cry out for being solved with superposition, because the circuit is comprised of constant resistors and independent sources, and is thus linear. Thus, the output voltage V_O is the sum of the output voltages produced when each voltage source is individually activated.

As a reminder of how to implement superposition, we turn off all sources except one. By **turn off**, we mean set the value of the source to zero (0 V in the case of a voltage source, as we have here).

Let's first turn off V_2 and leave V_1 on. When turning off a voltage source, we set the voltage across its terminals to zero, which is equivalent to replacing the source with a wire (short circuit).

You should now be able to use series/parallel relations and voltage/current divider to solve this circuit without writing a set of equations.

Determine the output voltage V_O when V_1 = V_{CC} and V_2 = 0.

Similarly, determine the output voltage V_O when V_2 = V_{CC} and V_1 = 0.

Now, using superposition, the output voltage when both sources are on is the sum of the output voltages due to each source. Determine the output voltage V_O when V_1 = V_2 = V_{CC}.

Stepping back, we see that by independently turning on V_1, V_2, both, or neither, we can create 3 distinct analog voltages even if V_1 and V_2 each take on only two values (0 and V_{CC}).

Unfortunately, we see that turning on either of V_1 or V_2 has the same effect on the output voltage. This is why we only get 3 voltages out of the circuit driven by 2 sources. It would be great to have a topology where n voltage sources could create 2^n different voltage values. To do that we'll need a smarter topology, which we'll figure out on Friday.

```
```