%pip install ipympl==0.9.3
Requirement already satisfied: ipympl==0.9.3 in /usr/local/lib/python3.14/site-packages (0.9.3)
Requirement already satisfied: ipython<9 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (8.39.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (2.5.5)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (0.2.0)
Requirement already satisfied: pillow in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (13.0.0)
Requirement already satisfied: traitlets<6 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (5.16.1)
Requirement already satisfied: ipywidgets<9,>=7.6.0 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (8.1.9)
Requirement already satisfied: matplotlib<4,>=3.4.0 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (3.11.2)
Requirement already satisfied: decorator in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (5.3.1)
Requirement already satisfied: jedi>=0.16 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (0.20.1)
Requirement already satisfied: matplotlib-inline in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (0.2.2)
Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (4.9.0)
Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (3.0.53)
Requirement already satisfied: pygments>=2.4.0 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (2.21.0)
Requirement already satisfied: stack_data in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (0.6.3)
Requirement already satisfied: comm>=0.1.3 in /usr/local/lib/python3.14/site-packages (from ipywidgets<9,>=7.6.0->ipympl==0.9.3) (0.2.3)
Requirement already satisfied: widgetsnbextension~=4.0.16 in /usr/local/lib/python3.14/site-packages (from ipywidgets<9,>=7.6.0->ipympl==0.9.3) (4.0.16)
Requirement already satisfied: jupyterlab_widgets~=3.0.17 in /usr/local/lib/python3.14/site-packages (from ipywidgets<9,>=7.6.0->ipympl==0.9.3) (3.0.17)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (1.4.0)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (0.12.1)
Requirement already satisfied: fonttools>=4.28.2 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (4.68.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (1.5.1)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (26.3)
Requirement already satisfied: pyparsing>=3 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (3.3.3)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (4.0.0)
Requirement already satisfied: wcwidth>=0.1.4 in /usr/local/lib/python3.14/site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython<9->ipympl==0.9.3) (0.9.4)
Requirement already satisfied: parso<0.9.0,>=0.8.7 in /usr/local/lib/python3.14/site-packages (from jedi>=0.16->ipython<9->ipympl==0.9.3) (0.8.7)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.14/site-packages (from pexpect>4.3->ipython<9->ipympl==0.9.3) (0.7.0)
Requirement already satisfied: tzdata in /usr/local/lib/python3.14/site-packages (from python-dateutil>=2.7->matplotlib<4,>=3.4.0->ipympl==0.9.3) (2026.6)
Requirement already satisfied: executing>=1.2.0 in /usr/local/lib/python3.14/site-packages (from stack_data->ipython<9->ipympl==0.9.3) (2.3.0)
Requirement already satisfied: asttokens>=2.1.0 in /usr/local/lib/python3.14/site-packages (from stack_data->ipython<9->ipympl==0.9.3) (3.0.2)
Requirement already satisfied: pure-eval in /usr/local/lib/python3.14/site-packages (from stack_data->ipython<9->ipympl==0.9.3) (0.2.4)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

[notice] A new release of pip is available: 26.2.2 -> 26.3
[notice] To update, run: pip install --upgrade pip
Note: you may need to restart the kernel to use updated packages.
import matplotlib
if not hasattr(matplotlib.RcParams, "_get"):
    matplotlib.RcParams._get = dict.get

5. Diodes#

5.1. Physics#

5.1.1. Semiconductor#

Up till now, we have seen materials which were either a conductor or an insulator for electrical current. There is another class of materials which we call the “semi-conductors”, these are between the conductors and the insulators. They consist of a crystalline material in which impurities have been brought in (“doping”).

Silicon is widely used for this, but there are other suitable materials. Silicon for semiconductors is made from purified sand through a multistep refining process involving purification, chemical reduction, and melting at high temperature. From the resulting molten silicon, a crystalline rod of silicon is made (Fig. 5.1). This rod is cut into thin discs which are the basis for the chip industry.

../_images/Silicon_single_crystal.jpg

Fig. 5.1 Single crystal of silicon grown by the Czochralski process used to make Integrated Circuits.
Created by Massimiliano Lincetto, under CC BY-SA 4.0, original link
#

The crystalline material itself is an insulator, as there are no free charge carriers in the material. In a process called doping, impurities are brought in the material (implantation). Materials used for this process are e.g. Phosphorus, Arsene, Boron, Gallium. These impurities will disturb the crystalline structure of the silicon and create spots in the crystal lattice with either a negative or positive charge.

The negative charge is due to extra (excess) electrons in the (disturbed) crystal lattice, this material is called N-type material. The impurity in the silicon is the donor of the electrons. Material with a positive charge is doped with an acceptor, creating “holes” with a positive charge, where an electron can be “absorbed”, this is called P-type material. This is illustrated in Fig. 5.2. To be clear: The electrons are mobile, a hole itself is not mobile, it is an “empty spot” in the crystal lattice which can absorb and/or release an electron.

../_images/Silicon_doping_-_Type_P_and_N.svg

Fig. 5.2 Pure silicon crystal lattice, P-type doped silicon structure and N-type doped silicon structure.
Created by VectorVoyager, under CC BY-SA4.0, original link
#

P-type or N-type semiconductor material can be used as such, for example for sensors. Interesting applications arise when the P-type and N-type materials are combined to one device. Something which is done in Integrated Circuits (ICs), better known as (electronic) chips. By the way, the reason they are called chips is because the ICs are made, by the hundreds, on big disks of silicon which are later on diced to individual circuits, a chip! Wafers, ready for dicing are shown in Fig. 5.3.

../_images/Wafer_2_Zoll_bis_8_Zoll_2.jpg

Fig. 5.3 Processed silicon wafers, containing Integrated Circuits.
Created by Stahlkocher, under CC BY-SA 3.0, original link
#

5.1.2. PN junction#

The most basic form of a semiconductor device is called a diode, where a piece of N-type material and P-type material are joined together, a PN-junction. The name diode originates from the Greek “di” (two) and “ode” (path). The resulting component is a two-terminal component, which (spoiler alert!) only conducts electric current in one direction.

Let’s have a look at what happens when we join a rectangular piece of N-type material and a rectangular piece of P-type material (Fig. 5.4). At the junction of the two materials, there will be a transfer of charge. The free electrons will move to the empty, positively charged positions, the holes. When these two charges combine, the net result is zero. The recombination of electrons and the holes will create a neutral charged area, and the excess electrons leave a non-charged area behind, creating a non-charged zone which is known as the depletion zone. Thus the two materials, N and P-type, which could conduct electricity, have now created an insulated zone where the materials meet.

../_images/p-n-junction.svg

Fig. 5.4 P-type and N-type material combined, resulting in a depletion region around the PN-junction.#

We did join the materials to create an electronic component. Thus the N-type and P-type material will be part of an electronic circuit in which electrons will (hopefully) flow. Now when there will be extra electrons supplied to the N-type material, they will flow towards the depletion zone, and create negatively charged spots in the neutral area. At the same time, electrons will be subtracted from the P-type material, these electrons will leave a positively charged hole behind. In the end the depletion zone will be reduced to zero, and the electrons can flow through the diode, the diode is conducting! This is illustrated in Fig. 5.5.

../_images/pn-junction-bias.svg

Fig. 5.5 PN-junction connected to an external voltage source. Showing the conduction of current on the left and the blocking of current on the right.#

What happens when we reverse the connections on the diode (PN-junction)? Electrons will be supplied to the P-type material. They will enter the material and recombine with the positively charged holes. In a similar way, electrons will be extracted from the N-material, there will be less free charge carriers (electrons) in the N-material. The depletion zone will broaden and no electrons will pass through the diode. In conclusion, this device will conduct current in one direction and block current in the other direction.

5.1.3. Non-ideal diode#

In practice, this is not entirely accurate. In practice it is possible that some charge carriers will still pass the neutral area (depletion zone). These charge carriers will create a tiny leakage current. This current depends on the type of device. For a normal diode this current could be as small as a few pico-Amperes (pA), but depending on the type of diode this could be higher (micro-Amperes, \(\mu A\)). As this current depends on the mobility of charge carriers one can understand that this current is temperature dependent as well. The higher the temperature, the more mobile the electrons will be, thus the larger the leakage current.

But there are other mechanisms which can create extra electrons for the leakage current. The PN-junction is often very well shielded against light. Light is an electro-magnetic wave, but also consists of photons, with a certain energy content. When light hits the PN-junction (depletion zone) the energy can be absorbed by the PN-junction and will be converted into a charge carrier. As these charge carriers will then flow to the conductive areas of the diode, the result will be an extra current flowing through the diode. This principle is used in sensors, for example photo-sensitive diodes. The same effect is used for converting optic energy (light) into electricity, like in solar cells.

In this respect we should regard light as electro-magnetic waves in its broadest sense. Thus nuclear radiation will have a similar effect on PN-junctions. Therefore it is possible to construct a radio-activity detector (“Geiger counter”) with diodes as well. Later on in this chapter we will elaborate more on the use of PN-junctions for sensors.

When special care is taken to select the proper materials, it is possible to generate EM-waves (light, IR, UV and visible) from diodes as well. As the (quantum-)physics are quite complex for this, we will not elaborate on this, but LEDs (Light Emitting Diodes) are diodes as well.

5.2. The diode in electronics#

In the first part of this chapter we discussed the diode from the physical point of view. Now it is time to have a closer look on how the diode behaves in an electronics circuit. Let’s first have a look at the schematic symbol, shown in Fig. 5.6.

../_images/Diode-Symbol.svg

Fig. 5.6 Diode-symbol, indicating the Anode and the Cathode.#

5.2.1. Anode and Cathode#

The schematic symbol of a diode is arrow-shaped. This indicates in which direction the electric current can pass. It is important here to remember that the electric current is opposite to the direction in which the electrons flow. This contradiction comes from the fact that people learned about electric current, before acquiring more knowledge about electrons. They first assumed that current consisted of positive “particles” flowing, later they found out that these “particles” were negatively charged. At that time the wrong direction of current was well established and could not easily be changed.

The two connections of a diode are identified as the Anode and a Cathode. Both originate from Greek:

  • the anode originates from “Ana”, which means “up”, and “hodos” which means “way”, so the “way up”. It can be reasoned that it is the positive electrode at which the electric current enters the device (electrons leave the device).

  • the cathode originates from “kata” which means “down” and “hodos”, thus the “way down”. For this it can be said that it is the point where electric current leaves the device (electrons enter the device).

The current will thus flow from the Anode to the Cathode. The stripe in the symbol can very be often be found on the physical package of a real diode, indicating the cathode.

5.2.2. Practical model#

Based on the description given earlier an electrical characteristic of the diode can be derived. This is the ideal diode characteristic as shown below.

../_images/ideal-diode-characteristic.svg

Fig. 5.7 Diode I-U characteristics, left for the ideal diode, in the middle a simplified model on the right a more practical model.#

In Fig. 5.7a, on the horizontal axis, we see the voltage over the diode, defined as the potential between the anode and the cathode. When it has a positive value, the diode will pass the current. When the potential is negative the current will be blocked. When the diode is conducting it is called forward biased, when it is not conducting it is called reverse biased.

In Fig. 5.7b, in practice, there is a certain potential (thus energy) necessary for the electrons, to overcome the depletion region of the PN-junction. Which means that the diode does not start to conduct directly when the anode-cathode potential is slightly positive. There is a threshold-voltage which has to be overcome before the diode gets forward biased. This can be seen in the second characteristic. A typical value for this threshold voltage is \(0.6 \sim 0.7 V\). Note that this voltage depends on the type of diode, the materials used and even shows some temperature dependency.

The behavior as described above can be regarded as if the device has only two modes. Not-conducting current and, when the potential is above the threshold, it is fully conducting. Unfortunately the behavior of a diode is not so binary, it has a more smooth way of transitioning between blocking and conducting current. This can be modeled in a “linear” approach as shown in Fig. 5.7c.

The real curve of a diode follows a curve which can be described with the following formula:

\[ I = I_0 \left( e^{\frac{qU}{nkT}} - 1 \right) \]

Where:

  • \(I\) = the current flowing through the diode

  • \(I_0\) = the diode leakage current density in the absence of light

  • \(U\) = voltage across the terminals of the diode

  • \(q\) = absolute value of electron charge

  • \(k\) = Boltzmann’s constant

  • \(T\) = absolute temperature (\(K\))

  • \(n\) = ideality factor, n=1 for ideal diode, 1<n<2 for most silicon diodes

The current \(I_0\) depends on the construction of the diode. Furthermore, the value of \(I_0\) increases when the temperature increases due to the higher mobility of the electrons.

The real curve of a diode will look like more smooth, as shown in Fig. 5.8.

../_images/voltage_diode.svg

Fig. 5.8 Voltage-current characteristic of a real diode.#

In this curve we can also see that the reverse voltage of the diode is limited. At a certain voltage, which can be as high as \(1000 V\), the depletion region (say the isolation) will break through and the diode starts to conduct. When this happens, the electric field might cause a cascase of accelerating charge carriers which create even more carriers. This process is called avalanche breakdown, causing a sudden high current, resulting in exceeding the maximum dissipation or temperature which means the end of the diode.

In the above formula we can define the thermal voltage as \(\frac{kT}{q} = 25.85 mV\), the “thermal voltage”, at \(300 K\).

Given this thermal voltage we can calculate the voltage over a diode at a given current as well.

\[ U_D(I) = \ln\left(\frac{I}{I_S} + 1\right)\eta U_T\]

The voltage \(U_T\) is the thermal voltage (\(\sim 25mV\)). The factor \(\eta\) in the equation depends on the construction of the diode as well. The value of \(\eta\) is between 1 and 2. \(I_s\) is the tiny, pA or nA, reverse saturation current.

Have a closer look at the diode curve. When the diode is conducting we can see that the line shows some resemblance with a resistor characteristic, be it with an offset. The slope of this curve can be modeled as a small signal resistance (\(r_d\)). With that resistance the model of a diode which is conducting will look like a series circuit of a voltage source, and ideal diode and a resistor.

../_images/electrical_models.svg

Fig. 5.9 Electrical models of the diode.#

How to use these different models? Which model to use depends a lot on the circuit and the way you are analyzing the circuit. Sometimes it is sufficient to know if the diode will conduct or not, in that case the “ideal diode” model is okay to use. However, very often the voltage drop over the diode has a significant impact on the voltages in the circuit. In that case the “piecewise linear” model (diode + threshold voltage source) can best be used. The models with the added series resistance are absolutely useful, but once you need those models, you’re heading towards becoming a real Electrical Engineer. So, let’s conclude that chances are pretty small that you need that model, and you’ll most likely stick to Fig. 5.9

5.2.3. Special Diodes#

The general principle of diodes has been described now, however, there are a large number of special diodes, each optimized for specific applications. A few special diodes, which are broadly used will be discussed here:

  • the Zener-diode

  • the Light Emitting Diode (LED)

  • the photodiode

  • the photovoltaic diode (solar-cell)

5.2.3.1. The Zener-Diode#

The normal diode has a forward threshold voltage of \(0.6 \sim 0.7V\) and a reverse breakdown voltage tens of volts till thousand volts. The Zener-diode has a similar forward threshold voltage of \(0.6 \sim 0.7V\) and a very well defined (accurate) reverse breakdown voltage. This breakdown voltage ranges is defined during manufacturing and ranges from about \(1.0V\) to approximately \(33.0V\).

Breakdown voltage below approximately 5 V are mainly caused by the Zener effect. For higher voltages, avalanche breakdown becomes the dominant mechanism. Both effects may occur simultaneously and have opposite temperature dependence, and in practice the term Zener diode is used regardless of the main breakdown mechanism.

This type of diode is generally used in reverse bias, such that the voltage drop over the diode equals the accurately defined Zener-voltage. The characteristic of a Zener-diode is shown in Fig. 5.10.

../_images/diode-diode.svg

Fig. 5.10 Zener-diode characteristic.#

Something important to consider with Zener-diodes is the maximum current and the maximum power-dissipation. When the Zener-diode breaks down the current an increase rapidly, thus provisions should be made to limit the current. Usually this is done by means of a resistor (more details will follow in the “diode circuits” section). When the maximum current is exceeded the diode is usually damaged (becomes a short circuit).

Similar, when the reverse current flows, there is a “considerable” voltage drop over the Zener-diode as well. This means, there is energy converted to heat (dissipated) in the diode. The amount of energy can be calculated by multiplying the voltage over the diode, times the current through the diode.

\[ P_{Zener} = U_{Zener} \cdot I_{Zener} \]

The maximum power-dissipation is mentioned in the data-sheet for a certain type of Zener diode. Exceeding this power-dissipation will cause the diode to become to hot and the heat will damage the diode.

By the way, all diodes will dissipate energy when forward biased. However, the forward voltage drop is usually small, still, the power dissipation will be equal to the threshold voltage times the current.

5.2.3.2. The Light Emitting Diode – LED#

One of the most well known diodes is the Light Emitting Diode, abbreviated to LED. LEDs are now widely used for lighting and signaling applications.

The PN-junction in an LED is constructed in such a way that light will be emitted when the diode is conducting, light emission is based on the electroluminescence effect. The wavelength of the light is determined by the bandgap of the PN-junction, which might be slightly influenced by adapting the doping; this implies that an LED will only emit one wavelength (with a bandwidth of 10-20 nm). While this is generally true, the optical spectrum is not very narrow, a spectrum or band centered around a specific wavelength is emitted. The only exception are LASER-diodes, which emit a narrow band. The light emitted by an LED can be in the UV-range, visible range or IR-range.

../_images/led_diagram.png

Fig. 5.11 Drawing of an LED, showing how the Anode and the Cathode can be identified, based on the characteristic internal structure.
Created by Inductiveload, in public domain, original link
#

Due to the different materials used in the LED PN-junction the electrical properties are slightly different compared to normal diodes. The forward-voltage drop is considerable higher, compared to the standard \(0.7V\). The exact number depends on the color, but is very often in the \(1.6 \sim 2.5 V\) range. Furthermore, the maximum reverse voltage is limited to approximately 5 Volts (compare this to the tens or hundreds of Volts for normal diodes).

../_images/led_voltage.svg

Fig. 5.12 Current to voltage curve of LEDs, given for different colors.#

5.2.3.3. Photovoltaic-Cell#

Another special type of diode, specially made for energy-conversion, is the Photovoltaic-cell. This PV-cell is more known under the name “solar-cell”. These cells are based on PN-junctions as well.

Solar-cells will convert the radiation of the sun, mostly visible light and IR in electrical energy. The radiation will free electrons in the PN-junction, which in turn can power an external load. Getting most of the power from a solar-cell involves some electronics, which are outside the scope of this book.

../_images/solar-cell.svg

Fig. 5.13 The construction of a solar cell, showing the polarity of the photovoltaic voltage#

How will the electric current flow in PV-cell circuit? Here we see something interesting, as the diode will be the source in the circuit. Have a look at the circuits in Fig. 5.14.

../_images/current-flow.svg

Fig. 5.14 Current flow (not electron-flow!) through a normal diode and a solar cell.#

In Fig. 5.14 we see the electric current through a normal diode. On the right we see the current flow when the diode is a PV-cell. What we see is that the current flow is actually the wrong way around through the diode?! However, let’s think about it for a second:

The light which hits the PN-junction will create free electrons in the N-type and holes in the P-type. The energy from the light will start to flood both regions, so there are a lot of charge carriers available. Both will recombine in the depletion region, thus there is no current flow through the diode itself this is what happens normally, however, now we have an affluence of charge carriers., these have to go somewhere! The only way the electrons can flow, is away from the diodes N-region, through the load to the P-region, so they can recombine with the holes there. So the external electron-current which starts to flow will go from the cathode to the anode. Now remember that the electric current is defined opposite to the electron flow. Then the picture on the right, in Fig. 5.14 makes sense.

5.2.3.4. The Photo-Diode#

Diodes are used for electronic circuits, and they can be used for sensing applications. The PN-junction proves to be sensitive to electro-magnetic energy which hits the PN-junction as well. You can think of light (covering a large spectrum) and ionizing radiation.

To be clear, in principle every diode is sensitive to EM-radiation, but photodiodes are optimized for this application. This is done by creating a large sensitive area, which is exposed to the environment. In Fig. 5.15 you can see some examples of photodiodes. The exposed sensitive areas (bluish) are clearly visible.

../_images/Fotodio.jpg

Fig. 5.15 Examples of photodiodes. The bluish area is the photo-sensitive area.
Created by Ulfbastel, under CC BY-SA 3.0, original link
#

Photodiodes can be used in two different ways. It can be used as a voltage source (PV-cell) or as a light dependent current source.

When it is used as a voltage source the behavior of the photo-diode is highly non-linear. Advantage, the voltage will rise quickly with very little light, so it is very sensitive. The disadvantage, it is not usable as an accurate photo-detector, which is very often needed for accurate light-intensity measurements (think about photo-luminescence detectors, LUX-meters etc.)

When the diode is used with zero-bias (no voltage drop over the diode) or in reverse bias, the current (blocking current!) is highly linear with the light intensity.

How is it possible that the diode conducts when reverse biased? The principle is similar to the PV-cell, the light which illuminates the photo-diode will create charge carriers. When we do not bias the diode in reverse, it starts to behave as a voltage source (PV-cell). However, when we actively reverse bias the diode, the only way the electrons can start to flow is through the depletion zone. This current is in the same direction as the leakage current, named blocking-current as well.

../_images/photodiodes.svg

Fig. 5.16 Photodiode characteristics.#

In Fig. 5.16 we see the photodiode characteristics. The three lines show the different light levels. The line closest to the horizontal axis is the lowest light-intensity. When the light intensity increases, more charge carriers are generated in the diode, hence the current increases, but in the blocking direction. The lines look equally spaced in the blue area of the graph, indicating the linear behavior with respect to the light-intensity. When we follow the lines of light intensity to the right, to the PV-region, we see that at a certain moment all lines will (almost) come together, making it very hard to distinguish the various intensity levels, hence the non-linear behavior, but the high sensitivity.

When the reverse voltage is too high, the diode will break-down just like normal diodes and/or Zener-diodes.

5.3. Diode Circuits#

Diodes are very versatile components and find their application in a wide variety of circuits. In order to understand these circuits the first step is usually to determine if a diode is conducting or blocking current. For these two questions need to be answered:

  • is at a certain moment in time the potential (voltage) on the Anode higher then the voltage on the Cathode?

  • is the potential difference above the threshold voltage (so higher then \(0.6 \sim 0.7V\))?

If both questions can be answered with “Yes” the diode is conducting and can be “replaced” with a voltage source of \(0.6 \sim 0.7V\). (Or with a short-circuit when the diode is considered to be ideal).

When the situation in the circuit is changing (voltages are changing) and one of the two, or both, questions cannot be answered with “Yes”, the diode stops conducting, and the circuit will be open (no connection) at the position of the diode.

5.3.1. Half Wave Rectifier#

One of the most basic circuits is the “half wave rectifier”, it consists of an AC-source, a diode and a resistor to limit the current. The diagram of this circuit is shown in Fig. 5.17.

../_images/half_wave_rectifier.svg

Fig. 5.17 Half wave rectifier. The “-” of the AC-power source is often referenced to ground.#

Assume the “-” connection of the AC source is at ground-potential. The AC waveform is a sinewave. At \(t = 0s\) the sinewave will be at \(0\) Volt and start to increase. At that moment the potential at the Anode will increase, while the potential at the cathode remains at \(0\) Volt. Remember, when the anode voltage is below 0.6-0.7 V, there is no current flow; no current through the resistor means a voltage drop of \(0\) Volt.

After some time, the voltage at the Anode reaches the threshold voltage of the diode (\(0.6 \sim 0.7V\)). From this moment on the diode starts to conduct, and the voltage on the Cathode, will follow the voltage on the Anode minus the threshold voltage. For example for an anode at 1 V and a cathode at 0.3 V.

This will be the situation, till the voltage on the Anode drops below the threshold voltage.

The source will lower its output to zero volts, then it starts on the negative period of the sinewave. During this whole period, the voltage on the Anode will be lower then the \(0\) Volt potential of the Cathode. This means the diode will block during the whole negative part of the sinewave.

When the new cycle starts, the whole process/cycle will be repeated.

The result of this, is that only the positive parts of the sinewave will be allowed to pass to the (load-)resistor. This is more or less (remember the loss due to the threshold voltage) half the period. Hence the name, half wave rectifier.

The AC-voltage and the resulting voltage over the (load-)resistor are shown in Fig. 5.18.

Please note, that the voltage over the load is only positive. It is not continuous, but the average voltage is positive, therefore it is said that the voltage is rectified.

Nothing

Hide code cell source

import numpy as np
import matplotlib.pyplot as plt

# ====== Parameters ======
f = 50               # Signal frequency (Hz)
w = 2*np.pi*f
Upeak = 5            # Input peak voltage
Ud = 0.7             # Diode forward voltage drop
T = 1/f

t_max = 2/f

t = np.linspace(0, t_max, 2000)   # show two periods

Uin = Upeak * np.sin(w*t)       # input sinusoid
Uout = np.maximum(Uin - Ud, 0)  # half-wave rectified output


# ====== Plot ======
fig, ax = plt.subplots(figsize=(10, 4), dpi=150)

# Input waveform
ax.plot(t, Uin, color="blue", linewidth=2, label=r"$U_{in}$")

# Output (load) waveform
ax.plot(t, Uout, color="green", linewidth=2, label=r"$U_L$")

t_peak = T/4
y_top  = Upeak
y_bot  = max(Upeak - Ud, 0)

xM = t_peak + 0.1*T   # shift right of the peak (adjust as needed)

# Horizontal top line
ax.plot([xM - 0.075*T, xM + 0.025*T], [y_top, y_top], color="black", linewidth=1)

# Horizontal bottom line
ax.plot([xM - 0.075*T, xM + 0.025*T], [y_bot, y_bot], color="black", linewidth=1)

# Vertical arrow for the spacing
ax.annotate("", xy=(xM, y_top + 0.15), xytext=(xM, y_bot - 0.15), arrowprops=dict(arrowstyle="<->", lw=1.5, color="black"))

ax.text(xM + 0.03*T, 0.5*(y_top + y_bot), "0.7 volts", va="center", ha="left", fontsize=12)

# Axes config
ax.axhline(0, color="black", linewidth=1)
ax.text(t_max + 0.0002, 0, "t", va="center", ha="left", fontsize=12)
ax.set_xlabel("")
ax.set_ylabel("")
ax.set_xlim(0, 2/f)

ax.set_xticks([])
ax.set_yticks([])

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['bottom'].set_visible(False)

ax.legend(frameon=False)
plt.tight_layout()
plt.show()
../_images/039a55aa93b6194201aa5f80325386d04d4e7da15ed7c15a710270d15816572e.png

Fig. 5.18 The AC-voltage and the rectified voltage over the resistor.#

5.3.2. Peak-detector or Half-wave Rectifier with Buffer Capacitor#

As seen with the half-wave rectifier, the resulting voltage is a pulsed voltage. This voltage is not very suitable for powering circuits, as these usually require a more constant voltage. For this purpose a capacitor can be added to the circuit, which will “smooth” the resulting voltage.

Have a look at the circuit-diagram in Fig. 5.19, the capacitor is placed in parallel with the (load-)resistor.

../_images/half-wave-rectifier_plus_cap.svg

Fig. 5.19 Half-wave rectifier with buffer-capacitor.#

Let’s have a look on how this circuit is functioning. We assume the voltage over the capacitor is \(0V\) (capacitor is discharged) and the AC source starts its first period of the sinewave. Again the voltage of the sinewave has to increase above the threshold voltage of the diode. Once it has reached the threshold voltage, the diode will conduct the current. The current is now supplied to the capacitor and the (load-)resistor. This current will charge the capacitor till the AC-peak voltage minus the diode-threshold. Thus, when the amplitude is \(10V\), and the threshold voltage is \(0.7V\), the capacitor will be charged till \(10V - 0.7V = 9.3V\).

After the AC-source has reached its peak-value, the voltage will start to drop. From this moment on the potential at the cathode will not follow the AC-voltage, but it will remain “high”, as the potential at the cathode will be too high for the diode to conduct. With other words, the potential-drop over the diode (\(U_{anode} – U_{cathode}\)) will be below the threshold voltage and will even become negative!

From this moment on, the diode will not conduct anymore. However, energy will be supplied from the capacitor to the (load-)resistor, as the capacitor will discharge via the resistor. Due to this drain of energy, the potential over the capacitor will start to drop. The capacitor will act as an electron supply.

When looking at the negative part of the sinewave, the diode will not conduct, just as in the half-wave rectifier without the capacitor.

When the next cycle of the AC-source starts, the voltage at the Anode has to increase, till it is \(0.6 \sim 0.7V\) above the Cathode potential. But, the Cathode is now not at \(0V\), but at the residual potential supplied by the capacitor. Once the Anode is at the capacitor-voltage plus the threshold voltage, the diode will start to conduct again, and current is again supplied to the capacitor and the (load-)resistor.

The voltage over the (load-)resistor and the capacitor will now increase again to the peak-voltage of the source (minus the diode-threshold voltage). From here on, the process will be repeated continuously. The resulting waveforms are shown in Fig. 5.20.

Nothing

Hide code cell source

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

# ====== Parameters ======
f   = 50.0                 # mains frequency (Hz)
T   = 1.0 / f
w   = 2.0 * np.pi * f
Up  = 10.0                 # input peak voltage
Ud  = 0.7                  # diode drop (set 0.7 for silicon diode look)
tau = 2.5 * T              # RC time constant (bigger -> smaller ripple)

t = np.linspace(0, 3*T, 3000)
dt = t[1] - t[0]

Uin = Up * np.sin(w * t)                # AC input
Uin_env_hw = np.maximum(Uin - Ud, 0.0)  # half-wave rectified envelope (no capacitor)

# ======= Capacitor simulation (half-wave) =======
dU_est    = (Up - Ud) * (1.0 - np.exp(-T / tau))    # crude half-wave ripple estimate
Umean_est = (Up - Ud) - 0.5 * dU_est
U_cap     = max(Umean_est, 0.0)

Uout = np.zeros_like(t)
for i, ti in enumerate(t):
    Uin_d = Uin[i] - Ud
    if Uin_d > U_cap and Uin_d > 0:
        # Diode conducts -> capacitor charges quickly up to source
        U_cap = Uin_d
    else:
        # Diode off -> capacitor discharges through RL
        U_cap *= np.exp(-dt / tau)
    Uout[i] = U_cap

# ====== Figure ======
mpl.rcParams['svg.fonttype'] = 'none'   # keep text editable if you save SVG
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(9.5, 5.8), dpi=150, sharex=True)

