Friday, April 29, 2016

Modem repair

The modem broke down a couple days ago and I was wondering what was the issue. I opened up the modem thinking that there would be a burnt component inside but as it was , that wasn't actually the right step. It turned out that it was the adapter that was at fault.

So I had an old one that was like some kind of transformer with various output voltages 3,6, 7.5, 9, 12 being some of them. Adjustments for these adapters are not accurate, for instance the 9V could read 13V.  So a multimeter is needed to find out what is the actual output voltage. It is probably not the best way to solve it but it kind of worked for a while. Then I think it got overheated or something,. As it was rated at 350mA, I thought it was the fault of the lack of currrent as the modem seemed to require 12V, 500 mA. This was not the actual case as I found out later that the adapter was able to output more that 500mA current. (around 1A to be exact).

So I went out a couple of times to get another one. There was an adapter rated at 12V 500mA but I settled for the cheaper solution which was another adapter with the adjustable voltages. As it turned out that did not really work - the reason seemed like the voltage output was just a little too low.  Its 7.5V would read 12.5V. It appears that though the modem was rated at 12V, it actually needed a minimum of around 13V to function properly.

Fortunately I was able to find another old adapter that was able to output around 13.5 V.  It seems to be working fine so far.






Wednesday, April 20, 2016

Revision of Circuits and Electronics - State and Memory (Lecture 16)

Video Lectures: -http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/lecture-14/

Lecture Notes:-  (Lecure 14 on OCW but lecture 16 on edX)  http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/lecture-notes/


The key is that a capacitor can store a a state for an extended period of time.

The equation for RC charging circuit is v_c=v_c(0)+  (V_I -v_c(0))(1-e^(-t/RC)) .  We ignored what happened all the way from minus infinity. v_c(0) was able to summarise the entire behaviour of the input from 0 backwards.

State is the summary of past inputs relevant to predicting the future.       q and v are state variables.

v_c was a function of v_c(0) and a function of V_I(t).

Zero state  is when v_c(0)=0.  Zero input  is when V_I(t)=0.

Zero state response (ZSR) occurs at  v_c=V_I (1-e^(-t/RC)). The capacitor charges up.

Zero input response(ZIR) occurs at  v_c=v_c(0)(e^(-t/RC)). The capacitor discharges.

The sum of the ZSR and ZIR gives the total response of the RC circuit   
v_c=V_I+  (v_c(0)-V_I)(e^(-t/RC)). This is a form of superposition.

Why memory? The calculator remembers the partial result.  It is needed to remember such results so that things can be done in sequence. Secondly, there is a need to remember transient inputs - signals that come and go away. Finally it is needed to store data.

With  this in mind, starting with a simple  example, a one bit memory element  can be built.   It will have d_OUT, d_IN and a STORE signal  which tells the memory cell to replace existing value with new value from d_IN.

A camera has a shutter button which helps to store the image. Think of this as a little pulse which opens to allow the image to be appear on the storage medium of the film and when it closes whatever that was recorded will stay in the camera.

Using this analogy, a simple memory cell can be built.  Let's say the waveforms for d_OUT, d_IN and STORE  start at a low value.  When d_IN goes high for a period of time ,  to store that value, a small STORE pulse can do the job. The STORE pulse is like a shutter release button. d_OUT will reflect what is at the input. The  last value that the memory cells saw  before the pulse went down to 0 is eventually stored in the  memory cell. The output does not go to 1 instantaneously, rather that it meanders up and rises slowly.

 In the first attempt to build a memory cell,  a capacitor is needed to store a value that is going to be read out, d_OUT. d_IN and a switch is connected to the capacitor. The control input of the s witch is connected to the STORE signal. When the STORE signal has a high value, the switch is closed.  If this is a perfectly ideal switch, and this is a true short circuit, and if d_IN comes from an ideal voltage source, then of course I'm going to see my capacitor charging instantaneously. However in pratice that is not the case - the switch has a resistor R_ON. So the capacitor has to charge through R_ON.

Let's say d_IN goes to a 1 and here is my store pulse that stays on for some period of time.
Let's say my dOUT is 0 to begin. As soon as the store pulse goes high, the switch goes into its On state. nd as soon as the switch goes into its On state, now the capacitor C begin surcharge through the resistor R_ON with the time constant, T given by R_ON*C. 

As the capacitor begins to charge, the voltage at dOUT starts to rise. So this is the voltage of v_c, which turns out to be the same as d_OUT. So that starts to rise, and when the store pulse goes
away, that value will be held out there.

