4811

The following is a collection of mistakes, misunderstandings, wrong assumptions in designing electronic circuits and measuring in electronic circuits. I tried to cover mistakes that are rather common instead of mysterious ones that need a deep understanding of electronics. Everyone will have encountered at least one of these problems. If you didn't, you must be a true genius. Some mistakes might be obvious to you, but maybe not to others. This depends on your level of knowledge and experience.

1) Ohms law does not seem to work for incandescent light bulbs ?

You have a 12V bulb and because you want to increase its lifetime or reduce its intensity, you want to put a series resistor in series with the bulb. To have an idea of the resistance of the bulb, you measure it with a multi meter. The multi meter measures 18 Ohms resistance for the bulb. You decide to use a 10 Ohm resistor as the series resistor for the bulb.
You use Ohms law to check what voltage we can expect over the bulb.
The current through the bulb will beĀ  : (12V (V) / (10 OhmĀ  R1) + 18 Ohm (B1)) ) = 420mA. So the voltage over the bulb will be 420mA * 18 Ohm = ca. 7.7V
But then you switch on the power supply and measure the voltage over the bulb.
To your surprise you measure 11.4V over the bulb and not the 7.7V that you calculated with Ohms law !

See figure: 1_How can it be bulb

Where did we go wrong ?
We forgot that the resistance of a bulbĀ  is much lower when the filament is cold, than when the filament is heated up. SoĀ  when the bulb is being powered it's resistance went from 18 Ohm to 190 Ohm, so more than 10 times higher. So suddenly the resistance of the bulb is the major factor compared to R1, which can almost be neglected, resulting almost all of the voltage dropping over the bulb. Since the resistance of a bulb increases with temperature, this is called a positive temperature coefficient (PTC).
Lesson learned ?
Components can have a temperature dependency that you need to take into account when using their resistance or impedance in calculations.

2) Measuring a wrong voltage in a circuit with high value resistors ?

Suppose you have a resistive divider with 2 resistors of 1MOhm (R1 and R2) with a a DC voltage of 12V (V1). Because both resistances are equal, we expect a voltage of 6V over R2, as well as over R1.Ā 
You build the circuit and you measure the voltage over R2 with a volt meter. You measure 5.75V over R2 and also 5.75V over R1.
But surprisingly when you add up the 2 voltages, you get 11.5V and not 12V. Hm, the volt meter must be inaccurate. So you take a 5 1/2 digit or who knows a 6 1/2 digit very accurate multi-meter and again you measure 5.75V over R2 and 5.75V over R1.

See figure: 2_How can it be high resistance

Where did we go wrong ?
We forgot that the input impedance of the volt meter (or multi meter) influences our circuit. A multi meter typically has a input impedance of 10MOhm. This means that you actually put a 10MOhm resistor in parallel with the 1MOhm resistor when you either measure the voltage over R1 or R2. The resulting parallel resistance is lower than 1MOhm: total resistance = R1 * 10MOhm / (R1 + 10MOhm) = (1MOhm * 10MOhm) / (1MOhm + 10MOhm) = 909.0909kOhm.Suppose we connect the multi meter over R2. The parallel connection of R1 and the input impedance of the multi meter results in a total resistance that is lower than 1MOhm, namely 909.09kOhm. The total resistance of the circuit decreases by connecting the multi meter, thus a higher current will flow through the circuit. The current will be 12V / (1MOhm + 909.09kOhm) = 6.28uA. Without the multi meter, the current would be 12V / 2MOhm = 6uA. The higher current causes a larger voltage drop over R1 = 1MOhm * 6.28uA = 6.28V. The voltage that the multi meter will measure will be 12V - 6.28V = 5.72 and not the 6V that we expected !
Lesson learned ?
When measuring in circuits that are high impedance (high value resistances or high impedance), you might have significant measuring errors due to the influence of the input impedance of your measuring equipment. F.e. when measuring with an oscilloscope scope a 10:1 probe will be seen as a higher impedance than 1 1:1 probe. With multi meters, the input impedance can change depending on the selected range (even when it is an auto range multi meter).

3) Current flows through a capacitor while it consists of 2 plates that are separated by an insulator ?

I often read discussions on the internet about whether current flows through a capacitor or not. The dielectric of a capacitor is an insulator, so not many electrons will be able to move through the dielectric from one plate of the capacitor to the other one. The leakage current is the only current that actually can flow through the dielectric. This leakage current is due to imperfections in the dielectric. The magnitude of the leakage current depends on the voltage that is put over the capacitor and can be in the range of micro-amperes.
The charge current that flows to charge the capacitor to a certain voltage is not flowing through the dielectric at all.

See figure: 3_How can it be capacitor current flow

Where did we go wrong ?
Just imagine a capacitor as being a flexible membrane in a water tube. When water is pumped into the water tube, the membrane will bend and the water at the other side of the membrane is pushed out of the tube. So what you see is that water goes into the tube and at the other end water flows out of the tube. Does the water flow through the membrane ? No. But still it appears like it does. When we think of the water as the electrons and the membrane as the dielectric of the capacitor, we see electrons flowing to one plate of the capacitor and at the same time we see electrons flowing out of the other plate. Does that mean that the electrons flow through the dielectric ? No, the electrons at one plate repel the electrons on the other plate, so it surely looks like they flow through the dielectric, but they don't.
Of course the analogy with water is not watertight, but it helps to visualize the effect.
Lesson learned ?
Not everything actually is what it appears to be.

4) Calculated impedance of a capacitor seems to be wrong ?

Suppose you want to make a divider to divide an AC voltage in half. You can use 2 resistors to do that, but lets try with a resistor and a capacitor.
We have a sinusoidal AC voltage of 10Vpp (peak to peak) with a frequency of 1kHz and we want to divide this to a 5Vpp using a resistor and a capacitor. Further not important, but the AC sinusoidal voltage is symmetrical, so the amplitude ranges from +5V to -5V, giving the 10Vpp.
Check out the circuit. What is the value for C1 to divide V1 by 2, resulting in 5Vpp over C1 ?

See figure: 4a_How can it be AC divider

I guess the impedance of C1 should have the same value as R1, so we get a divider by 2. So we need to calculate the capacitance that will result in an impedance of 1K at the given frequency of 1kHz. We use the impedance formula for a capacitor : Zc (impedance) =Ā  1 / (2 * pi * C * freq) = 1kOhm. Simple, right ?
SoĀ  C = 1 / (1kOhm * 2 * pi * 1kHz) = 159.2nF. Done !
So lets build the circuit and check the voltage over C1 with an oscilloscope to see it if is the expected 5Vpp (for C1, we take a 120nF in parallel with a 39nF capacitor to get ca. 159nF).
But with the oscilloscope we don't measure the expected 5Vpp but more like 7V. Is the formula wrong ?

See figure: 4b_How can it be AC divider vector sum

