Thursday, March 30, 2017

Dinking around on MATLAB is for people who have nothing better to do with their time

Did you expect to find something here? Hah.
.
.
.
.
.
.
.
.
.
.
Go home Professor Mason!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
You really wanted me to do this lab didn't you
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Why is this so important to you?!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Alright, alright.  Here's an obligatory picture of me doing things with MATLAB. That's all you're going to get though, so I hope you're happy.


As a side note, I actually don't have a copy of the MATLAB assignment that we're supposed to do in my lab book, but I didn't have the grit, the internal drive to ask for an assignment that I didn't want to do.
Alright.  Disappearing now.  Smoke bomb!
Image result for ascii smoke bomb

Please sir, may I have some more Mesh Analysis

March 21

We started the class with an opener on MESH ANALYSIS. And Mason saw that it was good.

We talked a bit about transistors and how they're equivalent to a voltage dependent current source from collector to emitter and a voltage source from base to emitter (NPN).  Technically, the voltage source is a diode, but hush now Thor, soften your thoughts into simplicity, and spread not the dangerous knowledge of diodes. There we go.  Voltage source.  0.7V.


Onto greater enemies: Lab Mesh Analysis 2 will be a worthy adversary!

Interestingly, the mesh analysis labs are named "Mesh Analysis", "Mesh Analysis 2", and "Mesh Analysis III". Were there a fourth edition, I might dub it "Mesh Analysis Four" to keep to the naming pattern.

Look there! Notes and Matrices!
1. Schematic, estimates for v1,v2

So this is the set of calculations that led me to the apex of my assault on Mesh Castle.  See the assault below:
2. Measuring resistance values and circuit testing


3. Measured values and error

We think we had a pretty good set up with low (enough) error.  There may have been some discrepancy between the resistances used, leading to a higher than expected current.  But all in all, we're fairly satisfied with our subjugation of Mesh Castle.

Summary
Mesh currents make for simple enough equations when Nodal analysis seems to have gone to crap.  This is a useful thing.  Transistors are some weird little dudes that limit current based on voltage on their base pin.  They're good for modulating current, kindof like a switch.  But not really.

I'd lastly like to point out that Alex wrote a funny sentence (both haha funny and that's not how a sentence works funny) that I'd like to wrap up with here: "Overall, our lab successfully verified the usefulness of mesh analysis."  He's a funny guy that Alex. Don't tell him, but he should shave that waxed carpet that's moved in on his upper lip.

Tuesday, March 28, 2017

Thevenin and Things

So today in class we did a quick review over how to do source transformations, which I'm still a little weak on, but I can do them.  Onto Thevenin's Theorem.  Thevenin's Theorem is used to reduce circuits to a singe voltage and series resistor across a pair of terminals.  It's really just a renumeration of the superposition theorem, applied to reducing an entire circuit.  Nothing crazy here.  Norton's theorem should be on the way.
We closed out with another example of Thevenin's Theorem. Celebration on Thursday.  Hooray!

THE LAB - Thevenin's Theorem
We did a thing.  It involved reducing a circuit to its Thevenin equivalent circuit, and verifying our measurements with a the nodes connected to a potentiometer.
1. Thevenin equivalent circuit on the excellent EveryCircuit software


Here is Alex taking a picture of our calculations, and of course, our calculations as well.
2. Schematic used with actual resistance values in blue.


We set up for our lab by, and here's the key, measuring our resistors and voltages to avoid troubleshooting.  We laid out our resistors and their actual values on the circuit diagram.  See below.  Approximated values in green, and measured values in blue.

3. Measured and theoretical values for Thev Voltage & Resistance.
In the picture below on the left, you can see our theoretical values for Thevenin's voltage and resistance.  Our measured Thevenin's are at the top right.
5. Percent errorr
Alex sneakily erased our error, so I'll enumerate them here: error for Thevenin Voltage and Resistance were 6.7% and 1.5% respectively.


4. Load resistor, voltage, and power