# Top: input sine
ax1.plot(t, Uin, linewidth=2, color="#2f50ff", label="$U_{in}$")
ax1.axhline(0, color="black", linewidth=1)
ax1.set_ylabel("$U_{in}$", fontsize=14)
ax1.set_xlim(0, 3*T)
# ax1.set_ylim(0,)

# Bottom: output with capacitor
ax2.plot(t, Uout, linewidth=2, color="#2f50ff", label="$U_{out}$")
ax2.plot(t, Uin, linestyle="--", alpha=0.45, color="gray", label="Half-wave")
ax2.axhline(0, color="black", linewidth=1)
ax2.set_ylabel("$U_{out}$", fontsize=14)
ax2.set_xlabel("t (seconds)", fontsize=12)
ax2.set_xlim(0, 3*T)

mid_mask = (t > 1*T) & (t < 2*T)
tm  = t[mid_mask]
vm  = Uout[mid_mask]
vm_env = Uin_env_hw[mid_mask]

# charging
i_peak = np.argmax(vm) # where cap is recharged
t_peak = tm[i_peak]
U_peak = vm[i_peak]
ax2.annotate("Capacitor\ncharges", xy=(t_peak-0.1*T, U_peak-0.1*Up), xytext=(t_peak - 0.42*T, U_peak), arrowprops=dict(arrowstyle="->"))