Where did we go wrong ?
We forgot that a capacitor also causes a phase difference. So we can not just add resistance R1 to impedance of C1 to get the total impedance. This is because the voltage over C1 is not in phase with the voltage over R1. When adding up these voltages, you will not get the same result as when the voltages would be in phase.Ā  Because of this phase difference, we need to treat the resistance and reactance (impedance of the capacitor) as vectors that haveĀ  an angleĀ  between them (the phase difference). To sum up vectors, taking their phase relation into account, we need to use the vector sum (Pythagoras). See the vector diagram.You also see that when you sum up the reactance of 1K to the resistance of 1K, you don't get a total of 2K, but 1.41K.
This is why the divider that we have build will not give you half of the input voltage = 5Vpp but 7Vpp.
Lesson learned ?
When dealing with capacitors or inductors, you need to take into account that these components introduce a phase shift. Due to the phase shift, simply adding up voltages or currents will give you wrong results.

5) Multi-meter gives wrong voltage readings ?

You are using your multi meter to measure an AC signal of which you don't know the waveform and you don't know the frequency. All you know is that the frequency of the AC signal must be in the range of 100Hz to 10kHz. The multi meter is a true RMS meter and you use the measurement to find out how the circuit works, because you don't know exactly how it works and what kind of signals you will encounter in the circuit.

See figure: 5_How can it be RMS measurement

Where did we go wrong ?
If you want to investigate a circuit of which you are not sure what kind of wave forms you will be measuring you have a very high chance of misinterpreting the signals. The best thing to do is use an oscilloscope to investigate the circuit. Why ?
When using a true RMS multi meter to measure AC voltages you are not measuring the peak voltage or the average voltage of the AC signal, but the heating capacity of the signal. The heating capacity is the DC voltage that would generate the same heat in a resistor. Difficult to understand, but it is essential to know the wave form shape when you want to interpret the true RMS AC measurement of your multi meter. The simplest is when the AC wave form that you are measuring is a perfect sine wave. In that case the RMS value will be the peak voltage divided by the square root of 2. But when the sine wave is heavily distorted or when the AC wave form is a triangular or square wave, the AC measurement will give totally different results.
See the 3 graphs, where you see the AC RMS measurement for 3 different wave forms that all have the same amplitude.
You can clearly see that the triangular wave has the lowest heat capacity (lowest RMS value), followed by the sine and the square wave. This makes sense if you look at the heat capacity being proportional to the surface under the wave form envelope.

Note:
When changing the symmetry of any of the signals, you get complete different AC RMS measurement results:
A 1kHz square wave with an amplitude of 10Vpp and:
Ā * 50% duty cycle, results in an RMS value of 5.V.
Ā * 10% and 90% duty cycle, both give an RMS value of 3V !
If you wonder why a square wave with 10% or 90% duty cycle both give the same RMS value, then again think of it as the sum of the surface area covered by the positive and negative going wave. The sum will be the same for a 10% or a 90% duty cycle waveform.
Lesson learned ?
Always use an oscilloscope to check a circuit of which you are not sure what signals or what wave forms to expect. With an oscilloscope you see the DC offset, the AC amplitude and the wave form shape all at once. With an oscilloscope you can also detect artifacts in the signal that you will never discover with a multi meter. A multi meter is fine to verify DC voltages and pure sine AC signals with a limited frequency (< 500kHz for a good multi meter, < 1kHz for a cheap multi meter).

6) Multi-meter gives inaccurate current readings ?

You want to measure the current that flows through a circuit using a multi meter. First you calculate the current that you expect and then you measure the current with a multi meter. To your surprise the measurement is a bit off from what you expected. It is not much but why ?

See figure: 6_How can it be current measurement

Where did we go wrong ?
When you insert a multi meter into a circuit to measure the current that flows in that part of the circuit, you have to take into account that the multi meter has an internal resistance that is not zero. The internal resistance of a good multi-meter is fairly small, but it is not zero. So by measuring current, you add an extra resistance into the circuit. Due to the current that is flowing there will be a voltage drop over the multi-meter. This extra voltage drop causes a lower current in the circuit and thus creates a measurement error. The extra voltage drop is called "burden voltage".
In the circuit i show the difference between the circuit without the multi meter (or any other current measurement device) inserted (left picture) and the circuit with the multi meter inserted (right picture).In the left picture, you see that the current through the circuit will be = (10V / R1) = 10V / 10 Ohm = 1A.In the right picture, a current meter is inserted into the circuit. This current meter has an internal resistance of 0.1 Ohm. Because this internal resistance is pretty small, it results in a pretty small error of the current measurement. The burden voltage caused by the current flowing through the extra 0.1 Ohm internal resistance of the current meter is 0.099V.All in all not too bad. But when you are measuring higher current or your meter has a higher internal resistance, the measurement errors can be significant. There are circuits where a certain current has to be calibrated accurately. In those situations it is important to realize that you will have a measurement error when inserting a meter into the circuit.
Lesson learned ?
Every multi meter has a burden voltage that causes a measurement error. Usually this error is small enough to be neglected, but there are situations in which you need to be able to do precise current measurements. A clamp current meter allows to measure current without inserting the meter into the circuit, but the clamp meters are designed to measure pretty high currents and are not as accurate as multi-meters with a limited current measuring ability.

7) Transistor can not switch faster than 400kHz, while the datasheet says it should easily be able to handle over 100MHz ?

You build a simple transistor circuit that uses a transistor as a switch. The switch is controlled by a 5V digital output f.e. coming from an Arduino. This digital signal is a square wave with a duty cycle of 50% and a frequency of 500kHz. That should be a walk in the park for the transistor that can handle frequencies over 100 MHz easily.Ā 
You build the circuit shown below and you measure the output. To your surprise the output is constant high so our transistor does not switch at all. How can it be ? The input signal surely is high enough to generate enough base current and the transistor is fast enough to handle 500kHz !
In the picture below you also see the output waveforms for different frequencies of the input signal.

See figure: 7a_How can it be transistor as a switch

Where did we go wrong ?
When you decrease the frequency to 100kHz, you will see that the transistor does work and the output will switch between 0 and 12V, but you will see that even at 100kHz the transistor is not 100% following the input signal. The thing is that you are driving the transistor into saturation. When a transistor is driven into saturation, it becomes slow, because it can not get rid of the build up charge in the junction regions fast enough. In saturation both the base-emitter junction (ca. 0.6V) and the base-collector junction (ca. 0.3V) are forward biased (positive voltage difference). The collector-emitter voltage will be ca. 0.3V. Because both junctions are forward biased, the charge that is build up on both these junctions needs to be drained away when the transistor is cut-off. When this charge can not be removed fast enough, the transistor stays active (conducting), even though the base current was removed to cut off the transistor.
When the input is a 5V square wave with a duty cycle of 50% (symmetrical square wave), then an input frequency of:
  • 100kHz gives an output with a duty cycle of 32%. This means that the transistor is already struggling to follow the input.
  • 150kHz gives an output with a duty cycle of 27%
  • 200kHz gives an output with a duty cycle of 20%
  • 250kHz gives an output with a duty cycle of 10%
  • 300kHz gives an output with a duty cycle of 6%
  • 350kHz gives an output with a duty cycle of 2%
  • 400kHz gives an output with a duty cycle of 0%. This means that the transistor is not cut off anymore, thus stays active.
Lesson learned ?
Pay attention that bipolar transistors are slowed down when driving them into saturation. To prevent saturation, there is method called the "Baker clamp" by adding a Schottky diode between the collector and base of the transistor with the anode connected to the base as shown below. The Schottky diode clamps the base-emitter voltage of the transistor to maximum ca. 0.6V + 0.3V of the collector-emitter junction of the transistor + 0.3V voltage drop over the Schottky diode. This way the transistor is not driven deep into saturation. This will increase the speed of the transistor.
When you need a fast active switch, it is best to use a MOSFET instead. These can switch faster with less power dissipation, with or without the use of a high frequency gate driver.

