Reading Time: 18 minutes

We thrive by taking nothing for granted! 

CEV had its first practical hands-on with MOSFETS when we tried to implement a primitive inverter circuit. Device used was IRF540. Back then we didn’t find it so fascinating, considering it just one chisel in our tool-box like resistors, capacitors and inductors, battery, diodes, etc. Only did we moved forward in our lives we realized how one single device characteristic if carefully manipulated can help us to build so many useful stuffs.

If we look at statistics, MOSFETs is most widely manufactured electronic device or component in the entire 200 years of human technical endeavour. The number in fact overshadows all of the other devices lined up altogether. Wikipedia says the total number of MOSFETs manufactured since its invention is order of 10^22. This is just a number we don’t have anything much familiar to correlate and help understand how really big it is.


Systems like an ordinary radio contain in order of thousands of MOSFETS to provide enough gain to EM waves to finally yield audible audio signals, the smartphone on an average contains in order of 10 Million, an i5 intel core processor contains in order of 1.5 Billion of them, the power supplies for electronic gadgets we use though utilize another variety of MOSFETS called power MOSFETS. The circuitry (power and control) used in handheld devices like trimmer, hair-dryers, toasters, washing machines (automatic), efficient motor assemblies, cars, airplanes, satellites, space shuttles, particle accelerators and what not………., all of them essentially have insane amount of no. of MOSFETs operating in one of its particular desired regions of operating characteristics depending on analog, digital or power device category, very silently and calmly doing its job it is supposed to.

MOSFETS single-handedly forms the backbone of entire analog and digital electronics. Yes, you heard it right, both analog and digital. It lies at the heart of almost all the basic components which are used to build higher-order circuits or devices.

Wait, wait, we promised ourselves to not take anything for granted so when we say analog and digital electronics what do we mean exactly?

Essentially analog and digital are two ways of playing with signals (of voltage or current). Playing here might literally mean fun like playing a song over a speaker, displaying a video on LCD, LED or CRT, talking with loved ones over cellular network, enjoying a live broadcast of a soccer match and capital FM or even as simple as using TV IR remote to frustratingly switch over news channels which spread crap at 9 PM oooooooorrrrrrr playing could also mean stakes as high as using an ECG and other biomedical sensors and instruments to save lives, sending and receiving radio signals of a pilot messages to ATCs, or implementing something as necessary as what we call www.

It is hard to think all of these sharing anything common, right, but in all of the cases we are simply manipulating signals all the time in order to just somehow do what we want using the analog ways or digital ways or most of times both.

Well, it may be hard to think what signal manipulating exactly means here, nor we intend to talk about the grudging details but what we want to first appreciate is the profound immensity and necessity of the things which we are going to talk about.

Again, taking nothing for granted, the first question to address is what exactly signal manipulation would be using analog way or the digital way?

  1. The core requirement of real life the Amplification of signals:

Consider all the different kinds of sensors deployed on field to measure any physical parameter of interest like a temperature sensor in Air conditioners, a metal detector at airports, a stain gauge sensor, an antenna for radio waves detection, a heart-beat or pulse sensor, etc. In all the cases we exploit natural phenomenon to get variation of temperature, strain, EM waves, vibration converted to electrical signals (maybe voltage or current variations). The strength of converted electrical signal is by nature too weak for any purposeful use, like displaying the values of temperature or beats per second on some kind of screen, playing the song received on antenna, etc. The circuits that produce these magical outcomes can’t be driven using signals of such feeble power. We need a man-made device which can significantly boost the signal power.

Graphically. Amplification be like:


2. Filtering is another core requirement of real life:

In the electrical signal at the output of any practical sensors, we have by nature something called a noise. These noises are result of different reasons for different systems. To separate the noise from the useful signal based on the characteristics of systems we use signal manipulation technique called filtering, using something called as filters.

3. Along with these basic kinds of manipulation we have another range of signal manipulation, which essentially helps us to do computation. Like mathematical operations like addition, subtraction, integration, etc. can be achieved using voltage dividers, RC circuits, etc.

In these cases, we by default assumed that signal voltage or current can take infinite number of possible levels in between any two finite levels, between 3 V and 4V, our signal can be 3.11V, 3.111V, 3.1111V, etc.

Why go digital, if we can do it all in analog?

Most of time in digital world first we learn how to do it, then do it and only then we understand why we did it. Digital way of doing things is especially advantageous in doing things described in (3).

Digital way is moving from representing infinite levels signals to no levels between signal levels, only two levels called high and low. This doesn’t make direct intuitive sense unless we study them first.

However, some obvious motivating reasons for moving for digital way is inherent noise immunity, and simplicity.

The digital world has its own kind of signal manipulation requirements like inverter (NOT), adding (AND), orring (OR), etc, in general elements which execute these are called gates.

The layer upon layers upon layers…………

All of this begins by looking at nature. Because we are simply restricted to things, she can provide us, no other choice. Our role is to observe, modify and manipulate whatever she can offer us to make some good use for ourselves.

Resistors, capacitor, inductors, battery, semiconductor switches (Diodes and Transistors) all of this forms the most primitive components which are most basic building blocks. Also, in this category we have devices which exploit natural phenomenon like Photoelectric Effect, Piezoelectric effect, etc. to make sensors like photodiode, strain gauge, etc.

Using these components, we build a little higher order systems, say for example a voltage divider (using battery and resistances), a primitive filter circuits (using resistors, caps and inductors), or maybe most importantly the center of this discussion, an amplifier circuit (resistor, transistor, and battery).

The next order of systems now comprises of these little systems as basic blocks. Like an operational amplifier which uses many amplifier circuits and voltage divider bridges. Something called as gates (NOT, NAND and NOR) are also build using the twisting the same basic amplifier configuration and adding more switches, etc. This layer also set forward two categories we lovingly call analog and digital electronics.

The next layer uses op-amps and gates as their building blocks. For examples in analog world, we can have a comparator, a voltage follower, an integrator, a differentiator, an oscillator, etc. And in digital world we can have what we call combinational logic circuits like flip-flops of varieties D, F, JK, etc.

Things getting interesting right, however still not that useful.

The next layers use these elements as building blocks. Using comparators, integrators etc., we can now start making something like trivial voltage, current and frequency measurement units, we can have active filters, a small power supply, and so on. In digital world the notion of time is introduced by using time signal (clock signals), which is a giant leap.

Now we can have these systems deployed for forming part of even bigger layers. In analog domain we can implement control system feedbacks and jillions other circuits called integrated chips (ICs). Digital world however these days go on building more layers of complexities. The layer of assembly languages, and then higher-level languages like C++ all of them takes off right from here. It becomes so far-reaching that entire branch starts up from here, the CS.

Using these same blocks microprocessors are built, computers also somewhere follow up as we go on and on. EEs have limits on how far they can go, so we stop here, to give the lead for Comps folks.

Personal computers and smartphones are most popular example of highly complex layer upon layers of analog and digital circuits which tends to response to the applied input signal in quite a predictable way. However, the layers of complexity are so magnificent that it is hard to believe that at the core they are made up of fundamental components no different than that of a small TV remote or a decent bread-baking automatic toaster, it is analogous to seeing humans and amoeba under one umbrella, both made of strikingly similar fundamental biological concepts.

One can literally draw the single line connecting these basic elements layer by layer to all sorts of final-end technologies.

Where does MOSFETs fits in all of this?

To have a more insightful view consider these examples:

MOSFETS are fundamental element used in amplifiers.

MOSFETS are fundamental element used in gates.

Amplifiers are themselves basic building blocks of all analog systems. Gates themselves are building block of digital systems.  

In this piece, we will see how MOSFETS unanimously able to take fundamentals roles in all the above-mentioned systems.

It all began with Mahammad Attala in Bell laboratories trying to overcome the bottlenecks of BJTs. Namely the higher power dissipation due to base current and hence low packing density, making it impossible to build advanced circuit smaller in size.

MOSFET Physical Construction

Now as engineers we have to be careful in understanding device details as a complete understanding would require backing-up with quantum physics explanations and at least 10 years of dedicated focused study. The key is to carefully listen to physicist and simply ask only for the details which are of our interest.

As far as device is considered, as engineers we need to know is answers to hows and whats only, but strictly no whys.


Image Courtesy Wikipedia


MOSFET is a four-terminal semiconductor device, in which the resistance between two of the terminals is determined by the magnitude of the voltage applied at the remaining two terminals. The range of variation in resistance between two interchangeable terminals called source and drain is very large, extending from few milliohms to 100s of megaohms on relatively small voltage changes at the two terminals called gate and the base (or substrate). For simplicity manufactures internally short the source and the base, it thus becomes a three-terminal device and thus a voltage across gate and source changes the resistance between the source and the drain. This is not all to it, the variation of resistance is not simply linear, it is somewhat weirder, involving several twist and drama of semiconductor physics.

The gate terminal is metal plate separated from the body by an intermediate dielectric layer, SiO2.

The source and drain are two oppositely doped regions as compared to the parent base body of MOSFET.

HOW does it work?

At zero source (or base) to gate voltage, the source and drain terminals are essentially open-circuited, as two p-n junctions appears between them in reverse.

For an n-channel type MOSFET:

As we begin increasing the gate voltage (positive wrt source/base), positive charges begin to accumulate on the metal gate. The corresponding electric field is allowed to penetrate through the intermediate dielectric into the p-type base region between the source and the drain terminal. The exact distribution of field is however currently is beyond our strengths to explain. But the effect is quite intuitive that the minority carrier in p-type will start getting accumulating just below the gate. Not knowing the exact physics but at certain magnitude of voltage level, the devices develop a region so full of electrons that it acts as n-type doped region, and so is called n-channel. This particular voltage is called threshold voltage. The appearance of n-channel effectively results as if the source and drain were connected by a resistance. This 3- D channel’s length and width are inherently fixed by device construction however the depth is determined by the voltage magnitude. The depth is proportional to the excess of the gate voltage above the threshold voltage. This channel indeed truly acts as a resistor, if separation is more the resistance is more (r proportional to length), if the width is more resistance is less (r inversely proportional to the area), and similarly the depth dependence.

Current still won’t flow between the source and drain. If we now also begin increasing the drain voltage wrt source, the ammeter needle comes alive. So common sense says if we go on increasing the DS voltage the current will go increasing linearly, as the channel is an epitome of resistance😂😂😂, but not. The channel depth is proportional to the excess voltage Vgs – Vt. As we go on increasing the drain voltage this excess of voltage mainly responsible for the depth of the channel, constant at the gate end but begins to drop at the drain end. At a certain point, the channel shuts off at the drain end. It is obvious to suspect that current should drop to zero, but instead the current saturates to some constant value, and the phenomenon is catalogued in literature as pinching-off, and device is said to gone in saturation mode.

What are the operating characteristics and relevant equations?

We study the MOSFET characteristics for different values of gate voltage. Until the Vgs is less than Vt the drain current remains zero for all Vds, as if open-circuited. For some Vgs greater than the threshold voltage, we plot Ids vs Vds. At much smaller values of Vds the current increases almost linearly, then due to narrowing of channel at drain end due to increasing Vds, the current saturates to a value at the pinch-off point.



Image Courtesy MATLAB

For all:The MOSFETs

The drain-source is open-circuit:The MOSFETsFor all:

The MOSFETsThe source-drain current is given by:The MOSFETsFor small Vds, the square term can be neglected and response is approximately linear:

The MOSFETsFor all Vds ≥ Vgs – Vt, the current saturates at a fixed value, given by substituting Vds = Vgs – Vt:


“What is the distribution of electric field, why at pitching-off it still conducts current, derive the expressions”. All these are extremely interesting questions to take up, but as far as engineering is concerned it won’t help design the circuit any better, so we don’t mind answering them in free time.

The most repeating circuit pattern of our Electrical lives, we can’t trace anything down to something more fundamental than this. Right here we saw for the first time the gate and the amplifier. Let this pattern dissolve in our blood, imprinted in our DNA, memorized in our brains and printed on walls of our heart. Well, that’s how fundamental it is. 😂😂😂