# discharging
i_mid = min(i_peak + int(0.20*len(tm)), len(tm)-1)
ax2.annotate("Capacitor\ndischarges", xy=(tm[i_mid], vm[i_mid]), xytext=(tm[i_mid] + 0.12*T, vm[i_mid] + 0.10*Up), arrowprops=dict(arrowstyle="->"))

for ax in (ax1, ax2):
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['bottom'].set_visible(False)
    # ax.legend(frameon=True, loc="upper right")
    ax.set_yticks([])
ax1.set_xticks([])

plt.tight_layout()
plt.show()
../_images/b86bdc5e4843d0a045eb52b0be1e7e9c64f082a60ec4fd1cd4e2d9abd7418777.png

Fig. 5.20 Waveforms of the half-wave rectifier with buffer-capacitor.#

From this it can be seen that the voltages approaches a more or less constant DC-voltage. The amount of voltage lost, due to discharging of the capacitor, depends on the amount of current (energy) which flows to the (load-)resistor. When the load is using very little power, the voltage will be at almost the same level, thus it remains at the peak-voltage of the AC-voltage. Hence the name “peak-detector” is used for this circuit as well. This variation is called the “ripple-voltage”, the voltage is called \(U_{rpp}\) in Fig. 5.21.

Note that when this circuit is used for powering electronics, more current is drained from the capacitor, giving a larger ripple voltage.