Our load resistor varied from 0 to 9.1kOhms.
We finished by calculating Power vs Resistance of the potentiometer.  See the table in the middle of the picture for a table of potentiometer resistance and Voltage measured.  We predicted a roughly linear relationship between power and resistance from the equation
P = I^2 *R
6. Plot of Power vs Load
Our graph looked roughly linear:

Software, Superposition Theorem and Source Transformations

Today in E44:

I had a bunch of coffee given to me this week.  I wanted to share the caffeine, so I brought my coffee gear to class, and made coffee for the team.  They were pretty stoked, and I should have taken pictures.  I hope this will suffice to deliver the full range of their emotions:
😀😁😃
    /\
     |
the team.
In class, we spent the first hour talking about a program to model circuits.  It's basically SPICE online.  It did a great graphical representation of the currents and voltages across circuit components. See: everycircuit.com.

We did a thing with superposition Theorem.  I've done a bit with the SP theorem, so it was pretty easy.  More interesting was the source transformation that Prof Mason introduced.  Apparently it is mathematically equivalent to compare current source with a resistor in parallel and a voltage source with a resistor in series. Mason did a good example of this in class, and I'm sure I'll get some homework practice.

LAB:
Our lab today was to practice the Superposition Theorem.  We had a simple circuit with two voltage sources.
An aside: The math for superposition theorem isn't hard, but we spent a good deal of time fiddling with the Discovery scope.  I'm coming to despise the discovery scope, and its way of coming loose in the breadboard, and having the wires I plug into it fall out.  In the future, I might test everything for voltage before I plug it in.

Our measured currents eventually got close enough to our calculated currents.  We rejoiced, and retired for the day.  Lo, behold our glorious measurements of sufficiently small inaccuracy to be considered acceptable:
Table, as requested by lab manual with measured/expected values for 3V,5V, both, and percent difference:


I hear your voice.  No not your voice, but the one that brushes up against your consciousness with a song of sweet, familiar whispers and questions of what you might eat in a few hours.  But now, poised to strike, the voice summons a question: "Thor you dingus. That picture doesn't include your theoretical to measured errors! What is the percent error between your theoretical and measured?!"

Ey o here ya go:
6% for the resistor connected to 3V
6.5% for the resistor connected only to 5V
3% total

Note that my error goes down as the numbers get bigger. Hooray for proportionality and the law of large numbers.


Thursday, March 16, 2017

An (often) easier way: Mesh Analysis

WOO E44 BACK ON LETS GO IT’S GONNA BE A GOOD DAY
This was the sentiment that surged into the forefront of my mind as professor Mason entered the room.  It subsided with almost equal haste as Mason began to wax on about the wonders of nodal analysis.


We did an long-af example problem.  Some BS:


Seen above: a tedious nodal analysis problem. Could've used mesh but why not use the hard way.


You can pretty much always use node analysis.  It’s a shitty way to approach a lot of problems.  A better way is Cramer’s rule, mesh analysis, and using Thevenin and Norton’s theorems.  We’ll probably talk about those after lab.



THE LAB: Nodal Analysis.  We calculated (and recalculated) values for voltages across a trio of resistors with trio of voltage sources.  We then set up the circuit on the breadboard, and measured for voltages.  We found a very good correlation! Less than 1% error. See picture below.
1. Schematic with nodes labeled and Voltages v1, v2 calculated.

2. Measured Resistance Values 
We measured -2.43+-.01V and -4.40+.01V for V1 and V2 respectively.  Our calculated values were -2.43 and -4.43 for V1 and V2.  

The circuit in action:



MESH ANALYSIS!
It only works with planar circuits.  But when it does? It’s great.  More good news: all circuits for this class will be planar.  
To do mesh analysis, 3 steps: (Note than there are equal numbers of meshes to loops)
  1. Assign mesh currents to the n meshes
  2. Appyl KVL to each of th en meshes.  Use Ohm’s law to express voltages in terms of currents.
  3. Solve the n equations.
(To contrast w/ nodal: assign nodal voltages, Apply KCL, solve.)




BY CONVENTION, mesh currents are always clockwise.

Thursday, March 9, 2017

Day 4--Heatin up: Swan dive into thermistors

Prof Mason is an angry god! To punish the late-arriving infidels (like Alex), we began class with a quiz.  Quiz was a bit of algebra KVL &KCL, and I don't think my brain was quite primed yet for actual thinking. More coffeeeeee needed. Fell asleep at the keyboard there.

From there we went to a lab with thermistors.  We're going to make a circuit that does a thing with a thermistor.  That thing will be to increase V_out by .5V over a temperature range from 25C to 37C w/ 5V input.
1.  Preliminary design (right, top right), calculations (left, and right, center), and comparisons (right). below in picture. 
2. Note that cold in our instance is room temperature, and hot is held by Kevin's hot hands.

So the lab:
3. measured thermistor values
So we began by calculating the range of resistor values that will allow for a .5V change or greater in series with a thermistor whose resistance varies from 7k to 11k.  We found a range of acceptable values between: 4.36k Ohms and 17.6k Ohms

Voltage drop vs time across thermistor
We then optimized that value by taking the derivative of the voltage out with respect to resistance.  We found the ideal resistor value of 8.6kOhms. The closest resistance was 8.2kOhms, so we went with that.

We set up our circuit, and measured the actual resistances of the resistor and thermistor.  We found the resistor was actually 8.26kOhms, and the thermistor ranged from 10.9kOhms cold to 7.1kOhms hot.
4.  measured voltages
We then measured the voltage out:
          Measured    Calculated    Error
Cold: 2.8+-.1V     2.86V           2%
Hot: 2.2 +-.1 V     2.14V          -2%
We think, as engineers, 2% error is pretty good.

5. Post lab
We would set up a series voltage divider with the thermistor in the bottom half of the divider, such that the output would increase in voltage as the temperature increases.  To achieve at least .1V/ºC, we observe that the rate of increase of the the thermistor increases in resistance roughly linearly, at a rate of about .3kOhms/degree Celsius (the thermistor increased 3.83kOhms when heated from 75ºF to 98ºF).  I elect to use proportionality for simplicity in math.

  If we choose a 5V source to match the constraints of the lab, we would need to choose a resistor such that the voltage divider shifted 2% in Voltage out per degree Celsius to satisfy a .1V/ºC requirement. To ensure we always meet 2% shift, we calculate with the maximum thermistor value (10.1kOhms) in our total resistance, as follows:

Marginal increase in Resistance = .3kOhms/ºC
(Marginal increase)/(Total Resistance) > .02
(.3kOhms/ºC) = .02*(10.1kOhms+R_2)
R_2 = 4.9kOhms
Since the next smallest value in E12 resistors is 4.7kOhms, we would suggest a voltage divider across a 4.7kOhm resistor and the Thermistor to guarantee .1V/ºC change in v_out.

BREAKEROO

I went to go talk to Anderson about the research project I'm doing for him for a bit.
When I came back, we were talking about current analysis and ground.
We talked about the utility of nodal analysis.

But the real lesson here was learning how to use MATLAB to solve systems of equations:
1.  Start by enumerating variables:
syms x y
2.  Label equations:
eqn1 = (right) == (left)   %noting that the == sign signifies an equation
eqn2 = (right) == (left)
3. Solve, and assign solutions to a structure
S = solve([eqn1 eqn2], [x y]) %equations, variables, both in a list
4.  Access solutions by addressing structure elements
S.x
S.y








 Supernodes are nodes that are include a voltage source along the node.
Properties of a supernode:
1. The voltage source inside the node provides a constraint equaition needed to solve for the node voltages
2. A supernode has no voltage of its own
3. A supernode requires the application of both KCL & KVL





Wednesday, March 8, 2017

Photocells, Voltage&Current divider review, Equivalent resistance

Today in class we did an experiment with a moldy, smelly hot dog, involving plugging each end of the dog into a prong connected to 120V AC from a wall socket.  The acrid scent of burning hot-dog is now unfortunately seared into our collective consciousness.  The purpose of the exercise was to predict current behavior in the putrid log of moldy meat.  We found that current decreases over time, as the sac of trans fats and cancer cooked.  We confirmed this when Mason plugged LEDs into the hot pseudo-meat logs.  We found that the LEDs that were parallel to the axis of the once-vibrant-animal-turned-filth turned on before flickering out as current decreased.  Professor Mason seemed to take special pleasure in poking the meat and overstating its size.












