Wednesday, February 29, 2012

[Feb 27] Pendulum

Today's class was mostly a review and an application of what we did last week. It gave me a bigger picture of what is going on with the two parts of the circuit how they are connected.

First, this is the whole set-up:



The big picture is, on the left side, we feed in a voltage proportional to torque and the voltage coming out of the left side is proportional to the negative of speed. Then this voltage proportional to the speed comes in to the right side, gets integrated and comes out as a voltage proportional to the negative of position. Then this voltage was fed back into the left side, which generates a proportional torque.

This process can be described in the following diagram:

If there is no integrator, in other words, if torque is proportional to speed, then we have a damper. With the integrator, ideally, we should see a relationship between speed and position of a virtual spring as following:

The pendulum will slow down and eventually stop.

However, since we have the integrator, which eventually makes the torque proportional to the negative of position, the system will not slow down and stop.

Then Oscar demonstrated the analogy with the spring. When spring operates a force, it does three things: measure the displacement, compute how much force it should exert, and exert it. In the set-up, different parts do the same three things (as shown in the first graph). As the motor spins, voltage is proportional to negative of speed, which is "measuring" the speed; the integrator on the right is "computing" the voltage; then the part where the output of the right part is inserted as the input of the left side is "exerting" the voltage back into the system.

Then we move on to talk about the case where in the left part of the circuit, the combined resistors don't exactly cancel out the effect of the inner resistance of the motor. The voltage of the motor is -Vemf - Rm * I (because of the virtual ground, it's all negative). Since V is proportional to speed, I is proportional to torque, the output of the system on the left is voltage proportional to -w + αT. The output of the part on the right will then be voltage proportional to -θ + α ∫ T dt, which is proportional to torque. This is unstable because as long as you have a little torque, it is going to generate more torque in the same direction through the integrator, which will generate more torque through the cycle.


Here is the abstraction:
Then we started building the circuit. 


I asked Oscar the function of the two potentiometers in the system. The one on the left side is to determine whether the system is stable or not. When we reach extremes (please refer to the first graph), the system is going to be either extremely unstable or stable. When the potentiometer is in position (1), it is in a very stable stage (the motor will stop spinning); when the potentiometer is in position (2) in the graph, it is in a very unstable stage (the motor will spin in one direction very fast);. The analogy is as following:


In (1), it's as if a ball in a sink: very stable. In (2), however, it's as if a ball on top of a hill: a force in either side is going to bring the ball into motion in only one direction. It is only in the middle can the system truly function as a "spring" as the ball can oscillate back and forth.


The function of the potentiometer on the right is to control the frequency of the spinning of the motor. As we have deducted last week, the integration generates Vout = Vin + 1/RC *  ∫ Vin dt. The potentiometor controls the R in this equation. If R is very big,  Vout becomes very small: a small torque will be generated, which means low frequency; if R is very small,  Vout becomes very big: a big torque will be generated, which means high frequency.


Here is our circuit:



Here is our graph on the oscilloscope:

The blue curve indicates the speed; its probe is connected to the left side of the circuit in the first graph in this blog. The yellow curve indicates position; its probe is connected to the right side of the circuit.

This is another version, setting speed and position as the x and y axis:


The reason that it is not like the hand-drew graph shown earlier in this blog is because it is not a perfect circuit.

This is our spinning pendulum!


Saturday, February 25, 2012

[Feb 23] Abstraction

Today in class we learned about the idea of abstraction - getting the big picture of a complex circuit. Here is the abstraction of the circuit that we are eventually building. The specific equation will be explained later.
This is a circuit that creates a virtual spring. The box on top generates a voltage proportional to the speed of the motor. The integrator at the bottom integrates the speed to position. The box on top then generates a torque proportional to position, which is a spring. This makes the motor spins in alternating directions, as if it was attached to a real spring.

This is the circuit of the box on top:



We did this circuit last class and we knew that it generates a speed: Vout = -nKw. If T = -bw (torque and speed are in the opposite directions), then I * α = - bw (T = I * α, α is the angular acceleration). Torque proportional to w is friction, so the object will slow down (in this case, the motor will slow down). The circuit could be abstracted to this diagram: 


Torque proportional to w is a "damper" - it has friction and is slowing down at every second. 

To review how a motor works:
Since there is a voltage difference across R, we know that there is current coming down through R. This Im generates a torque, which is proportional to w, making it a damper.


If we want to make a virtual spring, we need an integration box. The integration box looks like this:






This circuit integrates w to position; therefore, it creates a "spring."
We can calculate Vout as following:






This circuit can also be abstracted to this diagram:


Then we connect the two boxes together and have the first diagram in this post.


The second half of the class, we started building the circuit. There was something wrong with our power source again (the connection of the board was bad), so we had to change the position of the power source to finally make it work. Oscar also encouraged us to put the pendulum on. And the pendulum was "confused" on where it should go... I didn't take a picture because we will keep on building it next class.

Sunday, February 19, 2012

[Feb 16] Motor Model and Building a Circuit with Motor

We started today’s class with a review of the motor model. Basically, there is a resistance within the motor, which adds Rm * Im to the electromotive voltage generated by the rotational speed of the motor, for a total motor voltage Vm = Rm * Im + Vemf