Nothing

Hide code cell source

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.rcParams.update({'font.size': 12, 'axes.labelsize': 14})

# ===== Parameters =====
f = 50                  # mains frequency (Hz)
T = 1.0 / f
w = 2.0 * np.pi * f
Up = 1.0                # normalized peak
tau = 3*T               # RC time constant (bigger -> smaller ripple)

# Warm up long, then show only the last 3 periods
T_warm   = 8 * T
N_total  = 16000
t_all    = np.linspace(0, T_warm, N_total)

def hw_env(tt):
    s = Up * np.sin(w * tt)
    return np.where(s > 0, s, 0.0)

U_env_all = hw_env(t_all)

# ===== Simulate charge/discharge (HALF-WAVE)=====
U_cap = 0.0
U_out_all = np.zeros_like(t_all)

for i in range(len(t_all)):
    U_in = U_env_all[i]
    if i > 0:
        dt = t_all[i] - t_all[i-1]
        if U_in > U_cap:           # fast recharge at peaks
            U_cap = U_in
        else:                      # exponential discharge through load
            U_cap *= np.exp(-dt / tau)
    U_out_all[i] = U_cap

# ===== Take steady-state window: last 3 periods =====
t0        = t_all[-1] - 3*T
mask_plot = t_all >= t0
t         = t_all[mask_plot] - t0        # start at 0 for nice axes
U_out     = U_out_all[mask_plot]
U_env     = U_env_all[mask_plot]