We need to find out the width of the store pulse.  v_c=V_S (1-e^(-t/RC)) as this is a zero state response. The store pulse has to be wide enough for the v_c to charge to its valid high value V_OH.
Therefore V_OH=V_S (1-e^(-t_min/RC)) .  The pulse width needs to be much larger than t_min to give enough leeway for the capacitor to reach its final value.

Now with the store =0,  we need to find out how long is the charge going to sit on the capacitor. Suppose that the output is connected to some other circuit that has a load resistance R_L. In this case the capacitor will be discharging from a value V_S to a valid value V_OH. So we will need to find t_valid. 

 v_OH=V_S (e^(-t_valid/(R_L*C))) as this is a zero input response.  Therefore t_valid=-R_L*C* ln(V_OH/V_S). This method does not really work as the capacitor  discharges very quickly.

 The second attempt is to add a  pair of inverters (a buffer) to  the output.  The buffer has a large input resistance R_IN. The time constant is calculated to be about 1 millisecond which would give a better result for t_valid but still not good enough.

For the third attempt, the value is fed back  to refresh the node. There is a switch that is connected to STORE bar in this loop.  When STORE is a 0, the  same value at the output is recycled  to the capacitor and the capacitor  is meant to be refreshed. This does not work  because the external value can influence the storage node.

For the fourth attempt,  the feedback loop is now placed after the first inverter and is connected to another inverter and a switch. The switch  is connected to STORE bar.  This works as there is no path from the output to the input as it is completely decoupled using the inverter. This is a static random access memory (SRAM) where the value of the memory cell stays valid for a long period of time.

 An abstract 4 bit  memory cell has an input,  an output, a STORE signal and  an address line.  The address tells me which of the  four bits of memory I  am going to read or write. So the address is given by two bits 00 ,  01 , 10 and 11.    00 will read to memory cell 1, 01 to memory cell 2 and so forth. If my address says two and if store is false, then my output should read the second memory cell.  Similarly, if the address is two and store is on, then I should be writing into my memory cell two.

So to build the memory system, four memory cells are needed. The one bit output is connected to the four memory cells with switches A, B, C and D.  The values of A, B, C and D are produced with a decoder.  The address will be the input to the decoders while the outputs are connected to the A, B , C and D switches.

The INPUT is going to be connected to all d_IN. Then there will be AND gates which will be connected to the STORE signal and one of the  the outputs of the decoder. 

So let's take a look at how this works. So that say the address is 1, 0. If the address is 1, 0, then C is true.  And when the store pulse comes on, both inputs are a one. And I get a store pulse on this memory cell. And then whatever's on the input line gets written on to that memory cell. And then following that, if I'll reread the memory cell, I make the store pulse go away.  And if C is true, then the switch turns on. And the value can be read out on OUT.

From the truth table,  at any given point in time, only one of A, B, C, or D is a 1.  Memory cells
containing billions of memory elements are built using similar logic.


Saturday, April 16, 2016

Deleted draft!


I accidentally deleted my notes for  lecture 16 and so it will take some time for the next post to come out.

I will try and run though it quickly and post by next week.




Saturday, April 2, 2016

Revision of Circuits and Electronics - Ramps, Steps and Impulses (Lecture 15)

Video and lecture notes:- edX    MITx: 6.002.2x Circuits and Electronics 2:  week 4



We will find out later  why a slower input  results in less glitches.

It turns out that circuits can be used to model many real-life situations - the syringe and the drug can be modeled as a current source that is going to be dumping some charge. So it is an injection. And then the body can be modeled as a capacitor. So this is the body storage. So the body can be modeled as a capacitor where, when the syringe injects some drug, and in the electrical analogy when
the current source provides some current, that will then go and charge the capacitor and put the
charge in the capacitor. In the body situation, the injection will deposit some drug in the body.| Once a drug is deposited in the body, the way in which the drug is dissipated through the body is modeled with a little resistor where the drug is then finally dissipated. So it can all  be  modeled as a first-order RC circuit.

It is possible to model the input as a short pulse as  input  time duration  does not matter. What matters is how much charge is deposited by the pulse. This type of pulse is called as an impulse.

 There are several kinds of input-step, impulse, pulse  and ramp.

 A step input is one in which  the signal has been 0 for some time and at  a time 0, the signal goes to some d.c.value, say a 1.   Then if the signal is V_I(t), it can be written as V_I(t) =  u ( t).

If the signal has been 0 for some time and at  a time 0, the signal goes to some d.c.value, say V_I, then  V_I(t) =  V_I*u ( t).

If the signal has been V_I for some time and at  a time 0, the signal goes to some 0, then  
V_I(t) =  V_I - V_I*u ( t).  This is a falling step.

If the signal has been 0 for some time and at  a time T_0, the signal goes to some some dc value, say a 1, then  V_I(t) =  u (t - T_0).  This is a translated step.

When analyzing  RC  response to a  rising step, we need  to find out the voltage of the capacitor just before the  step rises,  v_c(0-).

It's been 0 for a long period of time- if  there had been any voltage across the capacitor, it would
have discharged through the resistor, so therefore the initial condition on the capacitor is v_c(0-), is 0 volts.

After a long period of time,  the input takes a step, the voltage  will be V_I . The capacitor will charge up fully to V_I. The output is going to be of the form v_c=  V_I(1-e^(-t/RC)) .

The circuit can be transformed into a Norton form.  After a long period of time,  the input takes a step, the current will be I. The capacitor will charge up fully to IR. Then the current, I, will begin flowing to the resistor and cause a voltage IR across the resistor. The output across the  capacitor is going to be of the form v_c=  I R(1-e^(-t/RC)) . 


For the RC response to a falling step, the Norton style of the circuit  is used. The reason  a current source is used is that, for  impulses, it makes it a little easier to think in terms of depositing charge on the capacitor.

When analyzing  RC  response to a  falling  step, we will also need  to find out the voltage of the capacitor just before the  step falls,  v_c(0-).

After a long period of time, the capacitor looks like an open, so v_c(0-)=IR.


Then at time t equal to 0, the input goes down to 0. The capacitor that  has an initial voltage IR across it, will now discharge through the resistor. The output across the  capacitor is going to be of the form v_c=  I R(e^(-t/RC)) . 

For the RC response to a pulse input which starts at t=0 and has a long pulse width (more than time constant RC),  the  output across the  capacitor is going to be of the  form v_c= I R(1-e^(-t/RC))  in the beginning and  then later v_c=  I R(e^(-(t-T)/RC)) where T is the pulse width.

For the RC response to a pulse input which starts at t=0 and has a shorter pulse width (less than time constant RC),  the  output across the  capacitor is going to be of the  form v_c= I R(1-e^(-t/RC))  in the beginning and  then later v_c=   I R(1-e^(-T/RC)) *(e^(-(t-T)/RC)) where T is the pulse width.
(the point where the waveform starts to discharge is  I R(1-e^(-T/RC)) )


 Looking at the current pulse, we can see that the area of the pulse is Q.  It is possible to make a pulse  deliver the same charge when it is made more narrow,  to the point that it becomes an impulse.

For the RC response to an impulse input, the waveform is v_c=  Q/C(e^(-t/RC)).  At t=0, v_c is at Q/C and analysis is done with Taylor series. 

v_c(t) is largely independent of T.   The capacitor behaves like a short circuit for changes that are much faster than  the time constant.  All charge goes to the capacitor V=Q/C. The impulse sets up initial conditions for the capacitor.

 Current impulse delivers charge while voltage impulse delivers flux linkage. For the RL response to an impulse input, the waveform is i_L=  λ/L(e^(-Rt/L)).  In this case, the inductor behaves like an instantaneous open.

 Superposition does not apply when initial conditions exist. It does apply when initial conditions are zero. One way of solving circuits with with multiple sources and
multiple initial conditions is the following:- 
(1) Treat  initial conditions like sources.
(2) Find the response to each source  or  each initial condition acting alone  and then sum  the partial response.

The notation for an impulse is  δt. The notation for unit pulse is u(t) and the notation for ramp is tu(t).  The other way of representing them are u_0(t) for impulse, u_-1(t) for unit pulse  and u_-2(t) for ramp.

Integrating an impulse produces a step. Integrating a step produces a ramp.

For a linear  system, differentiating the input will get the same  output  differentiated. If the input  is integrated, then the  corresponding output is integrated as well. This  provides  another way of finding the output, especially for ramps.

If there is  an input that looks like a step and a ramp on top of the step,  first find the response to a step. and  integrate it to get that of a ramp. Then I add the two up. So using superposition, it is possible get the outputs for all kinds of  inputs.

Going back to the slower may be better topic, one can see how parasitic capacitance  between two pins of a chip can affect a circuit. Consider R_1  to be the resistance of the wire for pin l and R_0 to be the load resistance and that they are connected to a near ideal voltage source. Also consider pin 2 having a system consisting of an ideal voltage source with a much higher frequency waveform and a resistance R_2. The wires of pin 1 and pin 2 are so close together that they form a parasitic capacitance which causes crosstalk.

