Search This Blog

Showing posts with label visualization. Show all posts
Showing posts with label visualization. Show all posts

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, 20 April 2013

About Debugging Guidelines

In debugging – sometimes I got carried away with my “instinct”, although mostly it get me to the right conclusion in a short time – it is definitely too much of “black magic” to the newbies.
So my humble advice to the beginners is to think about every circuit or IC as a functional block – define the boundary yourself or from a schematic – make sense of the circuit does. To state the obvious, in a typical circuit block:
  • will have a function name in the schematic - this contains important info regarding what the block supposed to do
  • will generally has input, output, supply and control signals
identify which is which will generally give you a sense of how to debug the block
clip_image002
Once you know that the input/output relationship does not hold (assuming that you understand what the block supposed to do), here are some of the steps that might helps
  1. Bias the circuit so that the block will have known state (or consider overwrite the input from a known source), use DMM to confirm all the DC pins, starting with supplies pins.
  2. Confirm the input output relationship – if it is not correct, break this block into smaller block and repeat the process (take a look at binary search debugging post: http://electroniccircuitdesignsharing.blogspot.com/2013/02/debugbinary-search.html).
  3. If the block is already an IC, check for part number, orientation, cold solder join, missing solder joints before “accusing” it as faulty part.
  4. remember that sometimes certain failure mode needs more than a DMM to be used (see http://electroniccircuitdesignsharing.blogspot.com/2012/06/why-oscilloscope-is-needed-for-circuit.html) , so if DMM cannot give you convergence, you should consider to use another instrument (depending on what this block supposed to do).
so good luck with your troubleshooting!




Saturday, 23 March 2013

Thinking In Terms of Current

Some years ago, there’s this movie called “Lost In Translation”, now, I have not watched it, but that reminded me of how I used to viewed or analyse circuit diagrams. During my early days – I cannot think or view the circuit in terms of current flow, as such everything being translated into voltage terms. Since DMM is handy for measuring circuit voltages – things looked good.
But as years goes by – when I got better in circuit understanding – I realize that by translating current into voltage (using resistance, impedance, equations), there are valuable circuit insights being lost in translation. For example – if you don’t think in terms of current flows – you cannot understand how decoupling works shown in previous posts:
http://electroniccircuitdesignsharing.blogspot.com/2012/07/3d-visualization-of-better-decoupling.html
http://electroniccircuitdesignsharing.blogspot.com/2012/07/3d-current-flow-for-inverting-op-amp.html
To show you what I meant, from my earlier post about load line: http://electroniccircuitdesignsharing.blogspot.com/2012/05/load-line-bjt-signal-gain-amplification.html
There is this BJT amplifier shown as below:
clip_image001
In this circuit – assuming that it is in linear region, collector current changes with base current directly, in fact Icollector = hfe * Ibase, where hfe is the current gain of BJT. Yes, Vout might be our parameter of interest, but it really is just a “byproduct” of this action: Vout = Vdd – (Ic * RC).
So for beginner – I would like to say when we view or analyse circuit – it is worth the effort to try to think in terms of current – it will open a whole new world.







Friday, 1 March 2013

3D Perspective of Test Pen – And How It Works

I have always been fascinated by how a test pen works – since 12 years old, heck, i even tried to power up one with 2 AA batteries in series at age of 12!

As i found it tough to explain how it works, i been having this idea to draw it out in 3D, so finally i did it! Since this is related to high voltage stuffs, do read the disclaimer at the bottom of this page.

Look at the picture below, we have a test pen that light up when in contact with a "LIVE" or "HOT" wire, what's the magic behind it?
image

See picture below for the “BIG” picture. Through the body capacitance the AC current completed its path to Earth wire or Neutral wire, and light up the neon light inside the test pen.
image
In the picture, note that there are wires being routed inside the wall, floor, or ceiling, and in some cases the metallic piping under the floor will provide the return path for AC current as well.

See diagram below for the equivalent circuit:
image

Lots more info at link below:
http://en.wikipedia.org/wiki/Test_light

Friday, 23 November 2012

Source and Load Matching: Cyclist Perspective

If you ever ride a bicycle – you know how amazing that a bicycle with gear allow you to “match” your muscle (energy source) to any landscape (load). Essentially the gear match the source to load just like the way transformer match an AC source to its load.

Let’s look at a simplified diagram of the torque that your leg muscle generate versus the landscape – slope degree.

image

Assuming that at gear ratio of 1:1, for every turn of pedals the wheel will turn by one cycle, then:

Low Gear (1:0.5) means for every turns you make on the pedals, the wheel only make half a turn, since your leg muscle power is constant, your loss on speed is made up with your increase of forward force.

High Gear (1:2) means for every turns you make on the pedals, the wheel only make 2 turns, since your leg muscle power is constant  your gain on speed is made up with your reduction of forward force.

Now compare this to the impedance matching in audio amplifier:
image

Picture from Wikipedia - transformer to perform impedance matching

Saturday, 10 November 2012

Source and Load Matching: DC perspective

Have you ever wonder why people talk about source and load matching? I did, and one thing that I asked my self is whether I have something in DC domain that can help me to visualized it. Well see below for my way of understanding source and load matching.

Supposed that we have a circuit as shown below:
image
From there we can create a table of maximum possible power that Rl can pull out of the source Vs:
Vs Rs Rl Vo = VS * (Rl/(Rs+Rl)) Pout = (Vo^2)/Rl
1 1 0 0.00 -
1 1 0.2 0.17 0.14
1 1 0.4 0.29 0.20
1 1 0.6 0.38 0.23
1 1 0.8 0.44 0.25
1 1 1 0.50 0.25
1 1 1.2 0.55 0.25
1 1 1.4 0.58 0.24
1 1 1.6 0.62 0.24
1 1 1.8 0.64 0.23
1 1 2 0.67 0.22


From the table we can plot out the load power as Rl changes – as you can see, max Pout occurs when Rl “match” Rs, which is 1 Ohm in this example
image

Sunday, 14 October 2012

Impedance matching–What does a mountain bicycle has in common with a transformer


As a cyclist and a transformer user, can’t help to notice the similarity of the two. So below is the picture of a mountain-bicycle and transformer taken from my favourite source Wikipedia.
image

To compare them, look at the table of comparison below:
A Bicycle A Transformer
number of “teeth” of sprocket number of winding
front sprocket primary winding
rear sprocket secondary winding
gear chain transformer core
now, isn’t this amazing?


To understand sprocket, visit http://en.wikipedia.org/wiki/Sprocket

Pictures from :

http://en.wikipedia.org/wiki/Bicycle

http://en.wikipedia.org/wiki/Transformer

Thursday, 2 August 2012

3D Visualization Of Bad Decoupling Capacitor Placement

Placement matters: what happen when a decoupling capacitor being placed far far away from the IC that it is supposed to decouple? Compare diagram below to those in previous posts:


This time, I have removed all traces that that is not related to positive supply decouling capacitor discharge path. Obviously in this placement, the decoupling capacitor discharge path is much longer that those in posts stated above.  In this case there are much larger series inductance that discourage good decoupling performance (as it is more troublesome for capacitor to discharge).

Top view of top signals – positive supply decoupling capacitor discharge path



Top view of bottom signals – positive supply decoupling capacitor discharge path


Tuesday, 31 July 2012

3D Visualization Of Better Decoupling Capacitor Placement

Placement matters: One way to decide how good a decoupling capacitor placement is by looking at the discharge current loop. Continue from previous post (http://electroniccircuitdesignsharing.blogspot.com/2012/07/3d-current-flow-for-inverting-op-amp.html), re-placing the decoupling capacitor near IC pin6 to bottom and just under supply pin will allow much better decoupling performance due to smaller discharge current loop. Compare diagrams below with the ones shown in previous post for details.

Top view of top signals


Top view of bottom signals

Saturday, 21 July 2012

3D current flow for inverting op-amp with negative input pulse

I have always wanted to draw a 3-dimensional illustrative diagram on how the current flow – for the SMT circuit – with the Google Sketch up (mentioned in http://electroniccircuitdesignsharing.blogspot.com/2012/03/tools-for-circuit-design.html), finally I can create something shown in this post. Hopefully it is clear enough for you to understand how current flows after reading this.

Input and output voltages:



How the current flow – Inverting Amp with negative input pulse:


Top view of bottom signals:

Saturday, 26 May 2012

Load Line: BJT signal gain amplification visualization









Some notes on the curves:
1.       DC biasing point - when there is no signal of interest, this is the amount the current through BJT , and Vo2 is the voltage at Vout. Choice of Vo2 is by design - affected by Vdd available, amount of signal gain required, quiescent power dissipation by BJT, linearity required...
2.       Base current deviate from DC biasing point following the signal of interest
3.       Base current changes will cause collector current to change according to curves shown as Ib1, Ib2, Ib3..., the current will cause voltage changes on Vout, choice of Rc will affect the magnitude of the Vout signal.
4.       Non-linear region of IV curve (Cut-Off region) - if Vout swing were to reach this area, the amplification of signal will be distorted. This will cause clipping on output signals, THD (3rd order harmonic distortion)…

Additional note about BJT:
1.       BJT is actually Current Controlled Current Source - Base current controls Collector (compare this to Mosfet - Voltage Controlled Current Source – Gate to Source voltage controls Drain current)
2.       Rc will determine the signal gain, DC biasing point and some other parameters.
3.       From Kirchhoff law (V, I)
a.       only interception of each Ib curve with the load line is possible for a given circuit
b.      so as Ib changes, the instantaneous Vc (collector voltage) will be the intersections of load line with that instantaneous Ib curve.