# ===== Stats + mid-period annotations (middle of the 3 periods) =====
Umean = float(np.mean(U_out))

mid_mask = (t >= 1*T) & (t <= 2*T)
tm  = t[mid_mask]
Um  = U_out[mid_mask]
t_peak = tm[np.argmax(Um)]
U_peak = Um.max()
t_val  = tm[np.argmin(Um)]
U_val  = Um.min()

# ===== Plot =====
fig, ax = plt.subplots(figsize=(11, 4.6), dpi=150)

ax.plot(t, U_out, linewidth=2, color="#2f5597", label="Filtered output")
ax.plot(t, U_env, linestyle=":", alpha=0.6, color="#e69138",
        label="Rectified input (envelope)")

# Reference lines
ax.axhline(Umean, linestyle="--", linewidth=1, alpha=0.9, color="#6d9eeb")
ax.axhline(Up, linestyle="-", linewidth=1, alpha=0.9, color="#3d85c6")
ax.axhline(U_val, linestyle="-", linewidth=1, alpha=0.9, color="#3d85c6")

ax.text(-0.03*T, Up, r"Peak, $U_p$", va="bottom", ha="right")
ax.text(-0.03*T, Umean, r"Mean, $U_{dc}$", va="bottom", ha="right")

ax.annotate("", xy=(t_peak, U_peak), xytext=(t_peak, U_val), arrowprops=dict(arrowstyle="<->", lw=1.5, color="black"))
ax.text(t_peak + 0.02*T, 0.5*(U_peak + U_val) - 0.03, r"Ripple voltage $\Delta U$", va="center", ha="left")

ax.annotate("Discharging\nperiod", xy=(t_peak - 0.4*T, U_peak), xytext=(t_peak - 0.4*T, Up*1.07), ha="center", arrowprops=dict(arrowstyle="->"))
ax.annotate("Charging\nperiod", xy=(t_peak - 0.08*T, U_peak), xytext=(t_peak - 0.08*T, Up*1.07), ha="center", arrowprops=dict(arrowstyle="->"))

x0, x1 = 1*T, 2*T
ax.annotate("", xy=(x0, 0.05), xytext=(x1, 0.05), arrowprops=dict(arrowstyle="<->", lw=1.4, color="black"))
ax.text((x0 + x1)/2, 0.075, "Period $T$", ha="center")

# Axes config
ax.set_xlim(0, 3*T)
ax.set_ylim(0, 1.15)
ax.set_xlabel("Time (seconds)")
ax.set_ylabel(r"$U_{rpp}$ (Volts)")
ax.set_yticks([]); ax.set_xticks([])
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

plt.tight_layout()
plt.show()
../_images/75934e0b224d77e780ba6d836e11995acc77bcbc22239b8575851267e70d8442.png

Fig. 5.21 Ripple voltage of a half-wave rectifier.#

In principle the capacitor could discharge till \(0V\), if the next charging period does not start too soon. Discharging would occur according to an e-power, thus:

\[ U_c = U_{peak}\cdot e^{-\frac{t}{RC}} \]

In practice, the capacitor will only be partially discharged. Its value is often chosen such that the ripple voltage is minimal. The charge time, and discharge time depend on the amplitude of the ripple voltage. The sum of the charge and discharge time are the period-time (\(T\)).

Because of the partial discharge, and the almost constant voltage over the resistor, we can use a linear approximation for the ripple voltage. The (almost) constant voltage over the resistor, draws a constant current from the capacitor. Therefore we can use the formula for the charge on the capacitor to approximate the ripple voltage.

\[dQ = C \cdot dU = I \cdot dt\]

In this case the dU is describing the voltage change over the capacitor, thus the ripple voltage. As the current is defined by Ohm’s law, we can calculate the current. The frequency of the AC-source is very often known as well, and we assume that dt equals the period-time. In this case we further assume that the charge-time is short compared to the discharge time, so we can neglect the time for the charging.

\[dU = U_{ripple} = \frac{U_{cap}T}{RC}\]

With:

  • \(T\) = period-time \([s]\)

  • \(U_{cap}\) = DC-voltage over the capacitor

  • \(R\) = (load-)resistor \([\Omega]\)

  • \(C\) = capacitor-value \([F]\)

5.3.3. Bridge Rectifier#

The rectifying circuit described before, only takes advantage of the positive part of the sinewave. It is possible to build a circuit which makes use of both the positive and negative part of the sinewave. This circuit is known as the bridge-rectifier or “Graetz bridge”.

The circuit makes use of four diodes in total. The diodes conduct in pairs, one pair for the positive part of the sinewave, the other pair for the negative part. The diagram of the bridge-rectifier is shown in Fig. 5.22.

../_images/Bridge-Rectifier-with-Smoothing-Capacitor.svg

Fig. 5.22 Bridge rectifier circuit, with load-resistor and buffer (smoothing)capacitor.#

As said the diodes will conduct in pairs. When the top side of the voltage source is positive, the current will flow through D1, through the capacitor and the resistor, through D2 back to the source. When the bottom side of the source is positive compared to the top-side, the current will flow from the source, through D4, the capacitor and the resistor, through D3, back to the source. The current flow through the capacitor and the resistor will be in the same direction in both situations.

This can be seen in Fig. 5.23. Here the voltage source is replaced by a transformer. In most instruments this configuration is used. The transformer steps down the mains-voltage (\(230V\)) to a lower voltage, then this voltage is rectified by the bridge and smoothed by the capacitor.

../_images/Full-Wave-Rectifier-Showing-Current-Flow.svg

Fig. 5.23 Simple power supply circuit.#

The resulting waveform is shown in Fig. 5.24. From this we can see that the capacitor is charged twice per period.

Nothing

Hide code cell source

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.rcParams.update({'font.size': 12, 'axes.labelsize': 14})

# =========================
# Simulation Parameters
# =========================
f = 10              # AC frequency (Hz)
T = 1/f
t = np.linspace(0, 2*T, 2000)
t_ms = t * 1000

U_peak = 10.0
U_diode_drop = 0.7          # total forward drop per conduction path

U_ac_in = U_peak * np.abs(np.sin(2*np.pi*f*t))
U_rect = np.maximum(U_ac_in - U_diode_drop, 0.0)
U_rect_peak = np.max(U_rect)

# =========================
# Capacitor simulations
# =========================

# --- Case B: Light load ---
RC_B = 0.2
U_cap_B = np.zeros_like(t)
U_cap_B[0] = 0.85 * U_rect_peak

for i in range(1, len(t)):
    dt = t[i] - t[i-1]
    if U_rect[i] > U_cap_B[i-1]:
        U_cap_B[i] = U_rect[i]
    else:
        U_cap_B[i] = U_cap_B[i-1] * np.exp(-dt / RC_B)

# --- Case C: Heavy load ---
RC_C = 0.05
U_cap_C = np.zeros_like(t)
U_cap_C[0] = 0.70 * U_rect_peak

for i in range(1, len(t)):
    dt = t[i] - t[i-1]
    if U_rect[i] > U_cap_C[i-1]:
        U_cap_C[i] = U_rect[i]
    else:
        U_cap_C[i] = U_cap_C[i-1] * np.exp(-dt / RC_C)

# =========================
# Average and Max values
# =========================
U_dc_avg_noC = np.mean(U_rect)
U_dc_avg_B   = np.mean(U_cap_B)
U_dc_avg_C   = np.mean(U_cap_C)
U_max_B      = np.max(U_cap_B)
U_max_C      = np.max(U_cap_C)

# =========================
# Peak + valley detection
# =========================
def env_peaks_indices(U):
    Ur = np.array(U)
    return np.where((Ur[1:-1] > Ur[:-2]) & (Ur[1:-1] >= Ur[2:]))[0] + 1

def discharge_valleys_between_peaks(U_cap, peaks):
    valleys = []
    for a, b in zip(peaks[:-1], peaks[1:]):
        k = a + np.argmin(U_cap[a:b])
        valleys.append(k)
    return np.array(valleys, dtype=int)

peaks_idx = env_peaks_indices(U_rect)
i0, i1, i2 = peaks_idx[:3]

# B valleys
valleys_B = discharge_valleys_between_peaks(U_cap_B, peaks_idx)
val1_B, val2_B = valleys_B[:2]

# C valleys
valleys_C = discharge_valleys_between_peaks(U_cap_C, peaks_idx)
val1_C, val2_C = valleys_C[:2]

# Time markers
t1_B_start = t_ms[val1_B]
t1_B_end   = t_ms[i1]
t2_B_start = t_ms[i1]
t2_B_end   = t_ms[val2_B]

t1_C_start = t_ms[val1_C]
t1_C_end   = t_ms[i1]
t2_C_start = t_ms[i1]
t2_C_end   = t_ms[val2_C]