Before directly jumping to equations, let us first build intuition of how this circuit will respond to different applied input, which will allow us to flow through equations smoothly and swiftly.

So, what we need to imagine is the response of the circuit for different applied inputs.

  1. For some applied value of drain voltage Vdd, we begin increasing the gate voltage slowly. As expected, until it reaches the threshold point, drain and source remains open circuited. Current through drain resistor is zero and hence output voltage equals Vdd.
  2. As the threshold potential is reached, the device just develops the so-called n-channel. Notice the current will just begin to flow and DS voltage will thus start dropping. Since the excess voltage is still smaller, and the DS voltage is sufficiently large to drive the MOSFET into the saturation region.
  3. If we still increase the gate voltage then excess gate voltage would be too much for the DS voltage to keep the MOSFET in saturation region. With increasing excess voltage, the channels widen, dropping the resistance, increasing the drain to source current and thus dropping the drain to source voltage, and at one point DS voltage is lower than Vgs – Vt and the MOSFET enters the linear region. (often called triode region)

The MOSFETsNotice we understood the operating characteristics is reverse order. To visualize in terms of how the MOSFET operating point moves on the operating characteristics will give more better idea.


At 2, the device just turns on and large value of Vdd immediately drives the MOSFET into saturation up to 3 where the MOS starts entering the triode region. Large dropping the DS, thus the output voltage to a very small value.


Applying KVL, we have:


  1. For region 1 to 2:






2. For region 2 to 3:


Current saturates at:The MOSFETs

Thus, we have:The MOSFETs

Parabolic drop confirmed.

3. For region 3 to 4:

The MOSFETsCurrent should be given by equation:

The MOSFETsThus, we have:The MOSFETsA rather useless relation. 😀😀😀



We know that any kind of combinational logic can be implemented using three fundamental gates namely NOR, NAND and NOR. How to use this circuit for a NOT operation is quite evident from the transfer curve itself.

For small input voltage range, the output lies in range of some high voltage level, representing digital high logic.

The MOSFETs       The MOSFETs

For a range of high input voltage range, the output drops down to a range of small voltage levels, representing a digital low. So, all we need to do is to set Vdd and strictly define the input and voltage range for low and high logic., and we are done, we have got an inverter (NOT).

The MOSFETs       The MOSFETs

MOSFETS as Amplifiers

We have seen the requirement of a man-made device called amplifier to obtain a crucial signal manipulation, called signal amplification.

Amplifier in most general way could be called a source of energy which can be controlled by some input. Anyways there may be many more ways to look at amplifier, for example the earlier description of a transfer function block. More specifically this fits better into what we can call a dependent source. Before we understand what is amplifier let us understand what is not an amplifier. So, the element to be first excluded is a potential transformer. Though we can have a voltage amplification (step-up) we also have the currents transformation in inverse proportion so that power remains constant, similarly current transformer, a resistor divider, a boost configuration, etc. in which we have no power gain couldn’t be called amplifier. On the other hand, a MOSFET or a BJT appropriately biased, an op-amps, differential amps, instrumentation amps all are collectively called amplifier. Because we have a power gain at the output port wrt to an input port.

With one port as output and one input and third of course power port, theoretically speaking we can have at max 4 combination. Namely, we can have a current or voltage source at output, and we could have voltage or current control at input.


Any device for purpose of amplification invented in past or been invented or to be invented in future will fall in any one category.

The two-port theory becomes of immense utility, to easily describe different amplifiers in different matrix form, like Z-parameter, Y-parameter, h-parameter and g-parameter. We are constrained to not describe the theory in full detail; however, we will be building insight and motivation to study them.

We will use the same trademark configuration to do the amplification too. Isn’t this ground breaking? We had already built fundamental block for digital systems, and now we will again be using the same circuit for amplification which is of course an analog block.

So here it is:


Remember, we didn’t talk about the region between 2 -3 when we studied this circuit acting as an inverter. We strictly worked in 1-2 or 3-4 region only.

The MOSFETsThe transfer functions in 2-3 region as previously computed is:

The MOSFETsThough output voltage is proportional to input voltage, but nowhere close to linear. Remember what we have and compare it with what we wanted:


And here is the greatest revelation as the legends in this field had described for decades.

“The input signal is constrained such that the circuit approximately gives a linear response.”

And the revolutionary constraints are:

  1. Giving a DC level shift, to drive the MOSFET in the saturation region, popularly called biasing voltage, and
  2. if the input signal is small enough the transfer curve is much close to a negative sloped straight line, which is in fact linear amplification.

The MOSFETsIf we zoom enough, here is how the amplification would look like. Notice inversion is there but a good linear amplification is also achieved.


We can also show that using the equation below that for small changes in input voltage indeed cause a linear change in the output voltage.



We have,


So, we now comprehend the design problem of the amplifier as selection and operation at biasing point to get the best possible linear amplification for a given gain requirement.

And that’s a wrap. From here on we go on learning cascading amplifiers as one unit is not always enough to give desirable gain, which leads us to study the effects of stray and coupling capacitance which becomes especially troublesome when dealing with high-frequency signals, which then leads us to something called differential amplifiers, operational amplifiers, and as already describe we eventually take off from here.

All of this would be no so much use unless we also consider the energy consumption. Why it becomes so important can be understood by walking through some numbers.

Consider an inverter gate is build using the exactly as we have described.

For SMD MOSFETs of today’s technology, typically

K is 1 mA/V^2, Vt =1 V, Vdd we take 5 V (TTL Logic), and let low logic at the output is defined between 0-0.2 V

When gate is OFF, high level at input and low level at output:



Power consumed by circuit is:


For order of 10 million of them:


This very rough approximation of power consumption is not at all pleasant to see for 10 million inverters in days when processors are reaching the range of 4-5 Billion of them.

We would require a dedicated diesel-generator set for one 200-gm machine. Of course, we do something about it, that’s why our laptops could be powered by a 60 W Lithium battery. The solution is quite a creative one. They call it CMOS (Complementary MOS).

In order to have incredibly high resistance, when the gate is off and very small resistance when the gate is on, a PMOS is used to replace the resistor. PMOS transistor has exactly the same operation as NMOS, except it is open-circuited for the high level at input and short-circuited at a low level at the input. Also, Vdd has managed to reduce to 3.3 V to reduce power consumption.


We didn’t learn all of the stuffs by sitting down and just glaring at MOSFETs. The entire credit for vivid imagination and connecting the dots goes to numerous books, all the lecture series, few research papers, beloved Wikipedia and all the awesome discussions we had with our friends.

We are thankful to a Lecture Series on Fundamentals of Digital and Analog Electronics, 6.002 MIT OCW by Prof Anant Aggarwal, two 40 lectures series by NPTEL on Analog Electronics by Prof Radhakrishnan, an introductory lecture series on Semiconductor Physics and Devices by Prof D Das IISc B, Basic Electronics Course by Prof Behzad Razavi of Princeton University. This article is result of rigorous brainstorming of ideas, concepts and insights gained from all the above-mentioned sources and then making our own speculations.

Important revisions are yet to be made.

Keep reading, keep learning

Team CEV! 

Harmonic Resonance in Power Systems

Reading Time: 12 minutesOn the occasion of auspicious Diwali, team CEV wonders what could be more relevant and important other than to talk about harmonic resonance!!

Haha, but no kidding!

Since Diwali is a festival of “lights” and in these days harmonics are unanimously voted as the most popular villain in electrical world to turn the “lights” out!

Well if you have been a new reader at CEV, we would like to bring into your notice that our CEV’s Aantarak division have been literally obsessed with power harmonics for a long time now. We had carried out in-depth preliminary literature recon followed by collaborative effort to develop our own harmonic analyzer from scratch. Both can be accessed by following links respectively:

Pollution in Power Systems;

The Harmonic Analyzer: Catching the Spurious

Continuing the same lines, we walked another mile to get ourselves around the harmonic resonance phenomenon, which otherwise has been tagged as seriously spurious.

We really hope to wind up our intuition for harmonics and related phenomenon in this last blog of the series, so we wish to describe it in its full glory. So, you might encounter some repeating themes, apologies for that.

The Crisp

For any domain, having a glance of history really helps in getting a larger picture of the things. Being aware of the historical background greatly aids in understanding the things with continuity and help in extrapolating the ongoings to get some future insights.

So EE folks haven’t begun struggling with harmonics in recent times, infact one can trace it back to early 20th century when power systems were in its earliest phase. Charles Proteus Steinmetz, yes the same engineer who taught the world how to draw the equivalent circuit diagram of induction motor and gave us a handy notation of “j” to simplify our AC calculations had made an excellent introductory paper in harmonics. At that time due to inferior core materials transformers and motors saturated, giving rise to these problems. However, now the problems- harmonics pose remain unchanged but the sources and impact have been magnified manifold.

21st-century power system seems to be literally littered with inky-dinky semiconductor devices which draws currents which are severely offbeat from sinusoidal nature, moreover, the advent of high power electronics has made the situation more vulnerable. Technically these devices/loads are called Non-linear devices/loads, and problem they pose are quite spurious in nature. We know that high-frequency components of these currents called harmonics interact with power system in ways leading to overheating of components, flickering, circuit breaker false trippings, or even causing catastrophic events like a wide-area power outage (aka. Blackouts), as reported by many utilities in recent times across the world.

These harmonics can tune the capacitor banks used for power factor improvement and voltage stability in resonance with the power system components and lead to blowing up of the banks and causing further contingencies, like voltage collapse, etc.

In this blog, a detailed analysis of power factor banks, non-linear loads, resonance phenomenon in RLC, and lastly the resonance in power system due to harmonics is carried out.

One more note, you might be aware of the MATLAB company tagline, it reads “accelerating the pace of science and engineering”, and CEV is really goanna help MATLAB do that here. We will use appropriate MATLAB simulation models to verify the theory and bring home to the readers a sophisticated understanding of the phenomenon.

The Skyrocketing hopes!!!

The flow

Power Factor Capacitor Banks

Thevenin’s Equivalent of Power System

Electrical Resonance in RLCs

Harmonic Resonance with PF Capacitor Banks

Harmonic Resonance, is among the most dreaded phenomenon the power system harmonics are observed to unroll.

ABB, the mega-giant in the power system industry tries to bring on the table the significance of eliminating power harmonics by its product commercial.

Though being regarded as the most suspected reason for unexplained failures of electric utilities the harmonic resonance is a phenomenon that could be explained in a paragraph of no more than 100 words only, you would be able to do it the small kids around you, by the end.

The story begins from the power factor capacitors banks……

You might have appreciated the fact that the use shunt capacitor banks across the electrical motors (lagging loads) can improve the power factor greatly.

The underlying idea is to provide the reactive power locally instead of drawing it from the system thereby reducing the supply current and preventing the elements of the whole power system (from T-lines down to the generators) from overloading.

This concept can be intuitively understood by use of following graphs.

Consider a sinusoidal voltage applied across an inductive load, result is a lagging current.

Harmonic Resonance in Power Systems

So, the convention is to simply connect a capacitor bank of required capacitance. Since the capacitor is in parallel so the voltage across it is in phase with load terminal voltage, and the current through it is obviously 90 degrees leading the voltage across it.

The phasor diagram:

Harmonic Resonance in Power Systems

The waveforms are like:

Harmonic Resonance in Power Systems

Adding the parallel currents to get the supply current:

Harmonic Resonance in Power Systems

So, it could be easily seen that the peak of the resultant current has been reduced, at the same time the power factor angle is also reduced hence power factor improved!!

This same result can be concluded by simply adding the current vectors mathematically.

So, what exactly is happening here?

The picture becomes crystal clearer if we try to simulate an RL load with shunt capacitor and visualize the instantaneous power consumed by each element.

Harmonic Resonance in Power Systems

Harmonic Resonance in Power Systems