Crosstalk is when a signal on one wire influences the signal on another wire  when it's not supposed to do so.  By superposition, R_1 is in parallel with R_0  and is in series with the parasitic capacitance and the source with a much higher frequency waveform.  Taking R_1 in parallel with R_0 to be equal to R.    The voltage across the resistor is   V_R=V_I*e^(-t/RC) which is an exponential decaying form. The positive spike corresponds to the rising edges  of the source waveform while  the negative spikes  correspond to the falling part of it. These spikes are superimposed on top of the waveform due to the other voltage source.

Slowing down the edges of waveforms to that of triangular waveforms will produce a waveform with less glitches. ( no change  in frequency)

 Taking 1/A as a constant value to control the slope, integrating the step input will result in a ramp of the form (V_I*t)/A.  Then by integrating the output  of the  step, the output of the ramp will be  V_R=  ((V_I*R*C_p)/A)*(1-e^(-t/RC_p)).  If RC_p is much less than A then the output of the ramp will be a very small blip.



Friday, March 25, 2016

Heat Wave

It has been really hot over here so I have been resting quite a bit. I have had to place a wet towel on my chest as I seem to be feeling hot in that area.

It gets very hot after 12 noon and reaches its maximum temperature at around 4 pm - my  running program has been reduced to 2 miles now. 5km runs can be quite tortuous sometimes, so maybe 2 mile runs could be the right amount. I did not see much of an improvement in stamina doing the 5km runs.

Sunday, March 13, 2016

Revision of Circuits and Electronics - Digital Circuit Speed (Lecture 14)

Video Lectures:- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/lecture-13/

Lecture Notes:-  http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/lecture-13/


An intuitive  approach can be taken to plot the responses to various inputs. There are two kinds of waveforms for the capacitor or inductor circuits- exponential decay  e^(-t/RC) and another one with an expression  (1-e^(-t/RC)) 

 Plotting the graph of v_c versus t , for  the case V_I > V_0, we can see that the capacitor will charge  up, so the waveform with the expression (1-e^(-t/RC)) is picked.  The waveform with the expression (1-e^(-t/RC))  starts off at 0  and ends at 1, which  looks something like (1-0)(1-e^(-t/RC))  so the  capacitor circuit should have  (V_I -V_0)(1-e^(-t/RC)) as part of the expression for v_c.  It can also be seen  from the graph that at time t=0,   v_c=V_0 , and (V_I -V_0)(1-e^(-t/RC))=0 so the  final equation should be v_c=V_0 +  (V_I -V_0)(1-e^(-t/RC)) with V_0 being  the initial value.

 For the case where V_I 0,  we can see that the capacitor will discharge, so the waveform with the expression e^(-t/RC) is picked. The waveform with the expression e^(-t/RC)  starts off at 1  and ends at 0, which  looks something like (1-0)(e^(-t/RC))  so the  capacitor circuit should have  (V_0 -V_I)(e^(-t/RC)) as part of the expression for v_c.  It can also be seen  from the graph that at time t=0,   v_c=V_0 , and (V_0-V_I)(e^(-t/RC))=(V_I -V_0) so the  final equation should be 
v_c=V_I +  (V_0 -V_I)(e^(-t/RC)).

 Applying the result to two inverters, we will need to draw out the circuit, which are two pairs of resistor and MOSFET. The capacitor is between  the gate and the source  of the MOSFET.  There are two delays at B(the input of the second inverter)  - the rising delay, the delay when the signal is rising and the falling delay. For cleanliness, the focus will be on the capacitor at B. 

 Suppose that the voltage at A ( input to the first inverter) is going   from 5V to 0V -from logical 1 to logical 0, then the output of it, which is B will switch from logical 0 to logical l. So we will need to figure out the rising delay at this point.

 Due to the capacitor at B, the output at B will be a waveform with the expression (1-e^(-t/RC)). The rising delay or t_r is the  time taken to reach the valid value for a high signal V_OH.

We  need to figure out what is the equivalent circuit that can compute the rise time.  It is generally around the output at B.  From there, we have to assume that the output at B starts at 0V. So  we need to find out how long it takes to go from 0V to V_OH. 

When A goes from 5 volts to 0 volts, the MOSFET for the first inverter  turns off and so the capacitor at node B starts to charge up from 0 to V_S. Therefore the equation will be  v_B=  V_S(1-e^(-t/RC)) . So we need to find the time t  it takes for v_B to reach V_OH.

The rising delay t_r= R_L*C_GS*ln((V_S-V_OH)/V_S). This value is quite close to the time constant RC so for a quick answer to the value of the rising delay, the time constant can be used.

 If t_r=0.16 ns,  the frequency will be  1/t_r=6GHz but there are  generally 10 to 20  delays, so for 10 delays,  the frequency will be 6/10 GHz = 600 MHz.

 Next, we need to figure out the falling delay. Falling delay is simply the time for which v_B to  fall from V_S  to V_OL. So it starts out with   the first   inverter  off, and so v_B has charged up to VS.  Now, the moment this inverter switches to its on state, when the input at A goes from 0 to 1 ihen this MOSFET, which comprises gate x, will turn on.  As soon as it turns on, then not only do I have a VS