# =========================
# Plotting
# =========================
fig, axes = plt.subplots(3, 1, figsize=(10, 9))

y_min, y_max = 0, 1.1 * U_peak

# =========================
# PANEL 1 - No capacitor
# =========================
axes[0].plot(t_ms, U_ac_in, color='tab:orange', linestyle='-', linewidth=1.5)
axes[0].plot(t_ms, U_rect, color='#9B1FA8', linestyle='--', linewidth=2)

axes[0].axhline(U_dc_avg_noC, color='gray', lw=1, ls='--', alpha=0.7)
axes[0].axhline(U_rect_peak, color='gray', lw=1, ls='--')

axes[0].text(-2, U_rect_peak, '$U_{max}$', ha='right', va='center')
axes[0].text(-2, U_dc_avg_noC, '$U_{dc}$', ha='right', va='center')

# # Annotate diode drop region near peak
# gap_x = t_ms[i1]
# axes[0].annotate('', xy=(gap_x, U_ac_in[i1]), xytext=(gap_x, U_rect[i1]), arrowprops=dict(arrowstyle='<->', color='crimson', lw=1.4))
# axes[0].text(gap_x + 3.0, 0.5 * (U_ac_in[i1] + U_rect[i1]), '≈0.7 V gap', color='crimson', va='center')

axes[0].set_ylim(y_min, y_max)
axes[0].set_xlim(0, t_ms[-1])
axes[0].set_title("Full-wave output with no filter capacitor", loc='left')
axes[0].grid(alpha=0.3)

# =========================
# PANEL 2 - Light load
# =========================
axes[1].plot(t_ms, U_ac_in, color='tab:orange', linestyle='--', linewidth=1.5)
axes[1].plot(t_ms, U_rect, color='#9B1FA8', linestyle='--', linewidth=2)
axes[1].plot(t_ms, U_cap_B, color='tab:blue', linewidth=2)

axes[1].axhline(U_dc_avg_B, color='gray', lw=1, ls='--', alpha=0.7)
axes[1].axhline(U_max_B, color='gray', lw=1, ls='--')

axes[1].text(-2, U_max_B+0.02*U_peak, '$U_{max}$', ha='right')
axes[1].text(-2, U_dc_avg_B, '$U_{dc}$',  ha='right')

# t1
axes[1].axvline(t1_B_start, color='gray', lw=1.3)
axes[1].axvline(t1_B_end, color='gray', lw=1.3)
axes[1].annotate('', xy=(t1_B_end, 0.06*U_peak), xytext=(t1_B_start, 0.06*U_peak), arrowprops=dict(arrowstyle='<->', lw=1.2))
axes[1].text((t1_B_start+t1_B_end)/2, 0.1*U_peak, '$t_1$', ha='center')

# t2
axes[1].axvline(t2_B_end, color='gray', lw=1.3)
axes[1].annotate('', xy=(t2_B_end, 0.06*U_peak), xytext=(t2_B_start, 0.06*U_peak), arrowprops=dict(arrowstyle='<->', lw=1.2))
axes[1].text((t2_B_start+t2_B_end)/2, 0.1*U_peak, '$t_2$', ha='center')

axes[1].set_ylim(y_min, y_max)
axes[1].set_xlim(0, t_ms[-1])
axes[1].set_title("Filtered output across light load", loc='left')
axes[1].grid(alpha=0.3)

# =========================
# PANEL 3 - Heavy load
# =========================
axes[2].plot(t_ms, U_ac_in, color='tab:orange', linestyle='--', linewidth=1.5)
axes[2].plot(t_ms, U_rect, color='#9B1FA8', linestyle='--', linewidth=2)
axes[2].plot(t_ms, U_cap_C, color='tab:blue', linewidth=2)

axes[2].axhline(U_dc_avg_C, color='gray', lw=1, ls='--', alpha=0.7)
axes[2].axhline(U_max_C, color='gray', lw=1, ls='--')

axes[2].text(-2, U_max_C, '$U_{max}$', ha='right')
axes[2].text(-2, U_dc_avg_C,'$U_{dc}$',  ha='right')

# t1
axes[2].axvline(t1_C_start, color='gray', lw=1.3)
axes[2].axvline(t1_C_end, color='gray', lw=1.3)
axes[2].annotate('', xy=(t1_C_end, 0.06*U_peak), xytext=(t1_C_start, 0.06*U_peak), arrowprops=dict(arrowstyle='<->', lw=1.2))
axes[2].text((t1_C_start+t1_C_end)/2, 0.1*U_peak, '$t_1$', ha='center')

# t2
axes[2].axvline(t2_C_end, color='gray', lw=1.3)
axes[2].annotate('', xy=(t2_C_end, 0.06*U_peak), xytext=(t2_C_start, 0.06*U_peak), arrowprops=dict(arrowstyle='<->', lw=1.2))
axes[2].text((t2_C_start+t2_C_end)/2, 0.1*U_peak, '$t_2$', ha='center')

axes[2].set_ylim(y_min, y_max)
axes[2].set_xlim(0, t_ms[-1])
axes[2].set_title("Filtered output across heavy load", loc='left')
axes[2].set_xlabel("Time (ms)")
axes[2].grid(alpha=0.3)

# Remove ticks for clean look
for ax in axes:
    ax.set_yticks([])
    ax.set_xticks([])

plt.tight_layout()
plt.show()
../_images/fcfd5624b152cd060e51544f9053f8af13d5359e34f7d3edf4a3fcef5f6ea152.png

Fig. 5.24 Double rectified AC-voltage waveform.#

As the time between the charging of the capacitor is half of the time of a single sided rectifier, we can assume that the ripple voltage will be smaller. With other words, with the same size of buffer-capacitor we will have half the ripple voltage. We can divide the period-time by two, this gives us the following formula for the ripple voltage:

\[ dU = U_{ripple} = \frac{U_{cap}T}{2RC} \]

A remark about the resulting voltage: As the current path is passing through two diodes, we will lose two times the threshold voltage. The rectified peak-voltage will thus be the AC-peak voltage minus two times the diode-threshold voltage.

5.3.4. Signal Circuits with Diodes#

The previous applications of the diode, were more or less aimed at power supply circuits, although they can be used for signal processing as well. There are other diode circuits which are seen more often in signal-processing circuits.

Diodes are for example used on (sensitive) inputs of instruments, in order to protect these inputs from too high voltages or voltages with the wrong polarity. The diodes can be used to limit these voltages too safe values. It should be noted that usually a slightly higher or small negative voltage can be allowed on an input.

As each circuit/instrument can have its own limits, a big variety of circuits has been developed over the years. Here we will show some examples, from these one should be able to analyze or design the necessary circuits for a specific application.

5.3.5. The Diode Clipper#

In Fig. 5.25 one of the simplest clipper circuits is shown. It could be used to protect an input from negative voltages.

../_images/one_diode_clipper.svg

Fig. 5.25 The one-diode clipper.#

In the circuit we see a resistor \(R_L\), which could be the input-impedance of an amplifier. The signal Uin is an AC-source, giving both positive and negative voltages. The negative parts should be removed (clipped) before it enters the amplifier. By using a diode this can be done!

When the input-voltage is positive the potential on the Anode (at ground level, bottom of image) will be lower then the potential on the Cathode (top of image). The diode will block and no current will flow through the diode.

When the input-voltage is negative, the Anode will have a higher potential compared to the Cathode, thus the diode will conduct. The voltage is limited to the threshold voltage. Resistor R1 is added, to limit the current through the circuit to an acceptable level. When the R1 resistor would not be there, there would be a problem, as the voltage-source will supply a voltage, while the voltage over the diode is limited to the threshold voltage.

This circuit will cut off the negative portion of the signal. When we would reverse the diode connections, the circuit will cut-off the positive portion of the input-signal.

We can build a clipper with two diodes as well. Such a circuit is shown in Fig. 5.26.

../_images/sim-circuit.svg

Fig. 5.26 Double diode clipper.#

The double diode clipper will limit the signal both for the positive and the negative part. Let’s say the threshold voltage of the diode is \(0.7V\). In that case the voltage on the output of the circuit, thus \(U_{out}\), would be at highest \(+0.7V\) and at its lowest \(-0.7V\). Between these voltage limits, the diodes will not conduct (so not influence the signal!) and the signal will pass to the output. Such circuit can be used as a protective circuit, blocking too high voltages.

5.3.6. Clipper Circuits with Offset Voltage#

In the previous circuits, the clipping voltage was defined by the threshold voltage of the diode(s). These circuits are absolutely useful, but very often some more flexibility is needed. In those situations combinations can be made with fixed voltage sources and diodes. An example is shown in Fig. 5.27.

../_images/double_diode_clipper_offset.svg

Fig. 5.27 Double diode clipper with offset-voltage sources.#