See figure: 7b_How can it be transistor as a switch baker clamp

8) Diode does not rectify ?

You want to rectify a square waveĀ  signal with a frequency of 100kHz, a duty cycle of 50% and an amplitude of 10Vpp (+5V to -5V).
You build the simple circuit that is shown below with a 1N4007 diode. Of course the 1N4007 is overkill for this application, but i choose this diode because it is ideal to show the problem that we are discussing.
You check the output of the circuit with an oscilloscope and to your surprise you see that the diode does not completely remove the negative going part of the square wave. You still see a negative going part, while you expect the diode to rectify the signal so only the positive going part appears at the output.
In the picture below you see the circuit and the input/output waveform.

See figure: 8_How can it be diode not rectifying

Where did we go wrong ?
When you need to rectify high frequency signals, you need to check the reverse recovery time of the diode that you are using. The reverse recovery time is the time that the diode needs to switch from conducting to cut-off when the voltage is reversed suddenly. The 1N4007 needs about 3us to switch from conducting to cut-off, so it is a relative slow diode. The 1N4148 has a reverse recovery time of 4ns, so it is a very fast diode. This is because it is a low power diode that stores a small amount of charge when conducting. So to stop conducting, it only has to bleed off little charge.
Lesson learned ?
Most common high power diodes are not infinitely fast and need time (microseconds) to turn off. For fast switching power applications, special fast recovery diodes are designed with reverse recovery times in the range of tens of nanoseconds to hundreds of nanoseconds.

9) Simple diode does not work ?

You build a rectifier circuit with a silicium diode and want to rectify a sine signal that is alternating between 0V and 0.4V with a frequency of 100Hz.
When checking the output of the circuit, you see that the output is dead, no rectified sine signal at all. What is wrong ?

See figure: 9_How can it be diode not rectifying small signal

Where did we go wrong ?
The circuit does not work because the input voltage is too low. A common diode has a forward voltage of ca. 0.7V.Ā  A Schottky diode has a forward voltage of ca. 0.3V. The input signal has to be higher than the forward voltage of the diode to make the diode conduct. When the input signal is lower than the forward voltage of the diode, the diode will not conduct at all and the output will stay 0V.
Lesson learned ?
Always check that the signal levels exceed the diode voltage drop when you want to rectify a signal.
When you need a rectifier that does not have this voltage drop problem, you can use a precision rectifier based on an OPAMP.

10) Oscilloscope creates a short-circuit ?

This is a mistake that is often made. You want to measure a voltage over a component in a circuit, but none of the terminals of the component is connected to ground. So have have to put the ground clip of your oscilloscope probe to a point that carries a voltage. So you connect the ground clip to that point and BANG, smoke and the circuit is dead. What happened ?

Where did we go wrong ?
The ground clip of your oscilloscope probe is directly connected to the chassis of the oscilloscope and the chassis is directly connected to protective earth. If you want to do a differential measurement in a circuit with a scope probe, you need to make sure that your circuit ground is not connected to protective earth. Otherwise you will make a short circuit in your circuit that can either damage your circuit or even damage your scope when the circuit can deliver enough current.
See the picture below for a situation where the scope will create a short-circuitĀ  by connecting the ground clip to the +12V supply of a circuit that is referenced to ground and to the protective earth. The ground clip will short-circuit the +12V.
When the circuit is referenced to a reference ground that is not connected to protective earth, you can connect the ground clip to the +12V supply of the circuit and measure the voltage over R1 this way. When f.e. the +12V comes from a battery, so the ground of the circuit is floating, then there is no problem.

See figure: 10_How can it be Oscilloscope short circuit

Some people use a power cord for the oscilloscope in which they have cut the protective earth wire, so the chassis and ground clip of your probe are floating and you can do differential measurements with the scope without the risk of short circuiting. Don't do this unless you know exactly what you are doing, because you are creating a very dangerous and even lethal situation when measuring high voltages or the mains voltage. When you connect the probe clip to a high voltage or mains voltage, the whole chassis including the metal BNC connectors of your scope probe will be at this high voltage. Very dangerous when you don't realize that this is a consequence of cutting the protective earth of your scope !
Lesson learned ?
The only good way to prevent that the ground clip of your oscilloscope can make a short-circuit when you connect the ground clip to a point that carries a voltage is to make sure that your circuit is floating. f.e. by powering the circuit from a battery or by using an isolation transformer.
Another method is to use 2 oscilloscope probes and use the mathematics function on your scope to subtract both measurements from each other to find out the voltage that is between the 2 probes. This can never cause a short circuit because the ground clips are connected to the ground of the circuit and the probe tips are connected to the points that carry a voltage.
The best solution is to use a differential probe, but these are generally quite expensive.

11) Circuit does not work on breadboard ?

See figure: 11_Breadboard

I use breadboards a lot to test designs or to investigate circuit blocks. But not all circuits are suitable to implement on a breadboard.
Circuits involving high frequencies (> 10 MHz) f.e. do not behave well on a breadboard, because of all the parasitic capacitance (ca. 3pF between the short contact strips and > 25pF between the long supply strips) and extra inductance (f.e. ca. 1uH of the long power supply strips) that you introduce using a breadboard.
Note that a capacitance of 1pF represents a reactance (impedance) of roughly 16 k Ohm at 10 MHz and that an inductance of 1uH represents a reactance (impedance) of roughly 63 Ohm at 10 MHz. So although these values sound rather insignificant, while they are at DC and at low frequencies, they will cause degradation for high frequency signals and signals with very steep edges (rise and fall times in the nanosecond or microsecond range).
This degradation can be seen as slowed down edges that can cause timing issues or over/undershoots caused by inductance (ringing, inductive kickback, oscillation, ground bouncing). All these effects can cause unpredictable or erratic behavior of the circuit.
Another drawback of breadboards: With digital circuits you need to put the power supply bypass or filter capacitors as close as possible to the power supply and ground pins of the chip to make sure that the switching noise is filtered out maximum. On a breadboard you also need to make sure that you use the shortest distance between the power supply filter/bypass capacitor and the power supply and ground pin of the chip. If you use long wires to connect filter capacitors further away from the chip, the switching noise of the chip can affect another chip that is using the same power supply rail, causing all kind of weird behavior.
When you are testing high power (> 1A) , high frequency (> 10 MHz) oscillator circuits, fast switching MOSFET circuits, switch mode converter circuits with high peak currents and steep sloped square wave signals, i would advice strongly against a breadboard and to build this on a copper clad board, keeping all the connections as short as possible and using the right wire size/type for the job.
The cheap breadboard jumper wires with the small pins at each end of the wire will introduce voltage drops when higher currents (> 1A) are passing through these wires. I don't use these small jumper wires but i just use plain wires with a solid core (not stranded), with a a core diameter of 0.6 mm. I cut and strip them to the lengths that i need. Use the shortest length to make the connection on the breadboard.
Furthermore there is a big quality difference between breadboards.Ā  The shape, flexibility and plating of the contacts in the breadboard determines the quality of the contact over time. I have seen breadboards where the contacts were of such poor quality that the circuit was not working reliably because of bad contacts. So don't buy the cheapest Chinese ones that you can find when you plan to use the breadboard regularly.