By putting appropriate parameter values, it could be seen that when inductor is absorbing power the capacitor is releasing its stored power, and when the inductor is releasing the stored inductive power in its magnetic field, the capacitor is absorbing it in its electric field. It is this inductive and capacitive power, are collectively called reactive power, which just flows in the system but never manifests itself as real power, rather just oscillates. If this power exchange becomes equal then no net reactive power is drawn from the source.

So final result is “significantly reduced net reactive power drawn from the source and so is the supply current”.

Question: Do you think that the capacitor in ceiling fans of households serves the purpose of PF improvement?

Now to analyze the effect of shunt capacitor for non-linear loads, i.e. loads that produce harmonics, we have to follow a different approach, a completely different line of attack.

However, the theory we just saw is equally true, but as far as harmonics are concerned, we are more interested in first understanding the frequency response, rather than power calculation.

Some of the most basic and prevalent techniques used everywhere and all the time in power system analysis are first required to be grasped before we try to understand what happens for non-linear loads.

  1. The concept of Thevenin’s equivalent;
  2. The concept of current injecting vector
  3. The concept of superposition

Thevenin’s Equivalent of Power System

Consider this point of view, the two-terminal is supplying a single-phase non-linear load, also conventionally a power capacitor is applied in parallel to supply reactive power locally. The black box here is an abstraction of all the distribution and transmission transformers, transmission lines and the generators and whatnot, all working in synchronism.

Harmonic Resonance in Power Systems

So, the Thevenin theorem says that the black box can be represented by an equivalent emf source and an equivalent impedance in series, called Thevenin’s voltage and Thevenin’s impedance respectively.

Harmonic Resonance in Power Systems

  • The Thevenin voltage is simply the open circuit terminal voltage.
  • And the Thevenin impedance is the impedance seen by the load given all the voltage and current sources are deactivated.

Once the Vth and Zth are known, to know the impact of connecting a load impedance to already loaded grid we don’t go on solving whole vast electric mesh again. A revolutionary French electrical engineer LC Thevenin in 1880s came up with a revolutionary method to enormously simplify the large electrical circuit.

Find Vth and Zth. Now turn off all the sources, connect the load wherever required, excite the point with the negative Vth, find the drop and add the drops algebraically to already existing system. This is applicable only for linear system by virtue of superposition theorem. This line of attack is chosen when the load impedance is center point (i.e. load impedance is known). This is quite a popular technique and is implied to calculate the impact of loading on different buses of system, fault analysis for a known value of fault impedance, etc.

Now, if impact of a given load current is point of attention (rather than the load impedance) then we use slightly different approach. We turn off the source and inject an equal load current at the point of connection of load, find drops at different nodes and again added algebraically to the existing system.

Now in this case of harmonic resonance study, notice we are utterly concerned with the load current. Our prime moto is to see the impact of a given non-sinusoidal load current on the system.

Here it is important to reflect to one important fact. Our power system is built up of thousands of different kinds of elements, the generators synchronous and asynchronous IMs, the transformers, T-lines, cables, a huge variety of loads, yet all of them can be modelled as a combination of just three fundamental elements, resistance, inductance and capacitance.

Q. How would you modify the Thevenin equivalent if the power systems have power electronic components?

So, it is all those little-tiny things learnt in early engineering classes of circuit theory comes back to manifest in harmonic resonance and other complicated higher phenomenon. Here we realise that solving the RLC circuit is not dull, unless we know how far-reaching are the meaning of those Rs, Ls and Cs in a practical applications.

But all of these theories are strictly applicable to a linear system.

Think for a second how to manipulate the tools for the non-linear currents.

So, lets revisit our aim, our aim is to find the impact of non-sinusoids, that means we are trying to see the response of system subjected to different frequencies. Now this leading us to a completely different space. Did you remember a phenomenon related when we check the response of a system to input of different frequencies?

You guessed it right, the series and parallel RESONANCE!!!!!

Moreover, we are finding the frequency response and by the time we have completed the course in control engineering, frequency response characteristics of any system almost become synonymous to bode plot.

It becomes as good as people screaming to you to “draw frequency characteristics” and you literally hear “draw plot bode-plot”!

And why not, after all, bode plot is a plot of the logarithm of magnitude of steady state output to input for different frequency of sinusoidal input excitations.

Electrical Resonance in RLCs

Resonance in series circuit can be identified as a phenomenon in which for a given magnitude of sinusoidal voltage source, current through the branch reaches maximum at some angular frequency of voltage source.

Harmonic Resonance in Power Systems

Here is bode-plot for the system considering the voltage signals as input and the current in the branch as output:

Harmonic Resonance in Power Systems

Scilab codes: (one can use Matlab too)

s=poly (0, ‘s’);
p =          s/ (8174.52 +2s +0.03s²);
p= syslin (c, ‘p’);
clf ();
bode (p, 1, 5000)

For R=2, C=120uF, L=30 mH

The plot indicates that at a certain frequency of voltage excitation the current through the circuit reaches its maximum value.

Similarly, parallel resonance can be identified as a phenomenon in which for a given magnitude of sinusoidal current source, the voltage across the branch reaches a maximum at some angular frequency of the current source.

Reflecting on these two base-statement rest all of the conditions of resonance can be deduced.

Harmonic Resonance in Power Systems

So here is a bode-plot of parallel RLC circuit taking voltage across the elements as output and total current as input.

Harmonic Resonance in Power Systems

In this case the voltage reaches a peak corresponding to the resonant frequency.

Harmonic Resonance with PF Capacitor Banks

We have built all the necessary parts and now it’s the time to put all the parts together to see the larger picture, and really wind-up our intuition around the harmonic resonance. We started with this not so technical diagram:

Harmonic Resonance in Power Systems

Reflect back and finally, we have:

Harmonic Resonance in Power Systems

It is now quite evident that parallel resonance is seen where parallel elements are excited by a range of angular frequency currents. These parallel elements in a power system are formed by the PF capacitors and the Thevenin’s equivalent at the node. The non-linear load is going to act as a source of different angular frequency current source. So, if the non-linear loads have the harmonic component which has a frequency as the natural frequency of the RLC then a parallel resonance is unavoidable fate.

And this is in-short the hack of harmonic resonance in power systems.

Wouldn’t it be delightful to let a kid know about this?

A Practical Approach

  1. How to obtain the harmonic spectrum of a non-linear load?

Matlab gives you an elegant way forward, use a spectrum analyzer (in a correct configuration)

A sample case of a popular non-linear load, a three-phase rectifier:

Harmonic Resonance in Power Systems

A severely off-beat source current:

Harmonic Resonance in Power Systems

Here is what its harmonic spectrum looks like:

Harmonic Resonance in Power Systems

NOTE: 6-Pulse rectifiers have a current THD of 26% and significant harmonics are 5th (250 Hz), 7th (350 Hz) and 11th.

  1. How to obtain the Thevenin equivalent of a power system?

The answer remains the same the MATLAB provides an elegant way to do it.

Using an impedance measurement block:

Harmonic Resonance in Power Systems

What you get is:

Harmonic Resonance in Power Systems

If you are observant enough, these plots contain all of the data that we are searching to be able to predict a harmonic resonance in capacitor bank across the non-linear load.

Well, we will leave it to you to build and run the models for yourself because we don’t want to steal your pride of finding and fixing things out on your own, so good-luck…………

However, in the end, we will be kind enough to atleast make a conclusion:

The conclusion reached is, when the non-linear load has a current component of frequency close or equal to the natural frequency, the system goes in parallel resonance i.e. system impedance is highest. For a given current value at the highest impedance would clearly result in the highest voltage drop across the capacitor, hence maximum current through it (notice the value of capacitive reactance decrease at higher frequencies).

The capacitor is immediately blown, as a result, the reactive power is drawn from the supply leading to increased current, thereby blowing the main fuse also. And the last sad thing to be noted is that if the capacitor comes out to be a utility capacitor and non-linear load is quite heavy then a blackout in the area is unavoidable destiny.

What is even more surprising is that current harmonics produce parallel resonance that we just saw, however, if there are harmonics presence in voltage waveform then series resonance could also occur in a dramatic way. Causing the collapse of a perfectly healthy bus due to non-linear load at another bus. One can also work-out its details on our own!

We hope we have inspired you enough to get yourself easy with the extremely useful tools in Electrical engineering, the massive MatLab and the sweet Scilab, and hope that CEV team effort boosts you a step towards your holy dream vision for the world!!

Happy Diwali 2020.


Featured Image courtesy

Designing a Buck Converter

Reading Time: 10 minutes

A controlled buck converter finds its application in innumerous platforms. It elegantly executes the mobile fast charging algorithm, MPPT algorithm in some Solar modules, robotics, etc. with optimal desired performance. It is elementary power converter, used as a power source for other electronic equipments like microprocessors, relays, etc.

One can jokingly say it the 1:1 auto-transformer of DC electricity world. 

Buck converters which are also known as step-down choppers, are much ubiquitous hence it becomes very handy to have a design scheme, tested procedures and simulation models to fastly and accurately build a ready to deploy DC Buck converter. We will not describe in great depths the working as the principle of operation can be found in any standard power converter textbook, however, in this blog we wish to present a step by step guide to design a buck by taking into account all important practical considerations.

General Schematics

Designing a Buck Converter

The circuit operation can easily be understood by sketching the waveforms in two states, i.e. when the semiconductor switch is triggered and when it is not triggered.

ON-STATE: Inductor current rises linearly with time as voltage source get directly applied across the inductor and load.

OFF-STATE: Inductor current decreases linearly as the circuit gets short-circuited by the forward-biased diode, which allows for current free-wheeling.

The average voltage applied is a function of time for which the semi-conductor is turned on and turned off, which is indicative of the duty cycle of the pulse generator.


The first thing we require is all the desired ratings and performance of the buck converter. These specifications ultimately determine the device parameters, which will give the desired operation. Consider the sample case in which we are operating a constant power load with a variable input DC voltage source, for example a solar module.


  • Input: 150 V- 400 V
  • Output: 120 V
  • Switching Frequency: 100 kHz (typical for choppers)
  • Load current: 50 A

Performance Parameters:

  • Ripple (P-P) in load current: 10%
  • Ripple (P-P) in load voltage: 5%
  • Max Load Power support: 25%
  • Max Voltage drop during support: 10%
  • Backup duration: 10 ms

Keeping in mind these desired performance parameters the ratings of the various elements will be decided.

Circuit Element Rating Calculations


The value of Inductor determines the ripple in the load current. Having large ripples in load causes poor performance of DC load, like lights will flicker, DC fans will produce pulsating torque and noise, etc.

Designing a Buck Converter

Since varying the duty-cycle will result in different turn-on and turn-off time thus causing varying ripples. All we have to do is to do a trial and error procedure to find the value of L to get ripple below permissible limits under all possible cases:

Test case 1: Vin = 150 V; Vout = 120 V

Designing a Buck Converter

For peak to peak ripple current of 10%:

Designing a Buck Converter

Now inductor equation during on-time is:

Designing a Buck Converter

From circuit:

Designing a Buck Converter

*Assuming load voltage remains almost constant during the entire cycle


Designing a Buck Converter

Now here comes very crucial part. The theoretical value of inductor has been calculated, but the important things is, in the real environment we always need to overrated our circuit elements to accommodate the uncertainty of the real world. If we are designing a commercial product there is a very tight margin for these over-ratings. That’s why all the gadgets are always rated to operate in a specified environments, like temperature, moisture, etc.

It is good practice to keep a safety factor of 25% for operating temperature changes and 20% for derating of inductor coil over time:

Designing a Buck Converter

Extreme Test case 2: Vin = 400 V; Vout = 120 V                                    **Worst case calc

Designing a Buck Converter

For peak to peak ripple current of 10%:

Designing a Buck Converter

Now inductor equation during on time is:

Designing a Buck ConverterFrom circuit:

Designing a Buck Converter

*Assuming load voltage remains almost constant during the entire cycle