Two diodes are used to be able to clip the positive and the negative voltages. Diode D1 is used for limiting the voltages with positive polarity, diode D2 for the voltages with negative polarity.

When figuring out the working-principle of the circuit, one needs to determine if the diode is conducting or not. For this example we assume the threshold voltage over the diode is \(0.7V\).

Let’s have a look at D1: The Cathode of this diode is at a potential of \(3\) Volt, due to the voltage source. The diode will only conduct when the Anode is \(0.7V\) higher compared to the Cathode, which will be \(3.7V\) in this specific case. When the diode is conducting the voltage will be held at \(3.7V\).

A similar reasoning can be followed for the negative voltage, due to the offset voltage of \(-5V\), the limit will be at \(-5.7V\).

By adjusting the fixed voltage sources, a wide range of limits can be set.

5.3.7. Clipper Circuit with Zener-Diodes#

Instead of using normal diodes, clippers can be made with zener-diodes as well. Remember, a zener diode acts as a normal diode in one direction, and will start conducting current in the opposite direction, once the voltage reaches the zener-voltage.

In Fig. 5.28 we see two different clipper circuits using zener-diodes. Both circuits will limit the voltage in both the positive polarity and with the negative polarity.

../_images/128_square_wave_signal.svg

Fig. 5.28 Zener-diode clipper circuits.#

In the example with the single zener-diode, we can see that the voltage will be clipped at the threshold-voltage (\(-0.7V\)) when the voltage is negative. The zener-diode starts to conduct with positive voltages once the zener-voltage level is reached. The resistor will limit the current to safe levels like in the previous circuits.

The circuit with the two zener diodes functions in a similar way, but: Both diodes have to conduct before the circuit starts to limit the voltage, which means that the actual clipping voltage is the threshold voltage plus the zener-voltage of the other diode.

For positive voltages Dz1 has to conduct normally (\(0.7V\)) and Dz2 will conduct once its zener-voltage is reached. For negative voltages, Dz2 will conduct normally (\(0.7V\)) and the zener-voltage of Dz1 has to be reached.

Something to think about: Could a similar circuit be made with the two zener-diodes in parallel? Like the circuit in Fig. 5.26.

5.3.8. Clamper Circuits#

Another category of diode-circuits are the “clampers”. Clampers are circuits based on a diode in conjunction with a capacitor (and very often some other components). These circuits will not limit the voltage between certain values, but they are able to shift the DC-potential of a signal. In this manner a sinewave which has positive and negative periods, can be shifted upwards, such that the whole sinewave will be above \(0V\).

Again, there is a wide variety of clamper circuits. Here we will show and explain an example, such that the principle will be clear. In Fig. 5.29 we see a clamper circuit, this circuit will be further analyzed here.

../_images/Diode-clamper-circuit-positive-biased.svg

Fig. 5.29 A clamper circuit which will shift an AC signal above ground-level.#

In Fig. 5.29 we see the clamper-circuit together with an input-signal and its output-signal. The input is symmetrical around zero (a normal sinewave). The output is a sinewave which has been shifted upwards (an offset has been added). The addition of the offset could be done with a DC-source, however, this is very often not practical or not possible.

In this case we use the capacitor as a replacement for the DC-source. Remember that a charged capacitor will have a DC-voltage over its terminals. When the charge/discharge over the capacitor is small, the voltage will remain constant.

How will the capacitor be charged in this circuit? Let’s start with an input voltage of \(0 V\) (the sinewave is at \(0V\)) and assume the capacitor is discharged. At that moment the Anode of the diode is at \(+3V\), the cathode of the diode will be at \(0V\) (!). This will give a huge current through the diode and the capacitor (only limited by some residual resistance from the diode or wire). This will instantaneously charge the capacitor to \(2.3V\), \(3V\) of the source, minus the threshold-voltage of the diode.

When the sinewave starts to move to the positive side, the diode will block, because the voltage at the cathode will move from \(+2.3\) to \(+7.3V\). Some charge will be lost in the \(1M\Omega\) resistor, however, this can be neglected because of the high RC time. When the sinewave moves towards its negative period, the diode will start to conduct again. The negative peak-voltage of the sinewave (\(-5V\)) will charge the capacitor to a total of \(7.3V\). The “+” of the capacitor will be at \(+2.3V\), the negative side will be at \(-5V\) giving the total of \(7.3V\).

In the next positive cycle this \(7.3V\) is added to the the sinewave. This means that when the sinewave is at its positive peak of \(+5V\), the voltage at the output (over R1) is \(5V + 7.3V = 12.3V\).

When the sinewave is at its negative peak (\(-5V\)) the output voltage will be \(-5V + 7.3V = 2.3V\).

Here we can see that the circuit will always give a positive voltage once the capacitor is charged.

5.4. Practical Diodes#

In practice there is a huge variety of diodes. There are diodes for small signal (low-power) applications, but there are diodes for high-power applications as well (diodes which can handle thousands of amps!). Nost often small diodes are used. These diodes come in similar packages, some examples are shown in Fig. 5.30.

../_images/Diodes_updated.jpg

Fig. 5.30 Some typical small-signal (low-power) diodes.
Created by Omegatron, under CC BY-SA 3.0, original file
#

When looking at the diodes, one can see a ring or a dot on onde side of the diodes. This mark is always placed at the Cathode of the diode.

Another type of diode we will probably use, is the LED. LEDs do exist in a large number of shapes and colors. When using LEDs it is important to identify the Cathode and the Anode as well.

../_images/LED_diagram2.svg

Fig. 5.31 Typical LED showing the orientation of the diode inside the LED.#

5.4.1. Practical Diode Limitations#

Each component has its limitations. To be sure, always check the datasheet of that specific component. For that the type-number is important.

Limitations for diodes are the maximum current it can handle and the maximum reverse voltage.

For signal-diodes:

  • Take into account the maximum forward current it can handle. It usually ranges from \(100mA\) to about \(1A\).

  • Pay attention to the maximum reverse voltage for small diodes this can be in the order of \(50V\), but can easily extend to \(1000 V\) (\(1 kV\)!).

For LEDs:

  • Take care not to exceed the maximum current through the LED. Typical value is \(20 mA\).

  • The maximum reverse voltage of an LED is fairly low, usually around \(5V\). So actually they are pretty lousy diodes, however, they make good optical indicators!

Zener-diodes:

  • For zener-diodes always pay attention to the maximum power-dissipation. The voltage drop over the diode times the current passing through the diode will give you the power dissipated. This value should never exceed the value mentioned in the data-sheet. For small zener diodes this value ranges from \(200mW\) to \(1.5W\).

5.5. Photodiode Applications#

As addressed earlier, diodes are very often used in power-supplies (to conver the AC to DC). However, nowadays we use the USB-port for power, or we just buy a power-adapter. There are other, more intriguing, applications of diodes.

Quite a number of bio-chemical measurements make use of optical interfaces or chemical reactions where light-intensity is an important parameter. Some examples are:

  • bio-photo luminescence

  • optical quenching

  • photon counters

In these applications some form of (bio-)chemical reaction takes place. Due to this reaction photons are generated, or blocked. When these photons are detected the parameters of a (bio-)chemical reaction can be determined.

For this we could use a chemical interface which is luminescent. This interface can be applied directly on the photo-diode, creating a very compact device.

5.5.1. Colorimeter#

A good example is the colorimeter or spectrophotometer. These instruments are used a lot in chemical labs in order to measure the optical absorbance of a liquid. This absorbance very often relates to the concentration of substances in the liquid.

The Lambert-Beer law can be used to determine the concentration of specific constituents. For this very often a calibration-curve has to be derived. The general principle is shown in Fig. 5.32.

../_images/Transmittance-Diagram.svg

Fig. 5.32 Transmission of light through a sample in a cuvette, as used in a photospectrometer.#

The transmittance (\(T\)) of the light is expressed as the ratio between the incoming (\(I\)) and the outgoing light intensity (\(I_0\)).

\[T = \frac{I}{I_0}\]

The principle of these instruments is fairly simple: A light source (at a specific wavelength) is used to illuminate the sample. The light which passes through the sample is received on the other side and detected with a photo-detector. The (old) principle is shown in Fig. 5.33. Here a light bulb (with a wide photospectrum) is used as a source, the wavelength is selected with a prisma. The light is detected with a photo-detector (here a photoresistor, a resistor which changes resistance based on the light-intensity).

../_images/Spetrophotometer-en.svg

Fig. 5.33 Principle of a photospectrometer.
Created by YassineMrabet, under CC-BY-SA, original link
#

Nowadays, the light-source is replaced with a (multi)color-LED, which can illuminate the sample with a fixed number of wavelengths. For the measurement of the light-intensity a photo-diode is used.

5.5.2. Pulse-oximeter#