connection through R_L to node B, but also the  R_ON resistance.  v_B(0)= V_S=5V

Thevenin's theorem can be used.   V_TH=V_S (R_ON/(R_ON+R_L))  and 
R_TH=(R_L*R_ON)/(R_L+R_ON).  The capacitor will discharge from a voltage of V_S to V_TH.
The exponential decay is governed by the time constant RC.

 The time constant RC=R_TH*C_GS. the equation will be  
v_B=  V_TH+(V_S -V_TH)( (e^(-t/(R_TH*C_GS))) . So taking V_B=V_OL  , the falling delay
t_f= R_TH*C_GS*ln((V_OL-V_TH)/(V_S-V_TH)).

 Once again, the value of the time constant is  close to that of t_f.   The effect of R_ON  has made the time constant smaller resulting in a smaller falling delay (waveform falls faster).

There may be times when slower may be  better.  A real life example was when a  group of students in a university built a chip  which had input and output pins. What they were hoping to see from the output was a nice little step from a low voltage to a high voltage. What they saw was a slow rise. So they thought they could make a faster wave by reducing the resistance  but what they got was a waveform with many glitches.

 The solution was to slow down the edges  of the waveform.  There  was a parasitic capacitance between the pins which had caused the glitches.







Wednesday, March 9, 2016

Revision of Circuits and Electronics - Inductors and First-Order Circuits (Lecture 13)

Video and lecture notes:- edX  MITx: 6.002.2x Circuits and Electronics 2:  week 3



Capacitors and inductors are both energy storage devices.  They are duals of each other. The structure of the inductor is a core  with a magnetic permeability  μ and a coil of wire  wrapped around it.

 Let's say a current i is flowing through the wire, there is a voltage between the two terminals of the wire, there are N turns  of wire , the area of the core is A and the circumference of the core is l.

Let's say that it has a total magnetic flux linked  to it called λ.  So when  a current is passed through this coil of wire, there is a magnetic flux that links with each of these turns of the wire. And add them all up,  and  a total flux linked called λ is obtained

So the inductance of this is given by (μ N^2 A)/ l.    This is quite similar to the equation of capacitance C=eA/d.  

For the inductor, there is a relationship between the magnetic flux λ,  inductance and current  where  λ=Li.  (Units for  λ is Webers and units for L is Henries). This is quite similar to the equation of q=cv for the capacitor.  

From Maxwell's equations, v=dλ/dt = L di/dt.  This is similar to C dv/dt for capacitors.


i can be   expressed in terms of v.  i is   the integral of v dt multiplied by 1/L with  the limits between t and  negative infinity.


Power can also be computed. P=vi= iLdi/dt). From integration, E=(L*i^2)/2. This is similar to
 E=(c*v^2)/2 for the capacitor. This is an important equation as it proves that the inductor is an energy storage device.  This also makes it a memory device. It stores energy and that energy it stores, remembers what had happened before.


Inductor L is connected to a  the voltage source v(t). The current flowing into the inductor is i(t). The initial current flowing in the inductor is i(t_o).

We need to pick some voltage-a pulse  which has a height of V for some amount of time T.  We need to find i(t) for this input voltage.

To do that, we need to use the integral ofv dt multiplied by 1/L with  the limits between t and  negative infinity. By splitting the integral into several parts,  the graph  of i(t) versus t can  be drawn.  The height during the time T  is VT/L.  This is similar to what was obtained  for the capacitor   IT/C.

Inductors  like to  hold on to  the same current.  If  a large current is pumped into the inductor, the inductor looks  like an instantaneous open  and it could breakdown.


Analyzing RL circuits, a Norton equivalent type of circuit is used where a current source, a resistor and an inductor  are connected in parallel. Applying the node method and rearranging, we will get a first order differential equation  L/R (di_L/dt) +i_L=i_I.

 For the  next step, a solution to this equation, can be obtained by inspection based on the solution obtained for the capacitor circuit. The initial conditions of the inductor is i_L(0)=I_0  and the  input source i_I(t)= I_I. So now we will have a differential equation   L/R (di_L/dt) +i_L=I_I.  The time constant is L/R.

If we base the solution of the inductor with that of the capacitor, the equation obtained will be  i_L=I_I+(I_0 - I_I)e^(-t/τ)   where time constant  τ = L/R