12) LED's of the same type have different light intensities ?

When connecting multiple LED's of the same type in parallel, you need to provide a series resistor for each individual LED if you want the LED's to output the same intensity. When connecting different types of LED's in parallel, then providing individual series resistors is a must, because otherwise some of the LED's will give no light output at all.
Why is this ?

See figure: 12_How can it be LEDs

Where did we go wrong ?
The forward voltage of a LED's of the same type is not perfectly the same and depends on the current that flows through the LED. When you connect multiple LED's in parallel, the current will not divide equally over the LED's, causing difference in intensity.
To prevent this problem, each LED has to have his own current limiting resistor as shown in right circuit above. The fact that each LED has its own current limiting resistor means that the LED's can not influence each other due to forward voltage differences anymore. So the current will be more equally divided over each of the LED's and the intensity difference of the LED's will be minimized.
Lesson learned ?
Never put LEDs in parallel directly, but add a current limiting resistor for each LED to make sure that the LEDs will all have the same intensity.

13) One after the other low power MOSFET does not work ?

See figure: 13a_BS170 MOSFET
See figure: 13b_ESD damage


When handling MOSFET's and especially the low power MOSFET's such as f.e. the BS170 or 2N7000, care should be taken to prevent or minimize ESD (electrostatic discharge). These devices are very sensitive to ESD, so use precautions to prevent that you carry charge that can discharge onto the gate of the MOSFET. When a discharge happens on the MOSFET before it is assembled into a circuit, the chance is very high that the device will not work at all anymore or shows some unstable behavior until it eventually dies. An ESD wrist strap is ideal to prevent ESD from occurring or you can touch a protective earth connection to discharge yourself before you start handling MOSFET devices.
Once the device is assembled on a PCB, the chance of damaging the MOSFET is lower since the discharge can take different routes to ground, but there is no guarantee. ESD events might damage a component in a way that it can still work, but it will degrade over time and will die or start malfunctioning long before the normal lifetime has passed.

14) Digital circuit behaves strange and does not give the expected result ?

See figure: 14_EMC black magic

For digital circuit is is essential to keep the power supply distribution to all the chips clean and noise-free. When a digital chip is switching its outputs fast between 0 and 5V it will source or sink current to the next chip. This current is drawn from the power supply of the chip. So the power supply pin of the chip will be very noisy and contains all kinds of spikes from all the switching that happens inside the chip. When this noise is not filtered out from the power supply distribution, the next chip that will use this same noisy power supply will get be disturbed by all the glitches and spikes that are present on the power supply.Ā  The power supply is used as a reference for internal voltage of the chip, so this voltage should be as clean as possible to prevent false triggers or false low and high thresholds for the switching between low and high.
To filter the power supply, there are some rules of thumb that are used for digital circuits. Each chip should have a 100nF capacitor as close as possible between the power supply pin and the ground pin. The connections to this 100nF capacitor should be as short as possible. For every 4 digital chips, put a 10 uF capacitor and if you are using less than 4 digital chips, place one 10uF between the power supply and ground rail anyways. When high frequencies are involved (> 20 MHz) you can even put an extra 10nF parallel to the 100nF to have even better power supply filtering over a broad range of frequencies.

15) OPAMP does not amplify according to the gain that is set by the resistors ?

You've build f.e. an inverting amplifier with a gain of 100 using the good old LM324.
You want to amplify a small signal with an amplitude of 50mVpp (+25mV to -25mV) with a frequency of 60kHz. So you build the circuit shown below and you measure the output that should be 50mVpp x 100 = 5Vpp. But to your surprise you measure ca. 500mVpp, so 10 times less. You check resistors R2 and R1 that set the gain of 100 and they have the correct values. What is wrong ?

See figure: 15_How can it be OPAMP gain

Where did we go wrong ?
You forgot about the gain-bandwidth product of the OPAMP that determines what the maximum bandwidth of the OPAMP is at a certain gain or that determines what the maximum gain is at a certain frequency. So there is a trade-off between the gain and the maximum frequency of the OPAMP. The LM324 is not the fastest OPAMP and the datasheet specifies a gain-bandwidth product of 1.2MHz. What this tells us is that the gain of the LM324 can not be higher than 1 at a frequency of 1.2MHz.
In the circuit above we want to achieve a gain of 100, so theoretically the maximum frequency we can use is
1.2MHz / 100 = 12kHz.
I did some tests with the circuit above and found the following:AtĀ  1kHz the gain of the circuit is ca. 100x (so for this frequency the circuit generates the gain that we have set).At 10kHz the gain of the circuit is ca.Ā  50x (so half the gain we have set).At 15kHz the gain of the circuit is ca.Ā  40xAt 30kHz the gain of the circuit is ca.Ā  25xAt 60kHz the gain of the circuit is only 10x (so 10 times less than the gain we have set).
Lesson learned ?
When you want to achieve high gain, you certainly have to check the gain-bandwidth product to select an OPAMP that is fast enough to provide that gain at the desired frequency range.
When high gain is necessary, it is good practice to divide the gain over multiple amplifier stages. So f.e. when you want to get a gain of 100x, you can use 3 amplifier stages: one of 5x, one of 5x and one of 4x. This gives a total gain of 100x while the individual amplifiers only have to generate a relatively low gain. This also improves noise, offset and voltage drops due to the input bias current of the OPAMP, since you can use lower value resistors.

16) OPAMP configured as a voltage follower does not work ?

You've build a voltage follower with a UA741 that is powered by a single supply voltage of +10V. You connect the input to 0V to see if the follower works and you measure 1.8V at the output. Huh ? Why the voltage follower does not do what it should do: follow ?

See figure: 16_How can it be OPAMP voltage follower

Where did we go wrong ?
When you operate an OPAMP from a single supply, then first of all check the datasheet to find out if the OPAMP is able to work from a single supply. The UA741 is not specified for single supply operation, but for a dual (symmetrical) supply. Still you can use a UA741 on a single supply of at least 10V.
But when doing so, you need to check the common mode input range and the output voltage range to see if the input range reaches down to ground and/or the power supply rail voltage and if the output voltage also can swing all the way to ground and/or the power supply rail.
With the UA741, the common mode input range is specified as typically +/- 13V when using a power supply of +/-15V. The output voltage swing is specified as +/-14V with a power supply of +/-15V and when using a small load at the output. This means that the output will never be able to either reach ground or the positive supply voltage.
When the input range is limited to ca. 2V from ground and from the positive supply voltage (difference between +/-13V and+/-15V) and the output can swing to ca. 1V from ground and from the positive supply voltage (difference between +/-14V and +/-15V), then the minimum output voltage will be determined by the minimum input voltage, which is ca. 2V.
That is why we measure 2V at the output of the voltage follower OPAMP while the input is connected to ground. The OPAMP output simply can not get lower due to limitations inside the OPAMP related to the input and output circuits of the OPAMP.
Lesson learned ?
When operating an OPAMP from a single supply and your design required the OPAMP output to swing close to ground or the positive supply rail, then first check the datasheet of the OPAMP to see if it is suited for single supply operation, check the input common mode range to see what the voltage span of the input is and check the output voltage swing (range) to see if the output will be able to follow the input and if this range is what you need.
You can chose for a RRIO (rail to rail input output) OPAMP because these are designed so the inputs and output can swing over the full supply voltage virtually from 0V to Vcc.

17) Zener voltage reference does not work ?
Ā 
You made a zener voltage reference as shown in the schematic below. The zener is buffered by a emitter follower and the input voltage is +9V. You expect and output voltage that is equal to the voltage over the zenerdiode ZD1 (=ca. 5V6) minus the voltage drop of the base-emitter junction of Q1 (=0.7V), so ca. 4.9V. You measure the output voltage over R1 and all you get is 0V ! Why ?

See figure: 17_How can it be Zener voltage reference
Ā 
Where did we go wrong ?
The problem with the circuit is that there is no current flowing through the zener diode. Without any current, the zener diode is not able to do it's work. With a current of 0mA, the voltage over the zener diode will be 0V and the output voltage of the circuit will be 0V. So we need to create a current path for the zener diode. But where do we take this current from ? From the output ? No, because the output can not deliver any current when the transistor is not conducting and the transistor is not conducting when the zener diode voltage is 0.
We need to create a current path for the zener diode from the +9V input voltage via a resistor. We need to chose the resistor value so the current through the zener diode is not too high, because that would either damage the zener diode or heat the zener diode up causing extra temperature drift. The current also shouldn't be too low, because then the zener diode voltage will be too low. For a common low power zener diode, a current of 5 to 10mA.
So a resistor of (9V - 5V6) / 10mA = 3V4/10mA = 340 Ohm connected to +9V and to the cathode (top) of the zener diode will make the circuit work, getting 4.9V at the output.
Lesson learned ?
Always check that you have a close current path through components, so a forward and return current can flow through the component. Otherwise the component will be "floating" and disconnected from the circuit. You could just as well remove the component.

18) Transistor buffer for AC signals does not work ?

You designed a single transistor buffer for AC signals powered with a +9V DC voltage and with input and output capacitor so only the AC content of the signal is passed and the DC content is blocked. But there is a problem with the circuit, because when applying an 1kHz sine input signal with an amplitude of 1Vpeak and 0V DC offset, the output is not a sine at all. It looks more like a clipped sine of which the negative part is removed and the remaining part has an amplitude of 0.3Vpeak. What is wrong ?

See figure: 18_How can it be Transistor AC buffer

Where did we go wrong ?
When we take a closer look at the circuit, we see that the base of Q1 is not biased properly. There is only a resistor R1 to ground, so that means that without an input signal, the base voltage of Q1 will be 0V and the output will also be 0V. The transistor Q1 can ony conduct when the base voltage exceeds 0.7V. So when we apply an input signal of +1V, the transistor will conduct and the output voltage will be +1V - [base-emitter voltage drop of Q1] = +1V - 0.7V = 0.3V. When the input signal is 0V or below, the transistor will not conduct and the output will be 0V. That is why the output shows these 0.3Vpeak bumps, which are the parts of the input signal for which the transistor conducts. The other parts of the input signal areĀ  cut off by the transistor.
When we want to fix this problem, we will need to bias the base of Q1 with a DC voltage that is high enough so the transistor conducts over the whole range of the input signal. The base voltage should be at least 2V above signal ground, so the 2Vpp input signal can be passed without distortion. In this case, usually the base of Q1 is biased at half the power supply voltage, in this case 9V/2 = 4V5 to provide enough headroom. We need to add a resistor of 4k7 from the base of Q1 to +9V power supply to get a base bias of 4V5. With this extra resistor the input signal is passed completely without distortion and the output will be a copy of the input signal.
Lesson learned ?
When designing an amplifier or in our case a buffer using one of more transistors, it is essential to check the biasing of the transistor(s) to see if the input signal can travel through the amplifier or buffer without being clipped due to lack of headroom towards the supply rail voltage or ground.

19) Transistor 5V to 3V level converter works but has a design issue ?

You design a 5V to 3V level converter for 5V digital signals using 2 transistors. The transistors in the circuit are used as switches and are driven into saturation. Because the transistors are driven into saturation, they will switch on fast but switching off rather slow, causing delays of the falling edges of the output signal. To prevent this we need to speed up the circuit. This is accomplished by adding C1 over the base resistor of Q2. R1 and C1 form a differentiator that gives an extra current boost to the base of Q2 at the moment that the input signal changes from a rising to a falling or from a falling to a rising edge. This extra current boost speeds up the switching on and off of both transistors, thereby preventing delays.

See figure: 19_How can it be Transistor 5V to 3V level converter

Where did we go wrong ?
The circuit seems to work regardless of the design issue that is present in this circuit. This is due to the fact that the currents in the circuit are limited so they don't cause damage.
The issue is that when Q2 conducts, it will pull the base of Q1 directly to ground, while the emitter of Q1 is connected to +3V3. So the base emitter junction of Q1, which is in fact a diode, gets connected directly from +3V3 to ground without any current limiting resistor. This is almost like a short-circuit.
We are lucky that the base resistor R1 of Q2 has a rather high value, so the collector-emitter current of Q2, and thus the emitter-base current of Q1 gets limited to values that are still within the specification of both transistors. Otherwise one or both transistors would get damaged.
To solve this design issue, we need to add a base resistor for Q1 so the base current of Q1 is limited when Q2 is conducting.
Lesson learned ?
When designing circuits it is important to check if the currents that flow in the circuit are limited in all possible operating states of the circuit so the specified maximum current or power of the individual components is not exceeded.

20) Digital delay circuit does not work as expected ?

You constructed a circuit around a 74HC00 quad 2-input NAND high speed CMOS chip that delays a 5V digital input signal using an RC network formed by R1 and C1 in the schematic below. When checking the output signal, you see that the input signal is indeed delayed.
When taking a closer look at the output signal and zooming in on the rising and falling edges of the output signal, it appears that both edges are not the clean slopes that you expected.Ā  Instead, the rising and falling edges are jittering over a time period of about 3 to 5us.
How can this be ?
Ā 
See figure: 20_How can it be TTL NANDs with RC

Where did we go wrong ?
When we replace C1 with a larger capacitor, f.e. 1uF, we see that the delay between the output and input signal increases as expected (10x larger), but also the time period over which the jitter appears at the rising and falling edges increases with a factor ca. 10x. So the duration of the jitter seems to be related to the delay that is caused by the RC network. The bigger C1, the smaller the slopes of the rising and falling edges of signal B, meaning they become "slower". This means that the signal is taking more time to go through the input range of the second NAND. When we check the datasheet of the 74HC00, we see that the High-level Input Voltage with a 5V supply is somewhere around 3.15V and the Low-level Input Voltage with a 5V supply is somewhere around 1.3V (depending on manufacturer and temperature range). But what happens when the input signal B of the second NAND is somewhere in between the low (1.3V) and high (3.15V) input voltage level ? We don't know ! It is not specified, so we are in the twilight zone that is quite broad (3.15V - 1.3V = 1.85V). That is why we see the jitter in the output when signal B at the input of the second NAND is rising or falling through the twilight zone of the input. The slower the signal rises or falls through the undefined zone, the longer the duration of the jitter will be. When we replace C1 with a 1uF capacitor (10x bigger), the jitter duration will be 10x longer.
To get rid of the jitter in the output signal at the rising and falling edges, we need to use Schmitt trigger NANDs. F.e. the 74HC132 is the quad 2-input NANDĀ  Schmitt trigger version of the 74HC00. The inputs of a Schmitt trigger NAND don't have an undefined zone but have a ca. 0.7V hysteresis: When both inputs are above ca. 2.3V, the output will go low (it's a NAND not an AND) and when both inputs are below ca. 1.6V, the output will go high. So no undefined input zone and no jitter anymore.
Ā Lesson learned ?
When designing circuits with digital logic chips it is crucial to take a good look at the output and input voltage levels especially when different kinds of chips (HC, HCT, LS...) are combined.
When using digital logic chips with signals that have fast rising and falling edges, the above problem does not occur, but when the rising and falling edges are slow this can cause problems with chips that don't have Schmitt trigger inputs. Often you don't notice these problems because you really have to zoom in on the edges to see the jitter.Ā  But when a jittering signal is used as a clock input for f.e. a counter, this will lead to big surprises.

21) OPAMP voltage follower becomes an oscillator ?

You've build an OPAMP voltage follower that will function as a buffer. From the moment you connect a capacitive load (like f.e. a coax cable) to the output of the buffer, the output signal starts to show oscillations or some amount of ringing at the positive and negative edges of the output signal. Why is that ?

See figure: 21_How can it be OPAMP follower capacitve load

Where did we go wrong ?
OPAMPS don't like capacitive loads on their output. Simply said: the output impedance of the OPAMP, which is the output resistance, forms an RC network with the capacitive load (C1 in the circuit above). This RC network causes a delay (phase shift). Because the RC network is inside the feedback loop (feedback is taken from the node formed by the OPAMP output and the capacitor C1), the feedback loop gets an extra phase shift. This extra phase shift comes on top of the phase shift that is already there because most of the OPAMPs have an internal compensation to improve stability. The extra phase shift reduces the phase margin, which leads to instability (oscillations). The phase margin is the amount of phase shift that is present for a gain of 1. When the phase shift is 0 and the gain is 1, we create an oscillator due to the positive feedback.
With the TL082 in the circuit above, we see oscillations with a frequency around 280kHz and with an amplitude of ca. 2Vpp while we are buffering a signal of 1Vpp.Ā  We chose for a voltage follower because this one allows the OPAMP to operate over its full bandwidth (GBP or GBWP = Gain Bandwidth Product = Gain x Bandwidth, so with gain=1, this gives us the maximum specified bandwidth)
How to solve this problem ? Well, there are several different solutions that will stop the oscillations. The simplest one is adding a series resistor of 10 to 100 Ohm (depending on the size of the capacitive load) between the output of the OPAMP and the capacitive load (C1). The feedback from the output to the inverting input is taken before this series resistance. This is called an out-of-loop compensation. There are a number of other compensation techniques, including in-loop compensation.
Lesson learned ?
Always keep an eye on stability when driving capacitive loads with an OPAMP. The capacitive load can be some length of wire or a coax cable. Adding a series resistor can cure the problem, but you still need to find out what value is required. A good check for stability is to use a function generator that outputs a square wave signal and connect this via a series resistor (to limit the current) to the OPAMP output. By banging on the door like this, you can see whether the output still has a tendency to oscillate. When you see damped oscillations on the output, you know that the OPAMP still doesn't have enough stability margin. In that case you can try to increase the value of the series resistance in between the output and the capacitive load and repeat the bang-on-the-door-test.

22) Transistor suddenly stops working ?

You want to drive a relais with a digital output of an Arduino. You designed a circuit that uses a transistor to switch the 12V relais and you connect the base of the transistor to the digital output of the Arduino. See the schematic below for the circuit.
While testing the circuit, it seems work at first, but then after a while the circuit stops working. What is wrong ?

See figure: 22_How can it be Transistor relais kickback

Where did we go wrong ?
Actually there are 2 problems with the circuit. First of all, the base of the transistor is connected directly to the digital output of the Arduino. When the digital output of the Arduino is set high (3V3 or 5V, because there are also Arduino versions that work with 3V3 voltage levels), this voltage will be directly over theĀ  base-emitter junction of the transistor. This junction is the same as a diode that conducts when the voltage over the diode reaches 0.7V. When putting 3V3 or 5V over this diode, the diode will form a short-circuit that short-circuits the digital output of the Arduino. The digital outputs of an Arduino can not drive a lot of current, so the digital output will survive this kind of abuse. To solve this first issue, we need to add a resistor in series with the base of transistor Q1. The value is not critical and limits the base current. For a 3V3 or a 5V Arduino, you can both use a resistor of >= 4k7.
Second, we are driving an inductive load with the transistor. A relais is an electromagnet and an electromagnet is a coil of wire around an iron core, thus an inductor. When the transistor Q1 is switched on, a current will flow through the relais coil and a magnetic field is build up. This magnetic field is used to mechanically move the relais contacts so they make electrical contact with each other. So far nothing wrong. The trouble starts when the transistor Q1 is switched off after being switched on. The magnetic field in the relais coil collapses when the transistor is switched off. This causes an inductive kickback voltage over the coil that is now floating since the transistor is switched off. So all the energy that was stored in the magnetic field suddenly escapes in the form of a high voltage at the floating end of the coil. This kickback voltage greatly exceeds the power supply voltage and is so high that it will damage the transistor for sure, because it will exceed the absolute maximum collector-emitter voltage of the transistor by far. The transistor might survive for a while though, but will definitely die in the end.
This problem can be solved by adding a diode, a snubber RC-network or a zener diode over the relais coil so this inductive kickback energy is immediately consumed before the voltage can become too high for the transistor to survive. Typically a diode is connected with the anode to the collector of Q1 and the cathode to the +12V power supply.
Lesson learned ?
When switching inductive loads, make sure that the kickback energy of the coil can be dissipated somehow. When it is not dissipated, it will lead to very high voltages that will damage the switching element (transistor, FET, SCR, Triac ...). Even when the switching element is a mechanical switch, the switch contacts will degrade over time due to arcing-over when the switch is opened after being closed.

23) Relais does not work ?
You've built the circuit below to control a 12V relais with an Arduino using a transistor configured as an emitter follower.Ā  The emitter follower is connected to a +12V power supply voltage so the relais gets the right voltage. The base of the emitter follower is connected to a digital output of the Arduino.
But when you test the circuit and set the digital output high, the relais does not switch. What is wrong ?

See figure: 23_How can it be Emitter follower relais

Where did we go wrong ?
The transistor Q1 is connected as an emitter follower/buffer. This means the emitter of Q1 will "follow" the voltage at the base of Q1 minus the 0.7V voltage drop of the base-emitter junction diode. So when the digital output of the Arduino is high and has a voltage of 5V or 3V3 (there are Arduino versions that work with 3V3 voltage levels), the emitter of Q1 will have a voltage of (5V - 0.7V) = 4.3V or (3V3 - 0.7V) = 2V6 . The relais is connected to the emitter of Q1 and needs 12V to be able to work. So the relais will definitely not work when it gets 4.3V or 2V6. How can this be solved ?Ā  A buffer or emitter follower is not the right solution in this case. We need to configure the transistor as a switch (in a common emitter configuration) by connecting the emitter to ground and connecting the relais between the collector and +12V. Don't forget to put a diode over the relais coil to absorb the energy of the inductive kickback, so the transistor survives the high voltage kicks when switching off after being switched on.
Lesson learned ?
Always check if the voltage levels in your circuit are suitable for what you want to do. When you use transistors, check the configuration of the transistor and the characteristics of this configuration. Each configuration (emitter-follower = common collector, common base and common emitter) has it's own special characteristics.