We then went over the MOSFET lab.  We noted that a MOSFET can serve two purposes:
  • To act as an on-off transistor between high and low voltages
  • To (roughly) linearly increase current passed within a range of voltages on its gate.


We then did a few current and voltage divider example problems in class. They were simple enough to skip over. The homework problems were like these, but harder.
I suppose I should mention parallel resistors were brought up.  Post-break we did a simple parallel resistor problem. Onto more interesting things!

LAB
Our lab involved a potentiometer photocell to measure the light in the room.  We can qualitatively observe an LED get lighter or darker proportional to the amount of light in the room. 
We had a little discussion of anodes and cathodes of diodes and how they block current in one direction.
Reverse bias - no current flow. Two terminal semiconductor devices conduct current in only one direction.  

BIPOLAR JUNCTION TRANSISTORs
ie. MOSFETs, are our voltage controlled current source.  BJTs are conveniently modeled current dependent sources.

in the context of our lab, a low resistance across the photocell will turn the transistor off, and a high resistance across the photocell will turn the transistor on.

Below are our calculations for a hypothetical photocell with min/max resistance of 5k to 20k ohms resistance.
We measured the actual min/max voltages of the potentiometer, and found resistance of 100 in a light setting to 50k Ohms in a dark setting.
We calculated the minimum and maximum voltage on the MOSFET gate given the photocell potentiometer resistances.
We had predicted that our maximum voltage would get up to 4.3V.
1. calculated values for Rmin and max, measured with a potentiometer.
2. Measured values: However, in our measurements, the range of voltages was only .32V at the lowest, and .72V at the highest resistances for the potentiometer.  This was confusing, but we hypothesize that some current travels from the v_out point through the potentiometer, and some travels through the gate to the LED. 

3. Video


This would explain the unexpectedly low voltage, .72V, dropped across the potentiometer, as the LED and potentiometer in parallel in parallel would be, according to a quick calculation using the voltage divider and parallel resistances, 1.6k Ohms total, and the LED at 1.66kOhms; much less resistive than the potentiometer's 60k ohms. 









Thursday, March 2, 2017

Resistors and Ohms Law - Voltage-Current Characteristics

In Class: 
We did a circuit exercise, analyzing potential difference.

We also calculated the hot resistance of a Tungsten filament using voltage and power ratings. Cold resistance is less than cold resistance.

We talked about branches, loops and nodes of circuits and how to describe independent loops in a circuit.
# Branches  = # nodes + # loops - 1
(b = n + l - 1)

Kirchoff's Law of Charge: Total Charge in and out is Zero, ie. Sum of Currents is Zero. We finished with a second lab where we measured the current out of a MOSFET while varying the voltage supplied to its gate.


In Lab:
We began by measuring the resistance across our resistor, which was supposedly 100 Ohms.  It was not 100 Ohms! We measured 67 Ohms.

We went to find another resistor closer to the desired 100 Ohms.  Our second resistor was 130 Ohms! We gave up and went with it.

Our power supply indicated the voltage supplied, but we measured the voltage across to be certain.  We found typically about 1% error in voltage values.  We then measured the current across the circuit by setting our DMM to current, and putting the DMM in series.



3. We found a direct relation between voltage and current:











2. We also played with a MOSFET circuit lab and the Waveforms software. We varied the voltage on the gate pin with waveforms software, and measured the current allowed to pass through the MOSFET. The graph on the right clearly points the MOSFET threshhold voltage of 1.2V. 
4. The MOSFET behaves like a voltage dependent current source. 
5. Estimated value: g = 10.5 Amps/Volt on gate beyond 1.2V.




















In conclusion:
We did a circuit analysis! We learned the difference between hot and cold resistance.
We plotted voltage against current in a simple series circuit with a 130 ohm resistor.
Using Waveform software, we observed how a MOSFET transistor passes current with different voltages on the gate.