Designing a Buck Converter

Again, keeping a safety factor of 25 % for operating temperature changes and 20% for derating over time:

Designing a Buck Converter

Now since worst-case requirement doesn’t meet previous case value thus the inductor value should be updated to at least 252 uH.

We must also verify the ripple current requirement at met for input voltage in between 150 V and 400 V:

Random Test case 3: Vin = 250 V; Vout = 120 V

Designing a Buck Converter

Hence verified!

Now max current through inductor:

Designing a Buck Converter


Designing a Buck Converter

So finally, inductor ratings are:

Designing a Buck Converter

Parameter met:

  • Ripple current is less than 10% for all cases.

Semiconductor Switch

Peak Reverse voltage occurs under off-time:

Designing a Buck Converter

Considering safety factor of 30%:

Designing a Buck Converter

Peak current would be same as inductor current, and taking safety factor of 25% and 30% for spikes due to stray inductance and temperature rise;

Designing a Buck Converter

So, the semiconductor switch ratings are:

Designing a Buck Converter

*RdsON should be as low as possible.

*Now since the reverse peak voltage is less than 600 V so a MOSFET can be employed, however if gating loss has also to be considered than IGBTs would be preferable.



Diode will also be subjected to same voltage and current ratings as that of the MOSFET.

Designing a Buck Converter

*In addition, care must be taken to select a diode will high frequency operating capabilities in order of 100 kHz.


The high-frequency ripple present in the inductor current will be bypassed by the capacitor, as its impedance varies inversely with frequency. However, in an ideal capacitor, there is always some series resistance with leads to ripples in voltage across the C terminal, inturn the load terminal.

  1. Effective Series Resistance (ESR) Ratings:

A ripple of less than 2% is desired in output voltage, so:

Designing a Buck Converter

Since ripple in load voltage is largely caused by the series resistance,

Designing a Buck Converter

Parameter met:

  • Load Ripple voltage of less than 2% is obtained for all cases since 5A is the maximum ripple in the current.

Moreover, this charged capacitor discharges to meet the load current for a small duration when supply is lost or small increase in load. This same principle is applied in many electronic gadgets like PC, laptops, etc to bridge the power loss during switching from mains supply to back-up power.

2. Capacitance value:

For a load change of 25% a corresponding load voltage dip of 10% and a backup time of 10 ms is desired.

10% Dip in voltage:

Designing a Buck Converter

25% change in load is:

Designing a Buck Converter

This power should be supplied by the capacitor and thus will discharge it:

Designing a Buck Converter

Making critical approximations, which we all engineers so good at:

Designing a Buck Converter

Capacitor voltage with 30% safety factor:

Designing a Buck Converter


Designing a Buck Converter

Parameter met:

  • The load voltage drop of less than 10% is obtained for 10 msec for a load increase of 25%.




Designing a Buck Converter

Displays show the result for 400V input, notice 120V output and 50 A load current.


  1. Inductor voltage and current:

Designing a Buck Converter

2. Load voltage and current:

Designing a Buck Converter

3. Capacitor current transient:

Designing a Buck Converter

4. Capacitor steady-state ripple current: ripples bypassing

Designing a Buck Converter

5. Diode Voltage:

Designing a Buck Converter

Controller Design

Now comes the most elegant part of designing a buck converter, modelling a buck to understand and predict the performance in a closed-loop operation.

Like any linear control system, we first need to identify the input and the output. Here we have reduced the buck converter to a simple RLC circuit to check the response of the system for various input of duty cycle:

Designing a Buck Converter

The transfer function model obtained for this open-loop system is as follows:

Designing a Buck Converter


Designing a Buck Converter

Now as per one’s convenience we can either go with root-locus analysis or with the frequency domain analysis.

We know from control theory that by obtaining the bode-plot of an open-loop system we can say a lot about the closed-loop operation of the system. We can comment on the stability, relative stability as well as with little speculations we can also comment on the transient response!!

We might have dived in depths of Control Theory, but we restrict ourself to buck only. Probably, we will find some other fine day to do that.

Obtaining the bode-plot for above open-loop transfer function by running the following code in SCILAB:

s=poly (0, ‘s’);
p =          960/ (2.4 +0.000252s +0.0000063s²);
p= syslin (c, ‘p’);
clf ();
bode (p, 1, 5000)

The bode plot for the uncompensated system:

Designing a Buck Converter

From bode-plot it can be directly concluded that the close loop system will be unstable as the phase cross over frequency is less than the gain cross-over frequency.

By the conventional steps, we need to first use a lag compensator to make gain-cross over frequency less than the phase cross-over frequency.

  • Adding a lag-compensator around the gain crossover frequency of around 2000 Hz.
  • Adding lag compensation at around 2000 Hz is given by:

Designing a Buck Converter

Bode-plot for the lag compensated system:

Designing a Buck Converter

It is evident that now the close-loop system of this open system will be stable but the margin of stability is less.

So, using a lead compensator to provide the required phase margin at the gain cross over frequency, i.e. around 2000 kHz.

TF for required lead compensation should be:

Designing a Buck Converter

A well-compensated and stable system:Designing a Buck Converter

*If desired more lead compensation can be provided according to the design specs.

The final open-loop gain becomes (assuming unity feedback system):

Designing a Buck Converter

Now op-amp can be used to make these lag and lead compensators, and using analog electronics duty ratio generation could also be done. CEV ask for apologies to not do that today.  

The Last Words

Team CEV’s purpose of posting technical blogs is to help out some of the folks who have been completely or partially saddened by the conventional ways of teaching and have been extremely demotivated to keep their interest in these kinds of stuff which is otherwise so rich and interesting. 

We are aware that the system has failed us to boost and strengthen our interest in the subjects. 1/7 th of humanity shall not be devoid of fun and joy of falling in love with the subjects, by no fault of their own.

This is simply not acceptable to CEV.

We are not here to just do casual criticizing about the things rather we understand the severity of the situation and quiet boldly take the ownership to undo the damage, even by a fraction of %.

We believe that people in light of their own personal insights can put out things is much appealing and fascinating way, unlike the usual exam-focused, dull and dead description of things. We intend to rekindle the fire of curiosity and interest and help keep the learning spirits of our generation of student community real-high.


Team CEV.

Featured Image courtesy

The Harmonic Analyzer: Catching the Spurious

Reading Time: 10 minutes

“Do you have the courage to make every single possible mistake, before you get it all-right?”

-Albert Einstein

**Featured image courtesy: Internet

THE PROJECT IN SHORT: What this is about?

The importance of analyzing harmonics has been enough stressed upon in the previous blog, Pollution in Power Systems. 

So, we set out to design a system for real-time monitoring of voltage and current waveforms associated with a typical non-linear load. Our aim was “to obtain the shape of waveforms plus apply some mathematical rigour to get the harmonic spectrum of the waveforms”.   

THE IDEA: How it works?

Clearly, real-time capabilities of any system are analogous to deployment of intelligent microcontrollers to perform the tasks and since this system also demanded some effective visualization setup, so we linked the microcontroller with the desktop (interfacing aided by MATLAB). Together with MATLAB, we established a GUI platform to interact with user to get the required results:

  1. The shape of waveforms and defined parameters readings,
  2. Harmonic spectrum in the frequency domain.  

The voltage and current signal are first appropriately sampled by different resistor configurations, these samples are then conditioned by analog industry’s workhorses, the op-amps, and are fed into the ADC of microcontroller (Arduino UNO) for digital discretization. These digital values are accessed by MatLab to apply mathematical techniques according to commands entered by user at the GUI to finally produce required outcome on screen of PC.

The Harmonic Analyzer: Catching the Spurious

ARDUINO and MATLAB INTERFACING: Boosting the Computation

Arduino UNO is 32K flash memory and 2K SRAM microcontroller which sets limit to the functionality of a larger system to some extent. Interfacing the microcontroller with a PC not only allows increased computational capability but more importantly it serves with an effective visual tool of screen to display the waveforms of the quantities graphically, import data and save for future reference and so on.

TWO WAYS TO WORK: Simulink and the .m

The interfacing can be done via two modes, one is directly building simulation models in Simulink by using blocks from the Arduino library and second is to write scripts (code in .m file) in MatLab by including a specific set of libraries for given Arduino devices (UNO, NANO, etc.).

Only the global variable “arduino” needs to be declared in the program and rest codes are as usual and normal. We have used the second method as it was more suitable for the type of mathematical operation we wanted to perform.


  1. The first method could also be utilised by executing the required mathematical operation using available blocks in the library.
  2. Both of these methods of interfacing require addition of two different libraries.

THE GUI: User friendly

Using Arduino interfaced with PC also gives another advantage of user-interactive analyzer. Sometimes the visual graphics of waveform distortion is important and sometimes the information in frequency domain is of utmost concern. Using a GUI platform provided by MatLab, to give the option to user to select his choice adds greatly to the flexibility of analyzer.  

The GUI platform appears like this upon running the program.

The Harmonic Analyzer: Catching the Spurious

MatLab gives you a very user-friendly environment to build such useful GUI. Type guide in command window select the blank GUI and you are ready to go.

Moreover, you can follow this short 8 minutes tutorial for the introduction, by official MatLab YouTube channel:

REAL-TIME PROGRAM: The Core of the System

Once GUI is designed and saved, a corresponding m-file is automatically generated by the MatLab. This m-file contains the well-structured codes as well as illustrative comments to show how to program further. The GUI is now ready to be impregnated with the pumping heart of the project, the real codes.


The very first task is to start collecting data-points flushing-in from the ADC of the microcontroller and save it in an array for future reproduction in the program. This should be executed upon the user pressing the START button at the GUI.


Since we have shifted our whole signal waveform by 2.5 V so we have to continuously check for 127 level which is actually the zero-crossing point, and then only start collecting data.  


