CW 4/23

0. Utilities

LED behavior

(* i is forward current in A  *)
(* Dparm are parameters that are specific to each type of LED *)
(* below are the parameters *)
redP={1,0.0422,1.945,11.35};
orangeP={1,0.0422,1.98,6.};
yellowP={1,0.0422,2.16,0.85};
greenP={1,0.052,2.2,11.35};
blueP={1,0.0478,2.85,7.6};
LEDparmlist={redP,orangeP,yellowP,greenP,blueP};

vfLED[i_,Dparm_]:=Block[{i0,k,vCx,r,vb,u,x},

(* forward only  *)
{i0,k,vCx,r}=Dparm ;  u=i/i0;
vb=k Re[Log[(((2. (u  (E^(vCx/k))+ 1))/( ((Sqrt[4  (u^2)+4 u (E^(-(vCx/k)))+ 1])+1))) )]] ; 
vb+i r
]; 

iCurrLED[v_?NumericQ,Dparm_]:=Block[{i0,k,vCx,r,vb,x},
{i0,k,vCx,r}=Dparm ;  
(* forward only  *)
vb= x   /. FindRoot[r  i0  (E^(-vCx/k))(((E^(x/k))-1.)/(1.-(E^(-2 (((vCx - x))/k))))) +x== v,{x,0.,vCx-0.01 k}]  ;
i0 (E^(-vCx/k)) (((E^(vb/k))-1)/(1-(E^(-2 (((vCx - vb))/k)))))
];

gLED[i_?NumericQ,Dparm_]:=Block[{i0,k,gC,dV,vCx,r,gv,u,x},
(* derivatice - \[DifferentialD]vLED[i]/\[DifferentialD]i transconductance  *)
{i0,k,vCx,r}=Dparm ;  u=i/i0;
gC=(E^(vCx/k)); 
(((-4 u+gC (-1-4 (u^2)+(Sqrt[1+4 (u^2)+((4 u)/gC)]) (1+2 u gC)))/(2 i0 u (1+u gC) (4 u+(1+4 (u^2)) gC))) )k+r
];

Example LED

If one has green LED, this is how to obtain voltage as a function of current:

ledselect=greenP;
Plot[vfLED[0.001 i (* we use i mA, hence, 0.001 to convert to A *),ledselect],{i,0,50}]

ledselect=greenP;
Plot[1000*iCurrLED[vf (* we use i mA, hence, 0.001 to convert to A *),ledselect],{vf,0.1,2.2}
,PlotRange-> All]

Do not use outside of range limit:

ledselect=greenP;
Plot[vfLED[0.001 i (* we use i mA, hence, 0.001 to convert to A *),ledselect],{i,-50,0}]
(* wrong result because out of range *)

1. Circuit problem 1

Consider this circuit: where (Subscript[v, s])[t] is a general source voltage (it can be DC or AC).

How do we use numerical method to solve it?

The mesh current equation of this circuit is: (Subscript[v, S])=(Subscript[R, 1]) i + (Subscript[v, LED])[i]. Node C is the ground. (Subscript[v, A]), (Subscript[v, B]) are the voltages of nodes A and B, relative to the ground.

This circuit is non-linear because of (Subscript[v, LED])[i]: it is a nonlinear relationship between v and i.

1.1 review LED behavior

To solve (Subscript[v, S])=(Subscript[R, 1]) i + (Subscript[v, LED])[i], we need (Subscript[v, LED])[i].

1.2 DC voltage

Consider a constant DC voltage, solve the circuit: current, node voltages

1.3 AC voltage

Let: (Subscript[v, S])=(Subscript[v, 0]) Sin[2 π f t] where (Subscript[v, 0])=5, (unit: volt); f=1 kHz; 
Calculate and plot (Subscript[v, B])[t] and current i[t] as a function of time. Approach: make a time-series array with sampling time interval Δt≤ (1/(16 f)). Note: separate forward and reverse (reverse current ~ 0 )

2. Circuit problem 2

vs[t]==R (Subscript[i, R]) +(Subscript[v, A])[t]
(Subscript[v, A])[t]== (Subscript[v, fLED])[(Subscript[i, LED])]  (if iLED>0)
(Subscript[i, LED])=(Subscript[i, R])-C((d(Subscript[v, A]))/(dt))

3. Circuit problem 3