24) Capacitive dropper kills LED ?

You've designed a minimalist capacitive dropper (which i don't recommend, but this is just a hypothetical case. So don't try this at home !)Ā  to light a common red LED directly from the mains voltage.
In Europe, the RMS value of the mains voltage is 230V with a frequency of 50Hz. The peakĀ  voltage = RMS voltage * square root (2) =Ā  ca. 325Vpeak.
The mains voltage swings between +325V and -325V, so twice the peak voltage. But the LED only conductsĀ  current when the mains voltage is positive. Only the positive part of the mains AC voltage is used. We want to limit the current through the LED to 10mA, which gives usĀ  enough light intensity.
With this information, we can calculate the required impedance for C1 = 1 /Ā  (2 * pi * 50Hz * C1) to get this 10mA current.
In the circuit below, the calculations are shown.Ā  You build the circuit with the calculated value for C1, butĀ  when you connect the circuit to the mains voltage, the LED only lights up very briefly and then never again. The LED got damaged. Why ?

See figure: 24_How can it be Capacitive dropper kills LED

Where did we go wrong ?
Because the LED only conducts current when the mains voltage is positive, we forgot to take care of what happens during the negative cycle of the mains voltage. The LED does not conduct during the negative cycle of the mains voltage,Ā  so no currentĀ  (or just a very small leakage current) will flow through the LED. This means that the full -325V peak voltage is over the LED.Ā  In other words: the LED gets a reverse voltage of ca. 325V (neglecting the voltage drop over C1 due to the reverse leakage current of 10 to 50uA of the LED).
Most standard common LEDs are specified for a reverse breakdown voltage of 5V. So the 325V reverse voltage that we allow over the LED during the negative half cycle of the mains AC voltage will surely cause damage to the LED.
How to solve this ? Putting a standard diode parallel to the LED, but in reverse compared to the LED, will solve this problem. This diode will limit the reverse voltage over the LED to 0.7V, so well within the 5V reverse breakdown voltage of the LED.
Lesson learned ?
When designing circuits powered by the mains AC voltage, be very careful and make sure that all currents, voltages and power dissipation are within the specifications of the used components. With the high voltages and currents involved when working with mains voltages, it is easy to make mistakes that can lead to dangerous situations: fire, electrocution, electric shock. So don't go into this unless you know what you are doing.

25) Using 12V signal on a digital input of an Arduino ?

You want to check the presence of a 12V level signal (or supply voltage) using a digital input of an Arduino. Of course you can not connect a 12V signal/supply directly to a digital input of an Arduino, so you figure out a circuit with a zener diode of 4V7 that will limit the 12V signal to a maximum of 4V7. We assume that you are using a 5V level Arduino (there are other Arduino versions that use 3V3 levels).
The circuit below is the result. Is it OK ?

See figure: 25a_How can it be Zener at digital input

Where did we go wrong ?
The circuit might and probably will work, but it surely is not recommended. When the switch SW1 is closed, all of the current will flow from +12V via R1 and the switch to ground. The voltage over the closed switch will be 0, so the anode of ZD1 is connected to 0V. The digital input of the Arduino will see 0V. What happens when the switch is opened ?
The zener diode ZD1 will work as a diode and not as a zener diode because it is connected in forward direction to the digital input of the Arduino. So ZD1 will only drop 0.7V and not 4V7.
Summarizing: when switch SW1 is open, +12V - 0.7V (drop over ZD1) = 11.3V is connected to the digital input of the Arduino via resistor R1 of 6k8. This resistor limits the current going into the digital input to a safe value. That is why the circuit still works, though the zener diode is not working. When the voltage level at the digital input exceeds the power supply voltage of the Arduino, the internal protection diode (the one connected between input and power supply) of the input will start conducting. This causes a high current flowing from the input to the power supply when no current limiting resistor is used in series with the input.
In the circuit below, a proper solution is shown, where the zener diode actually works and is limiting the voltage at the digital input of the Arduino.
Lesson learned ?
When working with digital inputs and especially when converting signal levels so they match the specifications of the digital input, take care that the level conversion is done properly and take precautions to limit the voltage and current going into the input to protect the input.

See figure: 25b_How can it be Zener at digital input solution

26) Triangle waveform generator outputs a distorted triangle wave ?

You've build a typical triangular waveform generator that consists of 2 OPAMPs of a LM324 quad general purpose OPAMP and that is powered by a single +15V power supply (see circuit below). OPAMP U1 is configured as a Schmitt trigger with a relative wide hysteresis that is defined by the value of resistors R2 and R1. OPAMP U2 is configured as an integrator with a time constant defined by the values of resistor R4 and capacitor C1. When the output of U1 is low, the output of OPAMP U2 will rise linear because U2 is an inverting integrator. When the output of U2 reaches the positive threshold of the Schmitt trigger, the output of the Schmitt trigger will go high. At that moment, the output of U2 will starts falling linear until the negative threshold of the Schmitt trigger is reached. When this negative threshold is reached, the output of the Schmitt trigger will become low again and the whole process repeats.
So normally we would have a nice linear triangular waveform at the output of U2. But when we check the output, we see this weird distorted triangular waveform as shown in the picture below. How can this be ??

See figure: 26_How can it be Triangular waveform distorted

Where did we go wrong ?
The circuit is correct, the component values are correct, the OPAMPs are working fine and still we see this distorted triangular waveform at the output. What can be wrong ? We are generating a very slow triangular waveform with a frequency of 0.365Hz, so the problem can not be related to slew rate or bandwidth of the OPAMP.
This is a rather unusual problem that hides in the type of component that we are using in the integrator around U2, namely the fact that we are using an MLCC (Multi Layer Ceramic capacitor) capacitor for C1.With ceramic capacitors, the capacitance changes with the applied voltage. The ratio: delta C / initial C is negative and increases with increasing voltage. This means that the higher the applied voltage over a ceramic capacitor, the lower its capacitance. This is exactly what the distortion of the triangular waveform tells us. The voltage over C1 alternates between a negative and a positive voltage. The ceramic capacitor C1 has no polarity, so for the capacitor it is just a voltage that increases and decreases, since the polarity can be ignored. When we look at the shape of the triangular waveform, we see that the slope of the triangular waveform at the output gets bigger when the output is nearing the maximum positive and negative voltage. This means that the frequency increases when the voltage over the capacitor C1 is increasing. And this proves that the capacitance decreases when the voltage over the capacitor increases.
Lesson learned ?
MLCC ceramic capacitors have a significant voltage dependency. Despite this dependency they can be used for power supply filtering or as a bypass capacitor where constant DC voltages are involved.
MLCC capacitors are not suited for use in situations where the voltage over the capacitor changes significantly as in our triangular waveform generator.
Be sure to use capacitors with a high quality stable dielectric in applications where linearity is important, f.e. in integrators, charge amplifiers, RC time constants, etc...

27) My freshly soldered PCB started smoking first time i powered it on ?

Where did we go wrong ?
When you power a circuit that you've soldered or bread-boarded for the first time, it is wise to use the current limiting feature of the power supply. What I mostly do is setting the required voltage for the circuit while the circuit is not connected. After setting the required voltage, set the current limit to 0mA, so the power supply goes into current limiting and the voltage becomes 0V. Then I connect the circuit and slowly increase the current by adjusting the current limiter. Normally you can roughly estimate the maximum current that the circuit will draw. When you are increasing the current and the current is exceeding what you think is a normal current for the circuit, then be careful.It is possible that there is a big capacitance that needs to be charged, so stop increasing the current limit when you have reached the expected current and wait for a while. If you see the voltage slowly increasing while you were not touching the current limiter, then you know that a capacitor had to charged.

  • If the voltage has reached the set voltage but the current keeps on increasing while you increase the current limit, then stop increasing the current limit at a value that can not damage the circuit: f.e. when your circuit only has a few low power OPAMPs, then stop at ca. 50mA. When your circuit has an Arduino, some relais and some sensors attached, then stop at ca. 100mA to 200mA depending. When your circuit has a switching converter you can stop at a current that is still safe for the switching element of the switching converter which can be several amperes. In other words, don't increase the current to values that will surely cause damage to chips in your circuit. After you stopped increasing the current limit, check carefully with your fingers if any of the components gets warm. While checking with your hand or fingers, you can increase the current slowly and you might be able to pin-point with your fingers which component is giving you trouble. But be careful because you can burn your finger when you increase the current too fast. A better tool is a thermal camera, but these are still quite expensive for hobby use, unless you buy one with limited resolution and speed.
  • If the voltage has reached the set voltage and the current stops increasing at a value that you expect while you are increase the current limit, then you know that everything is alright. You can set the current limit a bit higher than the current that the circuit draws, so it is protected next time you power it on after you did changes that might give problems.
Lesson learned ?
Always use the current limiter of your power supply when you are not sure about if the circuit you are powering is in good shape or when it is the first time you power on a circuit.
When you are testing mains powered switched-mode power supplies or mains powered circuits, then it is wise to use an isolation transformer combined with a variac, so you can slowly increase the AC input voltage for the switched-mode power supply while keeping an eye on the power consumption. The isolation transformer provides isolation from the mains so you can work more safely.

28) 78L05 current source does not work ?

You need a current source of 500uA and decide to build one using a 78L05 regulator. The 78L05 is a low power voltage regulator that tries to keep the voltage difference between the ground pin and the output pin at 5V.
But when we leave the ground pin floating and we connect a resistor between the output pin and the ground pin, we made ourselves a voltage to current converter.
This voltage to current converter will deliver a constant current to a load when the load resistance is low enough. Even when the load is a short circuit, the current source will not deliver more than the set current. When we need a 500uA output current, we simply connect a 10kOhm resistor between the output pin and the ground pin. We leave the ground pin floating and we connect the load to the "ground" pin that is now floating.Ā 
Check the figure for the circuit diagram.
The 78L05 regulator will try to maintain a difference of 5V between node 1 and node 2, thus over this 10k resistor (R1). BecauseĀ  the voltage over R1 will be constant 5V and the resistor value of 10k is a constant, the current Iout that flows through R1 must also be constant and can not be higher thanĀ  5V / 10k = 500uA. The current Iout that flows through R1 will also flow through R2 which is our load resistor.
So far for the theory.
You build this circuit on your breadboard and after powering the circuit with a +10V power supply, you measure the voltage over the load resistor R2 of 1k, because that will tell you how much current is flowing through R2. You expect a voltage of 500uA * 1kOhm = 0.5V (ten times smaller than the voltage over R1, which makes sense since R1 is 10x bigger than R2).
But to your surprise, you measure ca. 3V and not 0.5V. So the current is much higher than you expected. You check this with an ampere meter that you connect in between node 2 and R2, and yes, the current is not 500uA but ca. 3mA.
Wow, 6 times higher than expected !! How can this be ??

See figure: 27_How can it be 78L05 current source


Where did we go wrong ?
The principle of the current source is perfectly fine. But we forgot that we are dealing with a regulator that is not perfect. We stated that the current through R1 is the same as the current through R2. But what about the current that is flowing in or out of the ground pin. We neglected this current, but can we neglect it ?When we check the datasheet of the LM78L05 that we are using, we see that the quiescent current is specified as ca. 3mA.
This quiescent current is the current that goes into the regulator to enable it to do its work, but that does not flow out of the output. Instead it returns back to the power source via the ground pin. In other words, 3mA of current flows out of the ground pin of the regulator and into R2 to return back to the power source via reference ground. So even when we would remove R1, a current of 3mA will flow into R2 just because the regulator needs this current to be able to do its work.
This explains why we measured 3mA instead of 500uA, because the 3mA simply is the quiescent current that the regulator draws for its internal kitchen.
Our expected Iout current of 500uA is negligible compared to the massive 3mA quiescent current of 3mA that adds up to Iout at node 2, where they both flow into the load R2.
Here are some current measurements i did with this LM78L05 circuit using different values of R1:
Ā * R1 = 100 OhmĀ  Ā  => current through R2 = 53mA instead of the expected 50mA (5V / 100)
Ā * R1 = 500 OhmĀ  Ā  => current through R2 = 13mA instead of the expected 10mA (5V / 500)
Ā * R1 = 1k OhmĀ  Ā  Ā  => current through R2 =Ā  8mA instead of the expected 5mA (5V / 1k)
Ā * R1 = 10k OhmĀ  Ā  => current through R2 =Ā  3mA instead of the expected 500uA (5V / 10k)
Ā * R1 = 100k OhmĀ  => current through R2 =Ā  3mA instead of the expected 50uA (5V / 100k)
The current values are rounded off a bit, because the quiescent current varies with temperature, the input voltage and output current. But you see the extra ca. 3mA coming back in all the measurements.
Conclusion:
A LM78L05 or any other variant of this regulator is not suited to build a current source for low currents. You will have a 3mA current for free that you didn't ask for.

There is a solution for this problem though:
In the figure below you see how the problem is solved by using an OPAMP configured as a voltage follower. Now the quiescent current for the LM78L05 regulator is not added up to Iout, but is supplied by the OPAMP. Because the OPAMP is configured as a voltage follower it's output will have the same voltage as it's input, and for the regulator it is the same as being directly connected. The important difference is that the output current is now not affected by the quiescent current of the regulator, but only by the input bias current of the non-inverting input of the OPAMP. When using an OPAMP with JFET inputs, the input bias current will be in the nano-amperes and even in the pico-amperes range. In that case Iout will not be influenced by the OPAMP input bias current because it is magnitudes smaller than Iout.

See figure: 28_How can it be 78L05 current source solution

Lesson learned ?Ā 
When using a voltage regulator to build a constant current source, always check that the quiescent current of your regulator is way lower than the constant output current that you require. Otherwise the quiescent current, which is depending on temperature, input voltage and output current will be a substantial factor in the output current of the current source.