We want to separate the Vemf from the voltage across Rm.


As shown below, if we control the voltage of the motor, we do not control the torque. 

From T=K*Im, Vemf  = K * w (angular speed of the motor), we have T = K * Im = K (Vin – Vemf)/ Rm = (K/ Rm) * Vin – (K^2/Rm) w.



This equation shows that the torque in this circuit depends on both the input voltage Vin and the rotational speed omega (w).

Therefore, we need to control Im directly, so that we control the motor torque directly.


If we want to design a circuit to control Im, we can use negative feedback.


The secret of this circuit is the voltage divider.


We can work it out that the Voltage going out of this small part of the system (Vout) is (-R/ (Rm+ R) * Kw – dependent only on R.

Then we started to build the circuit. Today was the first time that I really enjoyed building my own circuit, even though it was not that original since Oscar drew the graph for us beforehand. I thought that knowing where to plug in and connect different places was really fun. Although we learned a hard lesson: CUT THE WIRES SHORT AND MAKE A PRETTY CIRCUIT! I didn't think that it was all that important until our circuit didn't work when we use the oscilloscope to test it out and Oscar came and said he had trouble tracing our circuit because it was too messy. We look at his instead and all the wires were cut nicely and fit right between the two connect points. Ours was full of "bridges" and sometimes that could cause connection problems and we would not know where to start.

Anyway, after Oscar helped us figure out the connection problem, our motor was able to spin with different speed and reverse direction when we change the voltage.

Then Essie and I spent the rest of our time fixing our circuit and cutting everything to scale. That took a little while but I do believe that it would be worth the time going through debugging every little connection.


Monday, February 13, 2012

[Mon Feb 13] Positive/negative feedback, LTSpice, motor

First thing first, after the class, I looked up a couple terms on Wikipedia. Here is the summary:


1. Positive/negative feedback: the end result of positive feedback is to amplify/attenuate so that small perturbations may result in big/small changes. This concept apparently also applies to other sciences or even economics. In the electronics world, "if the signal is fed back out of phase, the feedback is negative and if it is in-phase the feedback is positive."

2. Schmitt trigger: a generic name of threshold circuits with positive feedback having a loop gain (the product of the gain in the feedback loop and the feedback factor in that loop, still not very clear what that means) > 1. The circuit is named "trigger" because the output retains its value until the input changes sufficiently to trigger a change.

3. Hysteresis: the dual threshold action by a schmitt trigger (under positive feedback).

These clear my confusion a little bit since I found myself losing track of all the terms that we learned in class.

Anyway, today Oscar introduced us the concept of positive feedback and negative feedback. Their meanings are clearly described by Wiki. The important thing about them is that:

1. The circuit that we built expressed a "jumping" pattern (hysteresis) because it has a positive feedback.

(From Wiki's entry: Schmitt trigger)

2. When we have a negative feedback, however, we don't see the jump. Instead, we have the equation of V+ = V- (-6V < V+ < 6V). And in the range of -6V < V+ < 6V, there is a line connecting the two end points (as shown below).



3. Conclusion: in positive feedback, we don't see V+ = V-; in negative feedback, we do.

Then we moved on and used LTSpice to simulate positive and negative feedback. Now we know that LTSpice is a cool tool that enables us to virtually build a circuit. It has all the elements in a circuit (power source, resistor, wires, capacitor, etc.) Oscar directed us to build a positive feedback circuit first and ran the running man.

Our circuit looks like this:



After fixing a couple problems such as x-axis unit, we got something like this:



(From Wiki: Schmitt trigger)

And this is our own graph:



Then we went on and switched the positive and negative and built a negative feedback circuit. We saw the pattern in the Schitt trigger picture shown above.

Then Oscar encouraged us to simulate the circuit that we build last Thursday with the capacitor. However, as we are trying to cut some devices and wires, our Mac had some difficulty problem beginning with freezing. We restarted the Mac and went into VirtureBox. That's when things went really bad and the computer spent 20 minutes deleting itself and eventually we "killed windows" - Oscar... Because of that, I didn't get any of the screenshots and saved circuits of LTspice whatsoever...

That was that...

Then Oscar introduced motor to us. We learned that when we exert a force perpendicular to a stick, we generate a torque (T= F*d, d is the length from the center of rotation to the point where the force is exerted). Then we learned that the power of this mechanical system is P mech = T * w (angular speed) (note that electric power Pelectric = V * I). Then we learned about how torque works in a motor. A motor has two ends (positive, negative). The motor itself has some resistance, therefore the electrical energy cannot be fully transformed into the mechanical energy of the motor. In fact, Vemf (electromotive force) = K * w (angular speed) and torque of the motor T = K * I of the motor (the two constants are the same because of the conservation of power).


Our job is to think of a way to get rid of the effect of the internal resistance of the motor. We have a special setup to deal with that, which I didn't understand at the time but understood it more when it was explained in detail in the next class. Therefore, please see the next entry for the explanation of the setup. The basic idea is that we will try to control the voltage by controlling the correct combination of voltage division and generate Vemf out of the box. I hope Oscar can review this part on Thursday (which he said he would) because I haven't fully understood to an extent that I can explain it here... But the big idea is: speed generates voltage while current generates torque.

That was an intense but interesting class. Excited to move on to mechanics soon.