Search This Blog

Showing posts with label graphical approach. Show all posts
Showing posts with label graphical approach. Show all posts

Friday, 6 September 2013

What does equation y=mx+c got to do with specification?

Well, almost most of them. Take example, a voltmeter spec of +/-(10% of reading + 10% of range). The first term of % of reading is referred as gain error, and second term of % of range is referred as offset error.
to understand this from graphical approach,
let’s start by drawing out a x-y axis – with x being voltmeter reading and y being actual value
then draw a line with y = x (implied m=1, c=0) from –1 to +1.
Let’s try to interpret this graph
image

now, to further discuss this, i think it is best to throw in some number – let’s consider the gain error of +/-10%. what it means is that the line will has a slope of 10% deviation from our ideal line (m=1, c=0).
if gain error is all that we have, then we have something like below:
image

next let’s consider the case where gain error is zero, and +/-10% of offset error (remember that we are taking about +/-10% of measurement range offset). for this we have
image
Now, for the real world instrument – gain error and offset error is real and cannot be ignored.
Factor in both gain and offset error, we have resulted in a series of possible lines that the real instrument behave.

image
From the look of it, it seem pretty bad – as the uncertainty is high for the voltmeter reading, in fact – up to 20% of measurement range. But, what you pay is what you get, gain and offset error of 10% is chosen for the sake of our discussion here. For real voltmeter with decent pricing, you can easily get 0.1% accuracy for both offset and gain. In certain case (depend of calibration, operating temperature, pricing…) you can even get better than 0.01%! Now, that is impressive.

Note:
In this example we used a voltmeter, but most measurement / sourcing instrument (source measure unit, power supply, oscilloscope, capacitance meter….) present their spec in similar form. So you can apply this method to have a sense of what the spec mean – with graphical approach.

Sometimes, the manufacturer will give un-normalized spec for offset, which is essentially the same thing. take our example here of +/-(10% reading + 10% of range) , if the range is 10V, the equivalent un-normalized spec will be +/-(10% reading + 1V)

Sunday, 26 May 2013

Opamp Level Shift & Scaling Circuit Analysis

image

Generally DAC output will be from 0V to Vref, and to get bipolar output we typically use this circuit that convert [0:Vref] -> [-Vref: Vref], with Rf = Ri.

But what else can this circuit do if we are able to tweak Rf, Ri? Can it gives Vo > Vref?

There are few ways to get the transfer function of this circuit block, namely:

  1. circuit simulation - overkilled for such a simply circuit - don't you think so?
  2. algebra manipulation - going to be tough for those not doing it for a while
  3. graphical analysis base on circuit inspection - quick and intuitive - my personal favourite

in this example, I'm going to shows you alternative #2, and #3, have a nice read-up!


The algebra way:

Vo = Vdac + i * Rf
Vo = Vdac + [(Vdac-Vref)/Ri] * Rf
Vo = Vdac*(1+Rf/Ri) - Vref*(Rf/Ri)

but it is time consuming to write Rf/Ri, let's just replace it by α

Vo = Vdac*(1+α) - Vref*α

but Vdac is a function of Vref, let Vdac = β*Vref, where 0<= β<=1

Vo = β*Vref*(1+α) - Vref*α
Vo = Vref* [β + α*β - α]

where
α = Rf/Ri
β = dacData/dacFullResolution

it is always good idea to drop in some number to verify nothings goes wrong in the algebra derivation, let's do it now

let α = Rf/Ri = 1
Vo = Vref* [2β - 1]
β = 0: Vo = -Vref
β = 1: Vo = Vref
which is expected

Now that we have the final equation, we can inspect the equation as ratio of Rf/Ri changes:

Rf/Ri = 0:

  • Vo = Vref*β

Rf/Ri = infinity:

  • from Vo = Vref* [β + α*β - α]
  • when β = 0 (Vdac = 0): Vo = negative infinity
  • when β = 1 (Vdac = Vref): Vo = Vref

Conclusion:

from general equation of y = m*x + c, this circuit configuration allows us to configure maximum m = +1 @ c = 0, minimum m = negative infinity @ c = negative infinity, and max Vout = Vref.

For example, you are not getting more that Vo = Vref regardless of what Ri, Rf values you used.

 


The Graphical Way:


image

Step#1:

Figuring out what is input, what is output:

  1. draw out XY axis
  2. acknowledge that we control dac output directly, hence x-axis is label as Vdac
  3. Vo is the output of circuit block - we want to know what happen to Vo as Vdac changes - thus Vo as label for y-axis

Draw out the xy boundaries by circuit inspection:

  1. from circuit inspection - dac output can only varies between 0V to Vref, thus we draw at vertical line at x = Vref.
  2. from circuit inspection - when Vdac = Vref:
    • since inputs of op-amp is essentially the same potential - the inverting input is at Vref,
    • there is no voltage drop across Ri, both side of Ri at Vref, thus i=0A, and since there is no voltage drop across Rf, Vo=Vref
    • thus draw a horizontal lines at y = Vref

image

Step#2:

Acknowledge there is essentially one variable to play around - that is, the ratio of Rf/Ri :

  1. from circuit inspection - consider the case Rf/Ri = 0, it means Ri = open and i=0, and the amp act as voltage follower , Vo = Vdac, from y = m*x + c, this gives m =1, c =0, draw a line that cross point (x,y) = (Vref, Vref), (0,0), this is one of our boundary.
  2. from circuit inspection - consider the case Rf/Ri = infinity, when Vdac =Vref, Vo = Vref, when Vdac is slightly less than Vref, Vo = negative infinity, draw a vertical lines at x = Vref.
  3. region bounded by the 2 lines above is the possible circuit function for this circuit configuration. For example, you are not getting more that Vo = Vref regardless of what Ri, Rf values you used.

Saturday, 19 May 2012

Application of load line - Photovoltaic Relay Control

A simple task:
Given a battery, a Photovoltaic relay (PVT312) with datasheet, and choice of resistor value, how to select the resistance such that the internal LED current is at a value that ensure output switch portion of the relay is ON properly? Assume Vdd is 2V.

Background study of the problem
1.       This is an Photovoltaic relay, to properly switch it “ON”, we must have a min LED current.
2.       From the datasheet, the switch characteristic is stated at test condition of 5mA LED current, so 5mA is the desired current, and given Vdd, we need to pick a Rin.
3.       From the datasheet, we know that the voltage drop across pin1, 2 (the internal LED) can vary a lot, at 5mA, it can be at 1.5V is the device is operated at -40degC, and only 0.8V at operating temperature of +85degC
4.       Since this blog is only meant for beginner, let's just assume our device is only to be operated at room temperature (about 25degC), and thus we only consider the typical curve which has about 1.2V of diode drop at LED current level of 5mA.



Solution method#1 (direct calculation)
1.       From the curve, we know that at desired LED current of 5mA, the voltage drop of LED is about 1.2V, so Rin = (Vdd - 1.2V)/5mA, if Vdd = 2V, then Rin = (2V-1.2V)/5mA = 160Ohm.
2.       This is really quite simply, and everybody can do it, but there is a better way that gives you a lot more "insight", the load line way...

Solution method#2 (graphical approach – load line)


Just by drawing the load line, we can easily estimate Rin = 2V/13mA = 153Ohm. And it is not much different from the method#1. The difference is about 100*(160-153)/160 = 4%. The slightly different values is due to approximation when reading the graph scale, but in actual world it hardly matters, as when the time passes (aging), or different batch of IC being use, some variances are inevitable.
On the bonus side, using load line we can easily see at extreme operating temperature the actual current about 4mA to 7mA. Without doing any calculation!!!

Sunday, 13 May 2012

Derivation of load line

Derivation of load line:
1.       Let's say we know that we will always deal with some circuit form in which a voltage source, a resistor (linear element) will always be in series with another element which can be linear or non-linear. Then it makes sense to try to come up some sort of rules that can be easily applied in the encounters of such problem. To do this, refer to Figure1 above. Where X can be anything linear (such as resistor) and non-linear (diode, BJT...).
2.       If we consider the cases of Vx changing from 0 to Vdd, we can then draw the line of I versus Vx, and this line is our load line, with the slope equal to (-1/Rin). Where VRin is the voltage across Rin.

Load line when X block is a resistor:
3.       To ensure that this method makes sense, let block X be another resistor, Rx. Compare the value from typical normal derivation where I = Vdd / (Rin + Rx)), compare this result to the interception of two straight lines shown on the Figure 3 above (graphical approach), which can be seen as identical.

Load line when X block is a diode:
4.       Now to make things more relevant in real life, let's assume that X block is a diode and super-impose the diode IV curve on the diagram. Although there is no way for voltage across diode to reach Vdd (assuming Vforward of ~0.7V, Vdd of 3.3V or more), but we can still extend the load line till Vdd, creating some sort of asymptotes.



Example usage of load line:
Now, given a diode curve (Figure 4), if we need to pick a Rin value that allowed to circuit to have a bias current of Ibias, we just need to draw a straight line (load line) from x-axis Vdd to the point of diode curve that has the y-axis value of Ibias, then the y-axis intercept current, Io can be used to calculate Rin, with Rin = Vdd/Io.

Why do I want to talk about load line

A load line is used in graphic analysis of circuits, representing the constraint other parts of the circuit place on a non-linear device, like a diode or transistor. A load line represents the response of a linear circuit connected to the nonlinear device in question. The operating point is where the parameters of the nonlinear device and the parameters of the linear circuit match, according to how they are connected while still adhering to their internal systems.

It sounds simple, but for some reason it takes me years to really appreciate it and use it in the design works naturally. While I was still in school, I was taught to apply rules, plot out the load line, and use it to answer question. But in my mind, I always wonders about
1.       How does someone come up with the concept of load line?
2.       Why is it important? As I can still solve the circuit another way.

Not knowing the load line concept, but instead being forced upon to apply the rules blindly, my brain did what it must, memorized the question answering techniques, get in exams, score some pretty good marks, and completely forget about it in months after the exam.

Things that I intend to do blogging about load line:
1.       Derive load line based on actual need and basic concepts
2.       Relate real-life circuit design that applicable to load line.
3.       Shows the advantage it offers compared to other methods

Hopefully these few articles about load line will let the load line concept comes natural to the audience and hence allow application of load line comes in naturally when the need arises.