Other interesting applications are the pulse-oximeters. In these the heart-rate and oxygen saturation of a person can be determined. These devices are found a lot in hospitals, ambulances and are used a lot by sportsmen. In Fig. 5.34 the principle of the sensor is shown. The light-intensity is converted to a voltage and recorded by for example a micro-controller. This micro-controller calculates the heart-rate and oxygen-saturation.

../_images/Working-principle-of-the-Pulse-oximeter-SpO2-35.svg

Fig. 5.34 Principle of the sensor of a pulse-oximeter.#

5.6. Diode exercises#

Exercise 5.1 (Single diode in signal path)

../_images/sim-circuit4.svg

Fig. 5.35 The source generates a 1 Vp 1 kHz sine wave.#

🖊️ Exercise: Single diode in signal path

Derive the \(U_{out}\), for the above circuit, with 1 Vp 1 kHz sine as \(U_{in}\).

Exercise 5.2 (Single diode as load)

../_images/sim-circuit3.svg

Fig. 5.36 diode as load#

🖊️ Exercise: Single diode as load

Now the voltage source, resistor and diode are still in series, but \(U_{out}\) is measured over the diode.

Derive how the output signal \(U_{out}\) will look like

Exercise 5.3 (multi diode circuit)

../_images/sim-circuit2.svg

Fig. 5.37 A circuit with multiple diodes#

🖊️ Exercise: multi diode circuit

For the following circuit with multiple diodes, with forward voltage of 0.7V the following settings are given:

  • \(U_D\)= 0.7 V

  • R1= 1 k \(\Omega\)

  • Freq=1kHz

Derive what will be:

  • \(I_{R1,max}\) when \(U_S\) generates a 8 \(V_{pp}\) sine wave.

Derive what will be:

  • the sketch of \(U_{out}\) under the above conditions.

Derive what will be:

  • the sketch of the frequency spectrum of \(U_{out}\) when the source creates a sine-wave of 1 \(V_{pp}\)

  • the sketch of the frequency spectrum of \(U_{out}\) when the source creates a sine-wave of 10 \(V_{pp}\)

Exercise 5.4 (Zener circuit)

../_images/zener_diode_circuit.svg

Fig. 5.38 Zener diode circuit#

🖊️ Exercise: Zener circuit

For the following circuit with a Zener diode, with break-down voltage of -5.0V, and forward voltage of 0.6V, sketch the transfer function \(\frac{U_{out}}{U_{in}}\).

Exercise 5.5 (Advanced clipper)

../_images/sim-circuit5_clipper_advanced.svg
🖊️ Exercise: Clipper with two voltage sources

In the above circuit we have to sources, one 5V DC source, and \(U_{in}\) of 8Vp, 1kHz.
Derive the time-dependent signal of \(U_{out}\).

Exercise 5.6 (Half-wave rectifier 1)

../_images/half-wave-rectifier_plus_cap2.svg

Fig. 5.40 The AC source supplies 15 \(V_{rms}\)
The voltage over the diode, \(V_d\) is 0.7 V
The load resistance R is 100 \(\Omega\)
#

🖊️ Exercise: Half-wave rectifier 1

For the above rectifier, derive how \(U_{out}\) will look like (a voltage versus time graph)

Exercise 5.7 (Half-wave rectifier 2)

../_images/half-wave-rectifier_plus_cap.svg

Fig. 5.41 The AC source supplies 15 \(V_{rms}\), 50 Hz#

The voltage over the diode, \(V_d\) is 0.7 V The load resistance R is 100 \(\Omega\)

🖊️ Exercise: Half-wave rectifier 2

For the above rectifier with a requirement of <5% ripple, what would be the required minimal value for the capacitance?

Exercise 5.8 (Full-wave rectifier)

../_images/Full-Wave-Rectifier-Showing-Current-Flow.svg

Fig. 5.42 Full-wave rectifier, \(U_{out}\) is measured over the load resistor.#

🖊️ Exercise: Full-wave rectifier

For the above rectifier \(U_{in}\) is 3Vp, 1kHz and the load resistance is 1 k\(\Omega\).
a) What is the frequency of \(U_{out}\) (over the load resistor)?

b) What are the minimum and maximum values of \(U_{out}\)?

Exercise 5.9 (Two diode circuits)

../_images/examQ_two_diode_circuits.svg

Fig. 5.43 Two diode circuits#

🖊️ Exercise: Two diode circuits

The above circuit consists of two voltage sources, a resistor and a diode.
Two possible configurations are given below. The diode may be assumed to be ideal.
Given the following specifications for the other components:
R1: 2.0 kΩ
U1: DC +3.0V
U2: Pulse source, 50% duty cycle, \(U_{high}\) = +8.0V, \(U_{low}\) = -8.0V
A) Make a sketch of the output-voltage (\(U_{out}\)) of both circuits.

B) Calculate the maximum current through the diode for each circuit

Exercise 5.10 (Circuit with two sources and one diode)

../_images/examQ_one_diode_two_sources.svg

Fig. 5.44 Circuit with one diode, two sources and two resistors#

🖊️ Exercise: Circuit with one diode, two sources and two resistors

Given the following circuit:

  • R1 = 1kΩ

  • R2 = 1kΩ

  • U1 = +5V (DC)

  • U2 = Pulse-source

    • Period time = 10ms

    • For 5ms U2 = 2V

    • For 5ms U2 = 10V

A) You may assume the diode is ideal.

  • Make a sketch of the voltage Ua over time.

  • Explain the way this circuit works.

B) What will happen when the diode is not ideal?

resistor R2 is replaced by a capacitor. See the circuit below.

../_images/examQ_one_diode_two_sources%2Bcap.svg

Fig. 5.45 Circuit with one diode, two sources and a resistor and capacitor#

🖊️ Exercise: Circuit with one diode, two sources and resistor+capacitor

In the previous circuit R2 is replaced by C1:

  • R1 = 1kΩ

  • C1 = 10 \(\mu\)F

  • U1 = +5V (DC)

  • U2 = Pulse-source

    • Period time = 10ms

    • For 5ms U2 = 2V

    • For 5ms U2 = 10V

C) Make a sketch of the output voltage Ua’ over time. Explain what is happening.

D) What will happen when the value of the capacitor is changed (increased and/or decreased), explain your answer.

Exercise 5.11 (Clipper against negative voltages)

../_images/two_clippers.svg

Fig. 5.47 Clipper against negative voltages#

🖊️ Exercise: Clipper against negative voltages

Uin is the voltage coming from a reaction chamber, and Uout goes to a computer interface, which needs to be protected against negative voltages. In order to protect the computer interface a clipper is placed between Uin and the input of the computer interface.
Furthermore, the output should be limited as well (too high voltage will damage the input of the interface!).

Two configurations (A and B, above figure) were designed.

a) In order to test the clippers, Uin is set to a triangle-wave of 100 Hz, with a 30 Vpp amplitude (symmetrical around 0 V).
The forward voltage drop over the diodes is 0.6V.
Ulimit = 10V.
Make a precise sketch of the output voltage of each circuit when the triangle-wave is applied.

b) Calculate the value of R1a and R1b, when the maximum current (for the 30Vpp triangle-wave) at Uin is 1mA

Exercise 5.12 (Complexer diode circuit)

../_images/examQ_diode_3R.svg

Fig. 5.49 Circuit with two sources, 3 resistors and two diodes. R1 = 50 Ω, R2 = 150 Ω, R3 = 50 Ω#

🖊️ Exercise: Complexer diode circuit

Have a look at the above diagram. This diagram belongs to a complex wave generator.

  • U1: Triangle wave, period time = 1s, amplitude = 20Vpp, symmetrical around zero

  • U2: Square wave, period time = 1s, amplitude = 20Vpp, duty cycle 50%, symmetrical around zero
    Both waveforms start at t=0s with a positive period.

a.) Sketch the output voltage, you may assume the diodes are ideal.

b.) What will happen when we take the forward voltage drop of the diode (0.7V) into account?
Draw Uout as accurate as possible, combined with U1 and U2 (draw U1 and U2 as dotted lines) in one figure.

Exercise 5.13 (Complexer diode circuit 2)

../_images/diode_circuit2.svg

Fig. 5.52 Complexer circuit with two sources, two diodes, and a resistor
The diodes maybe assumed to be ideal. R1 = 1 kOhm.
U1 = 10 sin (2pi250*t) and U1 = -U2
#

🖊️ Exercise: Complexer diode circuit 2

A circuit with two diodes and two sources is made, see the circuit above.

a.) Draw Uo, you may assume the diodes are ideal.

b.) What is the frequency of Uo?

c.) What is the RMS output voltage?

A zener diode is used to stabilise a voltage. Given the circuit below.

../_images/diode_circuit2zener.svg

Fig. 5.53 Zener diode stabilizing circuit.
U1 = 20V, R1 = 20 Ohm, R2 = 48 Ohm, D1 = 12V zener
#

d.) What is the power dissipation in the zener?