% --- Executes on button press in start.
function start_Callback(hObject, eventdata, handles)
% hObject    handle to start (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
V = zeros(1,201);
time = zeros(1,201);
vstart = 0;
while(vstart == 0)
    value = readVoltage(ard ,'A1');
    if(value > 124 && value < 130)
        vstart = 1;
for n = 1:1:201
    value = readVoltage(ard ,'A1');
    value = value – 127;
    V(n) = value;
    time(n) = (n-1)*0.0001;


The data-points saved in the array now required to be produced and that too in a way which makes sense to the user, i.e. the graphical plotting.



As mentioned previously we aimed to obtain the frequency domain analysis for the waveform of concern. The previous blog was presented with insights of mathematical formulation required to do so.

Algorithm: Refer to blog Pollution in power systems


% --- Executes on button press in frequencydomain.
function frequencydomain_Callback(hObject, eventdata, handles)
% hObject    handle to frequencydomain (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%Ns=no of samples
%a= coeffecient of cosine terms
%b =coefficient of sine terms
%A = coefficient of harmonic terms
%ph=phase angle of harmonic terms wrt fundamental
n=9   %no of harmonics required
for i=1:1:Ns
for i=1:1:n
    for j=1:1:Ns
       M(i,j)=V(j)*cos(2*pi*(j-1)*i/Ns);%matrix M has order of n*(Ns)
for i=1:1:n
    for j=1:1:Ns
        if j==1 || j==Ns
            sum= sum+M(i,j);
        elseif mod((j-1),3)==0
            sum=sum+ 2*M(i,j);
   a(i)= 3/4*sum/Ns;
for i=1:1:n
    for j=1:1:Ns
       N(i,j)=V(j)*sin(2*pi*(j-1)*i/Ns);%matrix M has order of n*(Ns+1)
for i=1:1:n
    for j=1:1:Ns
        if j==1 || j==Ns
            sum= sum+N(i,j);
        elseif mod((j-1),3)==0
            sum=sum+ 2*N(i,j);
    b(i)= 3/4*sum/Ns;
for i=1:1:n
for i=1:1:n
 x = 1:1:n;
 hold on;
 datacursormode on;
 grid on;
 xlabel('nth harmonic');


The section appears quite late in this documentation but ironically this is the first stage of the system. As we have seen in the power module the constraints on signal input to ADC of microcontroller:

  1. Peak to peak signal magnitude should be within 5V.
  2. Voltage Signal must be always positive wrt to the reference.

To meet the first part, we used a step-down transformer and a voltage divider resistance branch of required values to get a peak to peak sinusoidal voltage waveform of 5V.

Now current and voltage waveforms obviously would become negative wrt to reference in AC systems.

Think for a second, how to shift this whole cycle above the x-axis.  

To achieve this second part, we used an op-amp in clamping configuration to obtain a voltage clamping circuit. We selected op-amp due to their several great operational qualities, like accuracy and simplicity.

Voltage clamping using op-amps:

The Harmonic Analyzer: Catching the Spurious

The circuit overall layout:The Harmonic Analyzer: Catching the Spurious

IMP NOTE: While taking signals from a voltage divider always keep in mind that no current is drawn from the point of sampling, as it will disturb the effective resistance branch and hence required voltage division won’t be obtained. Always use an op-amp in voltage follower configuration to take samples from the voltage divider.

Current Waveform****(same as power module setup)

A Power Module


Now it is always preferable to first model and simulate your circuit and confirming the results to check for any potentially fatal loopholes. It helps save time to correct the errors and saves elements from blowing up during testing.

Modelling and simulation become of great importance for larger and relatively complicated systems, like alternators, transmission lines, other power systems, where you simply cannot afford hit and trial methods to rectify issues in systems. Hence, having an upper hand in this skill of modelling and simulating is of great importance in engineering.

For an analog system, like this, MatLab is perfect. (We found Proteus not showing correct results, however, it is best suited for the simulating microcontrollers-based circuits).

The Harmonic Analyzer: Catching the Spurious

Simulation results confirm a 5V peak to peak signal clamped at 2.5 V.

The Harmonic Analyzer: Catching the Spurious

The real circuit under test:

The Harmonic Analyzer: Catching the Spurious

Case of Emergency:

Sometimes we find ourselves in desperate need of some IC and we didn’t get it. At that time our ability to observe might help us get some. In our surroundings, we are littered with IC of all types, and op-amp is one of the most common. Sensors of all types use an op-amp to amplify signals to required values. These IC fixed on the chip can be extracted by de-soldering using solder iron. If that doesn’t seem possible use something that gets you the results. Like in power module project we manage to get three terminals of the one op-amp from IR sensor chip, here we required two op-amps.

First, trace the circuit diagram of the chip by referring the terminals from the datasheet, you can cross-check all connections by using the multimeter in connectivity-check mode. Then use all sorts of techniques too somehow obtain the desired connections.  

The Harmonic Analyzer: Catching the Spurious   The Harmonic Analyzer: Catching the Spurious

Reference Voltages

Many times, in circuits different levels of reference voltages are required like 3.3V, 4.5V etc. here we require 2.5 V.

One can-built reference voltage using:

  1. resistance voltage dividers (with op-amp in voltage follower configuration),
  2. we can directly use an op-amp to give required gain to any source voltage level,
  3. the variable reference voltage can be obtained by the variable voltage supply, we built-in rectifier project using the LM317.      


For program testing, we required different typical waveforms like square and triangle wave. These types of waveforms can be obtained in two different ways: the analog way and the digital way.  

The Analog Way

Op-amps again come for our rescue. Op-amps when accompanied by resistors, capacitors and inductor seemingly provide all sorts of functionalities in analog domain like summing, subtracting, integrating, differentiating, voltage source, current source, level shifting, etc.

Using a Texas Instrument’s handbook on Op-amp, we obtained the circuit for triangle wave generation as below:
The Harmonic Analyzer: Catching the Spurious

The Harmonic Analyzer: Catching the Spurious

The Digital Way

Another interesting way to obtain all sorts of desired waveforms is by harnessing microcontroller. One can vary the voltage levels, frequency and other waveform parameters directly in the code.

Here we utilised two Arduinos, one stand-alone Arduino 1 which is programmed to generate square wave and another Arduino 2 interfaced with Matlab to check the results.

The Harmonic Analyzer: Catching the Spurious          The Harmonic Analyzer: Catching the Spurious

Now already stated the importance of simulation.

So, here for the simulation of Arduino we used “Proteus 8”.

The code is written in Arduino App, compiled and HEX code is burnt in the model in proteus.

The Harmonic Analyzer: Catching the Spurious

The real-circuit:

The Harmonic Analyzer: Catching the Spurious

The results displayed by the Matlab:

The Harmonic Analyzer: Catching the Spurious


To generate different waveforms other than square-type one thing that has to consider is the PWM mode of operation of Digital pins. The 13 digital pins on Arduino generates PWM.

At 100% duty cycle 5 V is generated at the output terminal.

digitalWrite (PIN, HIGH): This code line generates a PWM of 100% DT whose DC value is 5V.

So, by changing the duty cycle of PWM we can obtain any level between 0-5 V.

analogWrite (PIN, Duty_Ratio): this code line generates a PWM of any duty-ratio (0-100%) hence any desired value of voltage level on a digital pin.   

For example:

analogWrite (2, 127): gives an output of 2.5 V at D-pin 2.

Moreover, timer functionalities can be utilized for a triangle wave generation.


It is very saddening for us to not able to finally check our results and terminate the project at 75% completion due to unavoidable instances created by this COVID thing.

THE RESOURCES: How you can do it too?

List of the important resources referred in this project:

  1. MatLab 2020 download:
  2. MatLab official YouTube channel provides great lessons to master MatLab

  1. Matlab and Simulink introduction, free self-paced courses by MatLab:
  2. Simulink simulations demystified for analog circuits:
  3. Proteus introduction:
  4. MatLab with Arduino:
  5. Op-amp cook book: Handbook of Op-amp application, Texas Instruments

THE CONCLUSIONS: Very Important take-away


If we (you and us) desire to take-on venture into the unknown, something never done before and planning to do it all alone, trust our words failure is sure. It gets tough when we get stuck somewhere and it gets tougher only.

We all have to find the people who have the same vision as ours, share some interests and with whom we love work alongside. We all have compulsorily to be a part of a team, otherwise life won’t be easy nor pleasing. There is a great possibility of coming out a winner if we get into it as a team, even if the team fails, we don’t come out frustrated at least.

Each member brings with themselves their own special individual talent to contribute to the common aim. The ability to write codes, the ability to do the math, the ability to simulate, the ability to interpret results, the ability to work on theory and work on intuition, etc. A good teamwork is the recipe to build great things that work.

So, we conclude from the project that teamwork was the most crucial reason for the 75% completion of this venture, and we look forward to make it 100% asap.

Team-members: Vartik Srivastava, Anshuman Jhala, Rahul

Thankyou❤ Ujjwal, Hrishabh, Aman Mishra, Prakash for helping us in resolving software related issues.


Team CEV    

Pollution in Power Systems

Reading Time: 14 minutes


The Non-Sinusoids

What’s the conclusion?


THD and Power Factor

Harmonics Generation: Typical Sources of harmonics


**Featured image courtesy: Internet 


If we were in ideal world then we would have all honest people, no global issues of Corona and climate crisis, also gas particles would have negligible volume (ideal gas equation), etc. and in particular in the power systems we would have only sinusoidal voltage and current waveforms. 😅😅

But in this real beautiful world we have bunch of dear dishonest people; thousands die of epidemics, globe becoming hotter and also gas particles have volume similarly having pure sinusoidal waveforms is a luxury and unconceivable feat to be achieved in any large power system.


We have tried to get launched from very beginning so only a strong will to understand is enough but still we will suggest to once you to go through the power quality blog, it will help develop some important insights.

Electrical Power Quality

Let’s go yoooo!!🤘🤘🤘

Now, why we are talking about shape of waveforms? Well, you will get to know about it by the end on your own, for now let us just tell you that the non-sinusoidal nature of waveform is considered as pollution in electrical power system, effects of which ranges from overheating to whole system ending up in large catastrophes.

Non-sinusoidal waveforms of currents or voltages are polluted waveforms.

But how it can be possible that if voltage implied across some load is sinusoidal but current drawn is non-sinusoidal.

Hint: V= IZ

Yes, it is only possible if the impedance plays some tricks. So, the very first conclusion that can be drawn for the systems that create electrical pollution is that they don’t have constant impedance in one time-period of voltage cycle applied across it, hence they draw non-sinusoidal currents from source. These systems are called non-linear loads or elements. Like this most popular guy:

Pollution in Power Systems

The diode

Note that the inductive and capacitive impedances are frequency variant and remains fixed over a voltage cycle for fixed frequency that’s why resistors, inductor and capacitor are linear loads. In this modern era of 21st century the power system is cursed to be literally littered with these non-linear loads and it is estimated that in next 10-15 years 60% of total load will be non-linear type, well the aftermath of COVID19 has not been considered.

The list of non-linear loads includes almost all the loads you see around you, the gadgets- computers, TVs, music system, LEDs, the battery charging systems, ACs, refrigerators, fluorescent tubes, arc furnaces, etc. Look at the following waveforms of current drawn by some common devices:

Pollution in Power Systems

Typical inverter Air-Conditioner current waveform (235.14 V, 1.871 A)

Source: Research Gate  

Pollution in Power Systems

Typical Fluorescent lamp

Source: Internet

Pollution in Power Systems

Typical 10W LED bulb

Source: Research Gate  

Pollution in Power Systems

Typical battery charging system

Source: Research Gate

Pollution in Power Systems

Typical Refrigerator

Source: Research Gate

Pollution in Power Systems

Typical Arc furnace current waveform

Source: Internet   

Name any modern device (microwave-oven, washing machine, BLDC fans, etc.) and their current waveforms are severely offbeat from desired sine-type, given the no of such devices the electrical pollution becomes a grave issue for any power system. Now the pollution in electrical power system is not a phenomenon of this 21st century rather electrical engineers have struggled to check the non-sinusoidal waveforms throughout 20th century and one can find description of this phenomenon as early as in 1916 in Steinmetz ground-breaking research paper named “Study of Harmonics in three-phase Power System”. However, the source and reasons of power pollution have ever-changing since then. In early days transformers were major polluting devices now 21st gadgets have taken up that role, but the consequences have remained disastrous.

WAIT, WAIT, WAIT…. What’s that “Harmonics”?

Before we even introduce the harmonics let just apply our mathematical rigor in analyzing the typical non-sinusoidal waveforms, we encounter in the power system.


From the blog on Fourier series, we were confronted with one of most fundamental laws of nature:

FOURIER SERIES: Expresssing the alphabets of Mathematics

Any continuous, well-defined periodic function f(x) whose period is (a, a+2c) can be expressed as sum of sine and cos and constant components. We call this great universal truth as the Fourier Expansion, mathematically:

Pollution in Power SystemsWhere,

Pollution in Power Systems

Square-wave, the output of the inverter circuits:

Pollution in Power Systems

Pollution in Power SystemsFor all even n:

Pollution in Power Systems

For all odd n:

    Pollution in Power Systems

Just for some minutes hold in mind the result’s outline:

Pollution in Power Systems



We will draw some very striking conclusions.

Now consider a triangular wave:

Pollution in Power Systems

The function can be described as:Pollution in Power Systems

Calculating Fourier coefficients:

Pollution in Power Systems

Which again simplifies to zero.

Pollution in Power Systems

So, we have-

Pollution in Power Systems

Applying the integration for each interval and putting the limits:Pollution in Power Systems

For even n,


For odd n,




Pollution in Power Systems


For even n:




Are these equations kidding us???

For odd n:

Pollution in Power Systems

So finally, summary of result for the triangle waveform case is as follows:

Pollution in Power Systems

Did you noticed that if these two waveforms were traced in negative side of the time axis than they could be produced by:

Pollution in Power Systems

This property of the waveforms is called the odd symmetry. Since sine wave have this same fundamental property hence only components of sine waves are found in the expansion.

Now consider this waveform:

Pollution in Power Systems

This waveform unlike the previous two cases, if the negative side of waveform had to obtained than it must be:

Pollution in Power Systems

Now this is identified as the even symmetry of waveform, so which components do you expect sine or cos???

The function can be described as:

Pollution in Power SystemsHere again,

Pollution in Power SystemsFor the cos components:Pollution in Power Systems

This equation reduces to:

Pollution in Power Systems

For the sine components:

Pollution in Power Systems

This equation reduces to Zero for all even and odd “n”.

Well we have guessed it already🤠🤠.

Summary of coefficients for a triangle waveform, which follows even symmetry is as follows:Pollution in Power Systems

Very useful conclusions:

  1. a0 = 0: for all the waveform which inscribe equal area with x-axis, under negative and positive cycle. This happens because the constant component is simply the algebraic sum of these two areas.
  2. an =  0: for all the waveform which follows odd symmetry. Cos is an even symmetric functions, it simply can’t be component of a function which is odd symmetric.
  3. bn = 0: for all the waveform which follows even symmetry. by the same logic sine function which is itself odd symmetric, cannot be component of an even symmetry.
  4. The fourth very critical conclusion which can be drawn for the waveforms which follow this is:

Pollution in Power Systems

Where T is time period of waveform.

For then the even ordered harmonics aren’t present, only odd orders. This is property is identified as half-wave symmetry, and are present in most power system signals.

Now, these conclusions are applicable to the numerous current waveforms in the power system. Most of the devices with which we have begun with were seemed to follow the above properties, they all are half-symmetric and either odd or even. These conclusions result in great simplification while formulating the Fourier series for power systems waveforms.

So, consider a typical firing angle Current:

Pollution in Power Systems

So, apply the conclusions drawn for this case. Since the waveform has no half-wave symmetry but is odd symmetric.

Pollution in Power Systems

The Harmonics

Hope you had enjoyed utilizing the greatest mathematical tool and amazed to break the intricate waveforms into fundamental sines or cosines.

“Like matter is made up of fundamental units called atoms, any periodic waveform consists of fundamental sine and cosine components.”

It is these components of any waveform, which we call in electrical engineering language the Harmonics.

Pollution in Power Systems

The Mathematics gives you cheat codes to understand and analyze the harmonics. It just simply opens up the whole picture to very minute details.

So, what we are going to do now, after calculating the components, the harmonics?

So first all we need to quantify how much harmonic content is present in the waveform. The term coined for this purpose is called total harmonic distortion:

THD, total harmonic distortion:

It is a self-explanatory ratio, the ratio of rms of all harmonics to the rms value of fundamental.

Now since harmonics are sine or cos waves only so the RMS is simply:

Pollution in Power Systems

same definition the RMS of fundamental becomes:

Pollution in Power Systems

So, THD is:

Pollution in Power Systems

The next thing we are concerned about is power. So, we need to find the impact of harmonics on power transferred.

Power and the Power Factor

The power and power factor are so intimately related. It becomes impossible to talk about power and not of power factor.

So, the conventional power factor definition for any load (linear and non-linear load) is defined as the ratio of active power to the apparent power. It basically is an indicator of how well the load is able to utilize the current it draws; this statement is consistent with statement that a high pf load draws less current for same real power developed.

Pollution in Power Systems


  1. Active power is: average of instantaneous power over a cycle

Pollution in Power Systems

Pollution in Power Systems

Assuming the sinusoidal current and the voltage have a phase difference of theta, the integration simplifies to:

Pollution in Power Systems

2. Apparent power is by its name simply VI product, since quantities are AC so RMS values.Pollution in Power Systems

The pf becomes cos(theta), only when waveforms are sinusoidal.

NOTE: The assumption must be kept in mind.

So, what happens when the waveforms are contaminated by harmonics:

There are many theories for defining power when harmonics are considered. Advanced once are very accurate and older once are approximate but are equally insightful.

Let the RMS of the fundamental, first second, the nth component of voltage and current waveform be

Pollution in Power Systems

The most accepted theory defines instantaneous power as:

Pollution in Power Systems

Expanding and integrating over a cycle will cancel all the terms of sin and cos product, and would reduce to:

Pollution in Power Systems

Apparent power remains the same mathematically:

Pollution in Power Systems

Including the definition of THDs for voltage and current the equation modifies to:

Pollution in Power Systems

Now this theory uses some important assumptions to simplify the results, which are quite reasonable for particular cases.

  1. Harmonics contribute negligibly small in active power, so neglecting the higher terms:

Pollution in Power Systems

2. For most of devices the terminal voltages don’t suffer very high distortions, even though the current may be severely distorted. More on this in next section but for now:

Pollution in Power Systems


Pollution in Power Systems


The power factor for a non-linear load depends upon two factors, one is cosø and the another is current distortion factor.

If we wish to draw less current, we need to have high overall power factor. Once cosø component is maximized to one, then distorted current sets the upper limit for the true power factor. Following data accessed by virtue of will make it visualize better how much significant the current distortion are.

Pollution in Power Systems                                           Pollution in Power Systems

Notice the awful THD for these devices, clearly, it severely reduces the overall pf.

However, these dinky-pinky household electronics devices are of low power rating so current drawn is not so significant, if they were high powered it would have been a disaster for us.

NOTE: For most of the devices listed above the assumption are solidly valid.

Are you thinking of adding a shunt capacitor across the laptop or the electronic gadgets to improve power factor to get low electric bills, for god sake don’t ever try, your capacitor will be blown in air, later we will understand!!!

These harmonics by a phenomenon of “Harmonic Resonance” with the system and the capacitor banks, amplify horribly. There have been numerous industrial catastrophes that have occurred and still continue to happen because people ignore the Harmonic Resonance.

Our Prof Rakesh Maurya had been involved in solving out one such capacitor bank burn-out issue with Adjustable Speed Drive (ASD) at LnT.

Harmonics Generation: Typical Sources of harmonics

Most of the time in electrical engineering transformers and motors are not visualized as:

Pollution in Power Systems    Pollution in Power Systems

Instead, it is preferred to see transformers and electrical motors like this, respectively:

Pollution in Power Systems   Pollution in Power Systems 

These diagrams are called the equivalent circuits, these models are simply the abstraction developed to let as calculate power flow without considering many unnecessary minute details.

The souls of these models are based on some assumptions which lead us to ignore those minute details, simplify our lives and give results with acceptable error.

Try to recall those assumptions we learned in our classrooms.

The reasons for harmonics generation by these beasts lie in those minute details.


It is only under the assumption of “no saturation” that for a sinusoidal voltage implied across primary gives us sinusoidal voltage at secondary.

Sinusoidal Pri. Voltage >>> Sinusoidal Current >>> Sinusoidal Flux >>> Sinusoidal Induced Sec. EMF 

With the advancement in material science now special core materials are available which saturates rarely, but the older and conventional saturated many times and are observed to generated 3rd harmonics majorly.   

Details right now are beyond our team’s mental capacity to comprehend.

Electrical Motors

From this stand-point of cute equivalent circuit the electrical motors seem so innocent, simple RL load certainly not capable to introduce any harmonics. But as stated this abstraction is a mere approximation to obtain performance characteristics as fast and reliably as possible.

Remember while deriving the air-gap flux density it was assumed that the spatial distribution of MMF due to balanced winding is sinusoidal, but more accurately it was trapezoidal, only fundamental was considered. Due to this and many other imperfections, motor is observed to produce 5th harmonics, largely.

NOTE: Third harmonics and its multiples are completely absent in three-phase IMs. Refer notes.


Disgusting, they don’t need any explanation. 😏😏😏


                Power Loss

Most common, however least impactful effect of power harmonics are increased power loss leading to heating and decreased efficiency of the non-linear (devices that causes) and also later we will learn it affects linear devices too, that are connected to the synchronous grid.

The Skin Effect:

Lenz law states that a conducting loop/coil always oppose the change in magnetic flux linked by it, by inducing an emf which leads to a current.

Consider a rectangular two-wire system representing a transmission line having here a circular cross-section wire carrying a DC current I.

Now one loop is quite obviously visible, the big rectangular one. The opposition to change in magnetic field linked by this loop gives us transmission line inductance.


At frequencies relatively higher than power frequency 50 Hz, another kind of current loops begin to magnify. So, as we said this will cause another type of inductance.

Look closely the magnetic field inside the conducting wire is also changing, as a result, inside the conductor itself loops of currents called eddy current set up, which lead to some dramatic impact.


Consider two cases, a current element dx at r and R distance from the center. Which current element will face greater opposition by the eddy currents due their changing nature??

Pollution in Power Systems Pollution in Power Systems 

Yes, true, the element lying closer from the center, as the loop area available is more for eddy currents, this difference in opposition from the eddy current to different elements cause the current distribution inside the conductor to shift towards the surface as least eddy current opposition would be there.

A technical account for this skin effect in given in this manner:

  1. The flux linked by the current flowing at the center region is more than the elements of current at outer region of cross-section;
  2. Larger flux linkage leads to increased reactance of central area than the periphery;
  3. Hence current chose the path of least impedance, that is surface region.

Eddy current phenomenon is quite prevalent in AC systems. Since the AC systems are bound to have changing magnetic fields thus eddy currents are induced everywhere from conductors to transformer’s core to the motor’s stator, etc.

Now when higher frequency components of harmonics are present in the current, the skin effect becomes quite magnified, most of the current takes up the surface path as if central region is not available which is equivalent to reduced cross-section i.e. increased resistance, hence magnified joule’s heating (isqR). Thus, heating is increased considerably due these layers on layer reasons (one leads to another).

Other grave effects include false tripping, unexplained failures due to the mysterious harmonic resonance.

All of these motivated us to build our own harmonic analyzer, follow up the next blog.

Wonder, Think, Create!!!

Team CEV


Building Code

Reading Time: 5 minutes

What is Building Code?

The Building Code is an instrument providing guidelines for regulating the building construction activities across the country. Building codes are generally intended to be applied by architects, engineers, interior designers, constructors, and regulators but are also used for various purposes by safety inspectors, real estate developers, and others. Codes that regulate the design and construction of structures were adopted into law.


Why Building Code?

A building code (also building control or building regulations) is a set of rules that specify the standards for constructed objects such as buildings and non-building structures. Buildings must conform to the code to obtain planning permission, usually from a local council. The primary purpose of building codes is to protect public health, safety, and general welfare as they relate to the construction and occupancy of buildings and structures. The building code becomes the law of a particular jurisdiction when formally enacted by the appropriate governmental or private authority.


History of Building Code

King Hammurabi enacted the first known written building code in Babylon in 1758 B.C. written in stone. The code doesn’t have a guideline on how to work and what steps to use. Instead, it states that “If a builder has built a house for a man and his work is not strong, and if the house he has built falls in and kills the householder, that builder shall be slain.”

After the great fires in London in 1666 and Chicago in 1871, building codes started addressing the risks one building posed to adjacent buildings and the public. Denser development in cities, and hazards associated with proximity and taller buildings, led to regulations for the construction of common walls between buildings and outlawing dangerous practices like wooden chimneys. Problems in existing buildings led to codes for light and ventilation, fire escapes, toilets and sanitary drains, and stairs and railings.

In 1905, the US organization, the National Board of Fire, created the first National Code to minimize risk.  By 1940, the United States had three regional code organizations, each with its own code. These three organizations and their codes were consolidated into the International Code Council (ICC), and the first set of “I-codes” was published in 2000. These codes include the International Building Code (IBC), the International Residential Code (IRC), the International Energy Conservation Code (IECC), as well as mechanical, plumbing, fire and other codes.


Types & Classification of the current building structure

There are instances when some local jurisdictions choose to develop their own building codes. A long time ago, all major cities in the United States had their own building codes. However, due to the ever-increasing complexity and cost of developing building regulations, virtually all municipalities in the country have chosen to adopt model codes instead. For example, in 2008, New York City abandoned its proprietary 1968 New York City Building Code in favor of a customized version of the International Building Code. The City of Chicago remains the only municipality in America that continues to use a building code the city developed on its own as part of the Municipal Code of Chicago.

In Europe, the Eurocode is a pan-European building code that has superseded the older national building codes. Each country now has National Annexes to localise the contents of the Eurocode.

Similarly, in India, each municipality and urban development authority has its own building code, which is mandatory for all construction within their jurisdiction. All these local building codes are variants of a National Building Code, which serves as model codes providing guidelines for regulating building construction activity.



Under the building code, constructed building or newly built structures can be classified on the following basis-

  • Use and Occupancy
  • Types of Construction

Use and Occupancy

The IBC has ten main occupancy groups as well as multiple subgroups.  The occupancy group or subgroup defines the specific use of the building. Subgroups are numbered based on the perceived risk for the building occupants.  The lower the subgroup number, the higher the perceived threat.

In many cases, a building has space that may be classified under more than one occupancy group.  These multi-use buildings are identified as a Mixed occupancy type.  However, if a building space can be considered as either an Accessory occupancy or an Incidental Use area, it may become part of the leading occupancy group.

Occupancy type determines the vertical live loading requirements for the building structure.  For higher-risk buildings such as a fire station, school, or theatre, lateral loads (e.g. wind and seismic) and snow will require increases to the loading requirements.





Groups A-1, A-2, A-3, A-4, & A-5

Gatherings –  civic/religious/social/recreational


Group B

Office/Professional or Service  Transactions


Group E

K-12 Schools (some Daycare)


Groups F-1 & F-2


High Hazard

Groups H-1, H-2, H-3, H-4, & H-5

Hazardous Materials


Groups I-1, I-2, I-3, & I-4

Assisted Living/Hospitals/Prisons


Group M

Display & Sale of Merchandise


Groups R-1, R-2, R-3, & R-4



Groups S-1 & S-2

Non or Low-Hazardous Storage  (including parking garages)

Utility & Miscellaneous

Group U

Accessory Structures

Construction Type

Construction Type identifies the type of materials utilised for constructing a building and classifies the level of combustibility and fire resistance associated with the building elements of a structure. These building elements are required to have a fire-resistance rating of 0, 1, 2, or 3 hours, which indicates the amount of time it can continue to confine a fire and also maintain a level of structural integrity.

Table 601 of the IBC* identifies the fire-resistance requirements of building elements for the five construction types:

  • Types I and II – All building elements are of non-combustible materials.
  • Type III – Exterior walls are of non-combustible materials or fire-retardant wood framing with a 2-hour fire rating or less and interior building elements are of any code permitted materials, combustible or non-combustible.
  • Type IV – Heavy Timber (HT) construction.  Exterior walls are of non-combustible materials or fire-retardant wood framing with a 2-hour fire rating or less, and interior building elements are of unconcealed solid or laminated wood members that meet minimum dimension requirements required by the code.
  • Type V – Structural elements, exterior walls, and interior walls are of any materials permitted by the code, combustible, or non-combustible.

For construction types I, II, III, and V, structural building elements must also be classified as either A or B, resulting in a total nine kinds (i.e. Types IA, IB. IIA, etc.):

  • A = Protected – Structural members have additional fire rating coating or cover using spray-on, sheetrock, or other approved method that increases the fire-resistance rating by at least 1-hour.
  • B = Unprotected – Structural members have no additional coating or cover.



A Power Module

Reading Time: 17 minutesSpecial Thanks to

  1. Prof Varsha Shah, EE Dept, SVNIT
  2. Mr Anand Aggarwal’s 6.002 MIT OCW Course 

Above is a team of thousands of different power modules, better known as the control room of a power plant.🦾

Are you ready to know one of them???


Control and measurement of system parameters is a crucial facet for reliable and safe operation of any electrical systems, particularly for real-time system. By real-time system we mean the system whose parameters like current, voltage, impedance, power, etc. changes with time, thus to maintain the parameters under threshold limits, we first require to monitor them i.e. take measurements in real-time.

For most of the electrical circuits, the voltages and currents are two parameters of greatest interest, as they are solely responsible for safe operation. When unchecked one leads to electrical breakdown and another a thermal breakdown.

Consider the following cases:

  1. A battery backup system, constant monitoring of battery terminal voltage is necessary to stop the battery from getting over-discharged. Also, current drawn has to be monitored to check that the battery doesn’t overheats and catch flames.
  2. In the power system, bus voltages and currents in line have to be maintained very precisely, which again requires first taking measurements.
  3. For metering of electrical energy consumed by a consumer, we need voltage, current and power factor measurement.
  4. Majority of control systems in industrial system employ a negative feedback technique which essentially requires sampling/monitoring of a particular output parameter, which is itself a form of measurement.


KVL and KCL, 😅😅 rest leave on us!!!


Under this project, we set out to build a dynamic power module for measurement of current and voltage in DC circuits and current, voltage, power factor and frequency in AC systems in real-time to constantly monitor them and trigger necessary safeguards.

It’s pretty obvious that real-time operations are best executed with the help of microcontrollers. Microcontrollers are equipped with a group of pins called ADCs which basically read analog voltage level and convert them to n-bit digital data. Problem is that these microcontrollers can hardly survive above 5 V pressure.

So, if we wish to measure higher AC/DC values then we are required to take proper samples of voltage and current, then do proper conditioning, and finally process the data to compute the parameters.


With first boards appearing in 2005, Italy based is open-source software and hardware company which gives a range of affordable microcontroller. With a broad computational power range, they are easy to use platform for purposeful use in industry, education, art etc.

A Power Module

Atmel based Arduino UNO introduced in year 2010 with 32KB of flash memory is best suited to serve the purpose for this module.

Now we are interested in ADC function, for that Arduino UNO has following specifications:

A Power Module

The meaning of these specifications is:

“UNO contains 6, 10-bit channels for analog to digital conversion. It maps analog input voltage at these pins from 0-5 V into integer values between 0- 1023, yielding a resolution of 5V/1024 or 4.8828 mV/unit. It takes 100 usec to read one input, so max reading speed is 10000 times a second.”

Syntax assigned is analogRead(pinname). It reads pin “pinname” and returns 10-bit int accordingly.

Sample code:

A Power Module



A basic voltage divider with appropriate resistor values can be used to scale down higher voltages V to microcontroller compatible levels, Vs.

A Power Module

A Power Module

Suppose readings are to be made in 0-50 V range. We need to scale down this 0-50 V range to 0-5 V.

A Power Module

Now current has to maintained as minimum as possible, to reduce errors. Let current be 0.5 mA. R1 should be of 100K range (5/0.5m). So,

A Power Module

As already stated, UNO has 10-bit resolution so voltage from 0 to 5V would be mapped into integers value from 0 to 1023, which is 5/1023 =4.88 mV per unit, which is fairly good accuracy.

A Power Module

The digital data from ADC can be easily used to manipulated to get the actual voltage, as follows:

A Power Module


For a range of 500 V:

A Power Module

A Power Module

For current to be 0.5 mA, R1 should be of 1M range (500/0.5m). Thus,

A Power Module

Which is not a standard value so let R2 be 10K.

New scale is:

A Power ModuleA Power Module

A Power Module

Putting the value of Vs:

A Power Module


What we just did was for DC voltage measurement in 0-500V range.


For AC measurement we have to make few modifications. As voltage range is only +ve (0 -5 V) so we need to either shift whole waveform above zero, or flip the negative cycle or simply chop it, and then take readings. Using suitable algorithms, AC values (RMS/ PEAK) could be found.

  1. READING RMS: Since UNO takes 100 usec for every reading. For a typical frequency of 50 Hz, a half-cycle consisting of 10 msec, so UNO can make 10m/100u or 100 readings. For these 100 readings, the formula to compute RMS can be applied as follows.

A Power Module

A Power Module

Sampling a half-sino, Image courtesy: Internet

    1. Using sampling: Max value from the 100 readings from can be found out using some sorting algorithm and RMS can be simply computed from it.
    2. Using time-delay: Since peak occurs at t/4, so using a timer function to generate a time delay of 5 msec after zero crossing and then taking the reading would directly give the peak value.

Any of these three techniques can be used for AC measurement.

IMP: It might possibly be case that the waveform may not be crossing the zero when the ADC starts taking measurement case would result in wrong results or the ADC never captures the maxima case 2a will be faulty , to deal with this is to take a larger number of samples like 2000-3000 to reduce the probability of error occurring.

Sample code for case2a:

A Power Module

The above code can also be used to measure DC voltages.

The final circuit becomes:

A Power Module

Since the sample voltage can be directly fed to microcontroller so no conditioning is required. Let’s see is that the case for current measurement too???


The underlying idea to measure current is to obtain proportional voltage samples for any given load current, read voltage value at ADC port and process the ADC output bit to get the current value.

A proportional voltage can be obtained simply by forcing the current through pure resistor. If the value of this resistor is extremely small compared to the load resistance the equivalent load impedance would hardly change thus load current remain the same and in turn a small but proportional voltage drop is obtained across the external resistance.

A Power Module

Assuming the load current range from 0-2 A. Keeping the external series resistance R, as small as 0.1Ω, the sample voltages will be in range of 0- 0.2 V i.e. (0 -200 mV).

Accuracy would be significantly compromised for small load current if this range of sample voltage is used at ADC.


Here the sampled voltage requires a proper conditioning.

So, all we need to do is to boost up the sample voltage from 0-200 mV to 0-5 V range.

How would you do that???

Well this is a typical day-job in analog engineering. Technically this is called the signal amplification. Giving a signal a required gain to push the level to a higher value.

The Operational Amplifier

Let us just step back from the current project and take a dive to depths which is certainly not required as far as the project is concerned, but for the sake of spirit of learning more and better, in the name of love of subject. 🍹🍹

What are the Operational Amplifiers? 

This class of devices singly forms the backbone of the modern analog industry. Just as the gates in digital electronics, the induction motor in power systems, the IC engine in mechanical systems, the library functions in the computer engineering field, these operational amplifiers are the basal workhorses of the modern analog systems. These little beasts are characterized by a versatile application, which includes amplifier, voltage source, current source, filters, actuator driver, comparator, etc.

The very first need for amplifier circuits typically appeared in long telephone lines to obtain proper signal conditioning at the receiving ends. The problem of the available amplifier in those days were their highly undependable gain due to the inherent nature of the active components used, vacuum tubes in 1930s and transistors after 1947. The gain varied enormously for small changes in working temperature and supply voltage. External condition like season, weather, humidity all of them made the gain of amplifier almost uncontrollable.

Harold Black, an electrical engineer at the bell laboratories in 1927 came up with a revolutionary technique that has now became so ubiquitous in all electronic circuit for control applications, it is called the negative feedback concept.

THE BIG IDEA: Use an amplifier made of undependable active elements to get a very large gain, typically infinite, and then use dependable passive element to provide negative feedback to it to obtain any reduced desired gain or transfer function.

This remarkable concept is the underlining principle of all the practical operational amplifiers used today.

Now to understand op-amp, as known popularly, there are two standpoints. One is this:

A Power ModuleImage courtesy: Internet

And the other is this:

A Power Module

And we have no doubt that you would like to understand it through the second stand point.

Now recall the first part of the basic idea i.e. building infinite gain op-amp, more or less this comes under the domain of pure analog electronics but given the versatility of operational amplifier the second part of basic idea, the design of negative feedback circuit using passive elements (resistors, capacitors, inductors) comes under the realm of the electrical engineering. Also, it largely deals with core electrical circuit theories like KVL, KCL, Thevenin’s, etc.

The first standpoint leads to accomplishment of first part of the basic idea, and the second stand-point leads to the realization of second part of the idea.

Now you would wonder how can we execute second part without knowing the first part, and here comes a great powerful tool to do this for you, it is the hack of all the complicated system around us.


Without a solid-thorough understanding of how that horrendously intricate mesh of transistor and resistances work to produce infinite gain, we can still build a perfect negative feedback circuit to obtain exact desired transfer function (gain), using the abstractions.

This concept is so crucial and pervasive in building all modern perplexing systems the microcontrollers, computers, airplanes, particle accelerators, etc.

Consider this more striking example: the “printf” library function which we take for so granted, is an abstraction of the all the icky logics that goes into it to print a given string on some terminal or a display device. Try building your own function to print a string, you would be shocked at the complexity behind this little command.

The point is that we cannot keep on dwelling on basal stuffs if we wish to build something magnificent, if we do-we will never end up building an app, a website, a power converter, and so forth.

So, use of abstraction is a proven tool to reduce complexity, we can use this tool to derive some common results and build or understand large systems layer by layer.

What you see below is the abstraction of the mesh of transistor shown earlier.

A Power Module

A Power Module


Well, they just simply produce output proportional to the difference in the voltage between the two input terminals. The proportionality constant is very high, order of 10^5, called the system gain, note Ed is in μV and o/p in V.


A Power Module

The output characteristics for the device is as follows:

A Power Module

  • The magnitude of output voltage depends on the difference between in the input terminal voltage in active region and it saturates once output hits the supply voltage magnitude.
  • The polarity of output is same as the polarity of V+ wrt V-, thus V+ is called non-inverting terminal.


  • The variety of op-amps available are many LM324, LM339, LM258, etc. Most popular is IC 741. In our project we will use LM358, as it is single supply dual op-amp, so it will reduce complexity a bit.

A Power Module

A Power Module

      Image courtesy: ON Semiconductors


  1. The difference in input voltage is very small (typically in μV) so the two input terminals can be assumed to be virtually shorted, i.e. at same voltage.
  2. The input impedance is very high, so both the input currents are zero.
  3. The gain is infinity.

This is all one need to know about op-amp, using these three rules op-amps can be used very easily to get required gain.

Let’s check it out.


Inverting configuration:

A Power Module

Just calmly apply the rules one by one.

  1. Input terminals at same voltage, so voltage at 2 is voltage at 1, i.e. zero.
  2. No current through input terminals. Apply KCL at terminal 2:

A Power Module

A Power Module

The characteristics become:

A Power Module

Non-inverting configuration:

A Power Module

Again, apply the same rules:

  1. Input terminals at same voltage, so voltage at 2 is voltage at 1, i.e. V1.
  2. No current through input terminals. Apply KCL at terminal 2:

A Power Module

A Power Module

The output characteristics become:

A Power Module

So, are you now able to appreciate the beauty of these curves we just obtained??? We began with an op amp with typically infinite gain (10^5), showing very creepy dependence on the temperature and external factors and here is a calm stable op-amp with desired finite gain by just using simple passive resistances.

New gain of system become (Rf/Rb) and (1+ Rf/Rb), which remains fairly constant for a wide temp range.


Though equations obtained by reasonable mathematical approximations shows us independence of overall gain, but intuition is still lacking….

So, how does the results we just obtained is manifested actually????

So, lets simply heat an op-amp working in a non-inverting configuration, and see what happens.

As heating begins the gain begins to rise, and so does the output voltage. Corresponding to it there will be rise in voltage at terminal 2. Which would result in lowering the difference between the two input terminals, and consequently the output drops. This drop in output leads to drop in voltage at terminal 2 which results in increased differential voltage resulting in increased output. These oscillations die out soon and result is stable output displaying temperature independent gain. This is in general how a negative feedback principle works.


Ensure that the power is never off when the inputs and output are connected in the op-amp.


So, it’s time to get back from where we left, the need to boost up the sample voltage from 0-200 mV to 0-5 V range.

Pretty cakewalk now, isn’t???

You would say it’s a lockdown. Where should I get the op-amp?

Cool, there are whole lot of gadgets and sensors where you can find it.

Say, for example, we extracted an op-amp from an IR sensor.

A Power Module

Due to unavailability of any solder iron, we just simply cut out the resistors, IR LEDs, POTs.

A Power ModuleUsing careful examination of the IC we traced out the whole IC circuit diagram.

A Power Module

And simply bought out the required terminals of op-amp by normal connectors.

A Power Module

To boost the sample voltage from 0-200 mV to 0-5 V range, we need a gain of (5/200m = 25), since inverting is not desired hence using the non-inverting configuration.

A Power Modulewhere,

A Power ModuleRequired gain is 25.

A Power Module

Let the resistances be: A Power Module

Finally, we used pair of resistors in combination to get the required ohms and made the op-amp circuit with a gain of 24.6 as follows:


What we finally got is a 0-5 V scale that would end up giving us 0-1023 integer, we have to get all the way back to current, lets gooooo!!!!!🚀🚀🚀🚀🚀

Analog Voltage at the ADC:

A Power Module

Voltage input to the non-inverting amplifier:

A Power ModuleCurrent through the external resistance:

A Power ModuleThe overall conversion factor becomes:

A Power ModulePutting our design values:

A Power Module






All about LCD interfacing with the Arduino can be very easily understood by referring this short 1 min read at

We tried the same, followed every step very accurately but unfortunately, results didn’t show up except this blank screen.

A Power Module

Help us to troubleshoot the problem by coming up with possible errors.

We build the icky circuit thrice from zero, and then checked and rechecked every connection, but failed.


  1. Life isn’t fair always, sometimes no matter how hard we try, no matter how dedicated our purpose is, we are destined to fail. We have realised this truth, and we hope to develop temperament to mindfully accept such failures in life.
  2. Connecting the circuit three times hadn’t yielded us the result, but surely planted in us the seed of perseverance to go through that nasty process. Surely, we raised our patience wall a little higher.

And it is these lessons and quality we wish to learn and develop by involving in these projects, not just simply putting things up.


Well do you think it’s done???

No, it’s not.

Since we are using same apparatus for the measurement of AC and DC. We hadn’t done anything to identify them. It can be done via program codes or by hardware.

By providing high or low manually on a digital pin we can indicate the microcontroller about it, say high for AC measurements and low for DC measurements.


#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define DCV_multiplier 0.499
#define DCC_multiplier 1.9531*10^-3
int read_voltage = A3;
int read_current = A4;
int select_pin = 7;
int voltage_adc_value = 0;
int current_adc_value = 0;
int voltage_peak_value = 0;
float dc_voltage= 0;
float ac_voltagerms= 0;
float dc_current = 0;
unsigned long sample_count = 0;
void setup()
  pinMode(A3, INPUT);
  pinMode (A4, INPUT);
  pinMode (7, INPUT);
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("POWER MODULE");
void loop()
  //Voltage Measurement//
  for(sample_count = 0; sample_count < 2000; sample_count ++)
      voltage_adc_value = analogRead(read_voltage);
      if(voltage_peak_value < adc_value)
      voltage_peak_value = adc_value;
      dc_voltage = voltage_peak_value * DCV_MULTIPLIER;
      ac_voltagerms = dc_voltage / 1.414;
  //Current measurement//
      current_adc_value = analogRead(read_current);
      dc_current = current_adc_value * DCC_MULTIPLIER;
  if ( select_pin==0 )
      lcd.setCursor(0, 0);
      lcd.print("DC SYSTEM");
      lcd.setCursor(0, 1);
      lcd.print (" ");
      lcd.print (dc_current);
      lcd.print ("A");
      lcd.print("AC SYSTEM");
      lcd.setCursor(0, 1);

A Power Module


We could arrange a low resistance of required power handling capacity, so current measurements cannot be made. Moreover, the resistors required for the voltage multiplier are also not available with us. So, we used op-amp to get the required gain, slight code modifications and obtained the results using the serial monitor. Battery voltage is 12.25 V power module shows 12.33 V, 0.65% error.

A Power ModuleA Power Module


These power modules can be custom build for battery monitoring for systems like drones, etc. by removing AC measuring components and using small uC like Arduino NANO. They could be used for real-time monitoring of some load. They could be used to trigger some protective measures like triggering a relay, blowing a buzzer, etc. when any parameter beyond a limit.

The development or building of measurement systems is less about dwelling on rigorous electrical concepts rather more appropriately it could be categorized as a form of art, which requires small intuition of some very basic electrical phenomenon and rest is all about creativity to obtain the desired result by arranging the already available elementary elements.

If we could imagine force exerted on a wire carrying current in a magnetic field, if we can imagine emf induced in a changing magnetic field, if we can imagine magnetic field due to a coil carrying current, we are ready to go, about learning, understanding, modifying and building interesting measurement systems.


Keep reading, keep learning




  1. Special thanks to Prof Varsha Shah
  2. MIT OCW 6.002 Circuits and Electronics
  3. Mr Anand Aggarwal’s Fundamental of Analog and Digital Electronics



Reading Time: 13 minutesIntroduction


Understanding the Circuit Elements





Electronic Switch MOSFET


      Physics in one-line

      Circuit Diagram

      Datasheet: Max Ratings



       The Astable Mode

       Calculation of value of external R & C

       Circuit Diagram

       Datasheet: Max ratings

Three winding transformers

       Turn Ratio


       Choke coil


Final Circuits and demonstrations                     



In the previous blog “Inverter Circuits: The Basics”, we have begun with the very raw idea of DC to AC conversion and methodically we developed our basic circuit for obtaining a typical square waveform having power frequency from a constant voltage DC source.

Inverter Circuits: The Basics

The circuit was like:


We have understood the working of the circuit. Now for the purpose of practical implementation, all we require is the triggering circuit for the two MOSFETS at required frequency, proper dimensioning of the elements to check the reliable and safe operation, and also a filtering circuits to couple the load with our inverter circuit.

Let us introduce an exciting new class of electronic instrument…


Multivibrators forms a wide class of electronic circuits and deals with two states (namely high and low) in different possible ways. Generalized diagram of a multivibrator:


They are a total of three kinds:

  1. Monostable Multivibrators: this sub-class is stable only in one of states, say high (1). So, once triggered by some external signal then the circuit enters into its unstable state i.e. low (0) and returns back to its stable state 1 after some pre-fixed time-period. Example of these types of circuits are delay generator, timing circuits, etc.
  2. Bistable Multivibrators: these circuits are stable in both the states (1 & 0), so if multivibrator is in high states and if triggered by some external signal its state changes to 1 and remains 1 until the next trigger. In simple words an external signal just flips the current state of output. Example of these types of circuits is flip-flops.
  3. Astable Multivibrators: they are unstable in both states, thus if you give trigger/supply to them the keep on oscillating between the two states indefinitely. They find extensive use in timers and oscillators.

We are only interested in astable multivibrators, for generating the timing pulse for biasing of the MOSFETS. There is a great range of IC that gives this mode of operation of continuous oscillation on a single trigger, the most popular of all ICs is timer LM555, in 4000 IC series we have CD4047, CD4049, CD4093, etc.

Understanding the Circuit Elements

Understanding the working and principle of a system comes under physics or pure science domain but realizing those systems by considering the real-world parameters and the effects is what engineering is all about. Element dimensioning, suitability, economics and all those things which come into picture when we try to turn a diagram drawn piece of paper into a real system to transform lives, is an engineering task. For example, working of an Induction motor is a physical phenomenon, but to utilize these machines in such large numbers littered beyond the horizon is only made possible by what we call power system engineering. So, there is a line where the physics ends and the engineering begins.


For an electrical system, it is the task of an engineer to take care of the parameter to be maintained under specified limits- voltage level to check dielectric breakdown and current level to check the thermal breakdown. With this background let us start exploring the circuit elements required in for our inverter.


Voltage level, ampere-hour rating, max current rating

Electronic Switch MOSFET

The MOSFET we are going to use is the power MOSFET, modified specially to carry larger current, unlike usual low-power electronic circuits.

The device is identified technically as IRF540, n-channel 100V-0.055 Ohm, 22 A, Low-gate charge Power MOSFET, explained later.


It is a three-terminal device numbered 1, 2 and 3 as given: