Digital Electronics Fundamentals

This is the first of a new series of tutorials, with hands on experiments, to learn the basics of digital electronics. We will go together from the very basics information and we will move on illustrating first the building blocks of the digital circuits, and then continue the discussion introducing circuits more complex, like flip-flops, couters, multiplexers, and much more.

In each episode of the series we will add a little theory to the pile and will showcase simple digital circuits that you can build for a hands on learning experience.

In this blog, as a start, we will go through some important definitions and then I will provide you all you need to build a device that we will use a lot in the future episodes of this series: the logic probe.

This series of tutorials will also be backed up by a corresponding video series available on YouTube. The following page provides the links to the YouTube Videos, as well as the link for the whole series, and the link to all the files involved in the tutorials, with schematics and anything else that might be needed:

https://eleneasy.com/digital-electronics-fundamentals-articles-and-video-archives/

What is Digital Electronics

Digital Electronics is that branch of Electronics that involves the use of circuits that are capable of dealing with only two voltages, as opposed to Analog Electronics that works on circuits that handle voltages in an infinite range.

An example of analog electronics is a classic FM radio, which works with radio waves and produces sounds made of a continuous signal that can assume any value within the limits of the power supply of the circuit.

An example of digital electronics is the CPU of a computer, that deals with signals that can assume only two values, usually named Low State and Hgh State, or Low and High for short.

Circuits in the analog world are made of resistors, capacitors, inductors, transistors, and so forth.

Circuits in the digital world are made of logic gates, also know as logic ports, which are basically made with transistors working in the saturation region, so that they can be only off or on, therefore delivering only two possible signals: low and high.

Besides the possibility of actually making logic ports with transistors, we normally use pre-made ports packed in integrated circuits.

And, finally, while we sometimes need to use complex mathematics to deal with analog circuits, in the digital world we use only Boolean operators, which behave very similarly to the arithmetic operators like plus and minus. This actually helps a lot, because it is much more simple to deal with digital circuits than it is with analog circuits. Well, of course this is more of a subjective statement. Somebody might disagree on that.

Families

For the most part, digital circuits are available in the form of integrated circuits.

There is in fact a great compatibility on this kind of components, although made by different manufacturers. The thing is that digital circuit and signals are standardized, so it is easy to mix and match components from different vendors to build a specific circuit.

There is one thing, though, that we need to be careful about.

We said that logic ports are made of transistors. But there are different type of transistors. In particular, we use the bipolar transistors (BJT) and the field effect transistors (MOSFET).

With the bipolar transistors we can build logic circuits usually named TTL, or Transistor-Transistor Logic. These circuits are essentially made of transistors and resistors.

With field effect transistors, we can use together n-channel and P-channel MOSFETs to create simple logic gates.

Because we mix together p- and n-channel MOSFETs, the technology used by these transistors is named C-MOS, or complementary MOS. For each port we use one n-MOS transistor and one p-MOS transistor. One is the complement of the other. No resistors involved.

Digital circuits that use these components are said to be part of two different families: the TTL family and the CMOS family.

Why there are two of them?

Well, the first digital circuits were RTL and DTL, now obsolete, followed by TTL. They used a lot of space on the chip dies because they had to implement also the resistors to correctly polarize the transistors in the saturation zone.

Once the MOS technology became easier to use, the CMOS logic ports were created. In these, the two transistors are usually connected one against the other, so that when one is on the other one is off. This eliminates the need of resistors, since the off transistors, when off, behave like infinite resistances. It also reduces drastically the power needed to make the circuits work. A CMOS circuit can easily consume between 1,000 and 1,000,000 times less power than the corresponding TTL circuit.

In addition, CMOS circuits use less space on the die, allowing putting more components than TTL circuits in the same space, as you can see from these pictures.

TTL gate
CMOS gate

There is a catch, though. CMOS devices are more difficult to handle because they are very sensitive to electrostatic discharges, and so they can break just by holding them in your hands.

In the simpler integrated circuits, there are protections in place on the die itself to limit the problem, but bigger devices, like CPUs, are very sensitive to electrostatic discharges, and so they need to be handled with extreme precaution.

In this series we will examine both TTL and CMOS technologies.

The TTL family is greatly used when there is a special need for speed, since the CMOS equivalents are slower, due to the intrinsic capacitance at the gate of the MOS transistors.

CMOS, however, use less space, and so their technology is preferred when building very complex devices, like a CPU.

And there is also a trend of building CMOS transistors smaller and smaller on the die. Smaller transistors have a smaller gate and, therefore a smaller capacitance, which leads to greater speed.

One last thing that differentiate the two families is the supply voltage.

The TTL family is usually limited to a supply voltage of +5V.

The CMOS family can be powered on a vast range of voltages, typically between 1.5V and 18V.

Logic States

Let’s now go back for a moment to the logic states.

We have already said that all digital devices work on two states only, the high state and the low state, and they are associated with the supply voltage and the ground reference respectively. Any other value of voltage at the input or output of the logic devices is not supported. Or is it?

Well, sometimes, because the way a circuit is built, it is not possible to achieve exactly those voltage levels. What do we do then?

Put it simply, we define an acceptable range, and we say that all digital devices have to accept anything in that range as a high level. And we do similarly for the low level.

Now, thanks to this requirement, all the vendors that build digital devices, and follow such requirement, can be sure that their components will be compatible with similar components from other vendors, and so will be all the customers that buy these components. Welcome to standardization!

And now that we have established that digital devices work within voltage ranges rather than exact voltages, we can define a better way than call those states high and low, so nobody will get confused, because they won’t need anymore to think in terms of ranges.

The adopted way to do so is to use the terms of the boolean algebra, which was invented by George Bool way before the digital circuits were invented. George Bool created such algebra as a way to easily solve complex logic problems. He realized that any logic statement can be described to be either true or false. Combining several statements becomes then a matter of operating with these two states of true and false and, therefore, the analysis of several concurrent statements can be done simply by operating appropriately on these two states.

And so, thanks to that visionary mathematician, today we tend to associate the state TRUE with the high state of the digital circuits, and we associate the state FALSE with the low state.

And then came the engineers, and they said: why in the world we need to use TRUE and FALSE as the values for making calculations? Why don’t we use just numbers? We can associate the state TRUE with the number 1 and the state FALSE with the number 0. And we already have binary arithmetic, so we can easily converge these two concepts.

And that’s why today we use the values of 1 and 0 when we work with digital electronics.

With ones and zeros, we can create a so-called abstraction layer when we do digital circuits design. We can ignore the fact that we are working with TTL circuits or with CMOS circuits, so we don’t have to worry about voltage values which, we know, are not the same with the two families of circuits.

Only when the design of the logic is done, and we need to implement it in circuits, then and only then we translate ones and zeros in voltages.

And because we have a standard to follow, everything will work just fine.

From the first two rows of this table we can see that for TTL circuits, which are powered with 5V, everything above 2.3V is a logic 1, and everything below 0.08V is a logic 0.

For the CMOS family, since these devices can be powered at different voltages, we have a 1 when the voltage exceeds 70% of the value of the supply voltage, and we have a 0 when the voltage is below 30% of the value of the supply voltage.

We won’t talk for now about other details on these families, but we will get back to that in the future.

Measuring The States

OK, now the problem is: how do we take measurements of digital signals?

Can we use a multimeter? Of course we can, but then we need to remember the specs to make sure that the voltages we read are within the required ranges to be a 1 or a 0. Possible, but not practical.

Can we use an oscilloscope? Same thing: we read voltages, and we need to convert them in our mind to figure out if they are ones or zeros.

And so… is there a practical way to make measurements of digital values?

But of course there is. There are at least two ways.

Way number 1.

We use a so-called logic analyzer. It is like an oscilloscope, but it is capable of making all the calculations to see if the voltages are in the correct ranges to be a 1 or a 0, and then they show directly a wave signal that represents only those values as Vcc or ground; no ranges whatsoever. These devices have also several channels, so you can usually watch 16 or more digital signals at once. That is very practical but… logical analyzers cost money. They cost at least like a good multitrack oscilloscope.

What if we don’t want to spend that amount of money to work on our small projects at home?

Well, in that case…

Way number 2.

We use a so-called logic probe. A logic probe is a small device, capable of testing just one single signal at a time, and tells us if that signal represents a one or a zero using just a pair of LEDs.

There are logic probes capable of doing that on TTL signals, and there are those that are capable of doing that on CMOS signals.

I’m going to show you now the schematic of one that can do both, one that is capable of measuring both TTL and CMOS signals. And you can build one with just a few bucks, it is a very cheap device. To see how to make one, please head to the corresponding video on YouTube, accessible through this page:

https://eleneasy.com/digital-electronics-fundamentals-articles-and-video-archives/

Only when you outgrow this device, because you start working on complicated circuits that require watching multiple signals at once, you will have to buy and use an actual logic analyzer. Until then, this little device will do its job very well for many years to come. Even if you, one day, decide to buy a logic analyzer, the logic probe will still be there for you to use when you don’t need the whole power of the mighty logic analyzer.

That said, let’s take a look at the schematic of such a useful device.

The Schematic

Our logic probe is built around a couple of voltage comparators, part of an integrated circuit that contains 4 of them. We are not going to use the two extra ones.

Why comparators? But, of course, to be able to measure voltage ranges, so the device will take care of making all the conversions between voltages and the logic levels.

The device will be powered by the same circuit under test, so it will be able to know what the value of the supply voltage is, and make its deductions in terms of converting the voltages in logic states.

The diode D3 is there to prevent the circuit from burning out in case we reverse the polarity when we connect the device to the circuit under test.

The tip of probe, on the left, sends the input signal we want to measure to the two comparators. The one on the top will measure the upper range, to see if the voltage is equivalent to a 1. We will therefore connect the probe to its inverting input, while on the non-inverting input we will put the minimum voltage of the range. Whenever the voltage at the inverting pin will exceed the voltage at the non inverting pin, the output of the comparator will go low, turning on the LED D1, which we will choose of red color.

Similarly, to detect a zero, we apply the input voltage to the non-inverting input of the second comparator. The inverting input, instead, will be connected to the maximum possible voltage of the range that represents the zero. This way, whenever the input signal is lower than the signal on the inverting input, the input of the comparator will go low and will turn on LED D2, which I have chosen to be green.

We also have a switch that allows us to change the reference voltages for the comparators, depending on the logic family we are working with: CMOS or TTL. For CMOS circuits, we set the switch to open, and the voltage dividers made of R7 and R8, and the one made with R5 and R6, will generate the 70% and the 30% of the supply voltage, which are the range boundaries of the digital signals.

For TTL circuits, we will close the switch, which will put a couple more resistors in parallel to those that make the voltage dividers. These new resistors, when the probe is powered with 5V from the circuit under test, will make sure that the reference voltages will be the ones for the TTL circuits: 2.3V for the 1 and 0.08V for the 0.

To use the device, we set the switch on the appropriate position, then we power the probe connecting it to the power supply of the device under test, then we use the probe terminal to read the signals. Depending on the LED that will turn on, we will know if the signal was a 1 or a zero. And if no LED turns on, it means that there is no signal, or that the signal is not in the correct range to be a valid 1 or 0.

We are going to use this simple device in many episodes of this tutorial, in the hands on sections. It will turn out to be very useful to understand how the proposed circuits work, and will help us acquire a practical view on the insights of digital electronics.

See you soon in this space and…

Happy experiments!

The Turbidity Tester

Plastic and other garbage in the waters has become a real issue in recent times. To make a difference in the effort of keeping clean the world in which we all live, thousands of YouTube creators have teamed up, lead by Mr. Beast and Mark Rober, to create the #teamseas global campaign, with the goal to raise $30M by the end of this year 2021 to remove from the waters of rivers, seas, and oceans all over the world, an amount of 30M pound of plastic and other garbage. One pound for every dollar.

To do so, #teamseas is partnering with the non-profit charities Ocean Conservancy and The Ocean Cleanup. They pledged to remove the 1 pound of plastic from seas and rivers for every dollar we will collect through the #teamseas effort.

To increase the awareness on this issue, today today I present you a device that can give you an idea of how many pollutants are contained in a sample of water. A corresponding video is also available here.

Here is the schematic of the device, which I named Turbidity Tester.

The sensor that measures the particles dispersed into the water is made of an LED and a photoresistor, on the bottom left.

The photoresistor I used is more sensitive to the green light, and so I used a green LED to make the circuit work at its best.

When the LED shines its light directly on to the photoresistor, the resistance will drop to a minimum, causing the voltage at the non-inverting input of the op-amp to reach a very low value.

When the LED shines its light through a sample of water, the more the water is polluted, the less light will hit the photoresistor and, therefore, the more its resistance will increase, which will cause the voltage at the non-inverting input to raise. The more pollution, the more voltage.

The op-amp is connected in a non-inverting amplifier configuration, and the gain of such amplifier depends on the resistors R3 and R4, which I selected in such a way that I can have on the output of the op-amp a voltage in the range between 0.3 and 8 V.

This voltage is applied to the input of the LM3915, which is a bar graph VU meter driver, configured through the resistors R1 and R2 to work exactly within the same range of 0.3 and 8V.

This way, the VU meter will light up one of the LEDs depending on the amount of pollutants in the water sample.

For the VU meter, I used LEDs of different colors: a blue one for clean water, then green, for less that clean , than orange for dirty water and red for really bad water.

To be able to put a water sample between the LED and the photo resistor, I 3D printed this simple device.

The LED is inserted in one of the side holes, and the photo resistor on the other one, so they will face each other.

The big hole on the top is made of a size that fits perfectly a tic-tac candy container, which will hold the water sample. But of course, if you want to try this project, you can use any kind of transparent container. Just adapt the size of the chamber to fit it snugly.

So, to test some water, we fill the container, we insert it in this sort of chamber, then we power up the circuit, and we take our reading on the VU meter.

This of course is not a device that can take actual measurements of the quantity of pollution in the water, but is an example on how such measurements can be done. Using more sophisticated photo-resistors that can detect different light wavelengths, we could build, using the same principle, a spectro-photometer, and we could tune it up to have precise numerical readings for each frequency. This would enable us to determine not only the presence of pollutants, but also their chemical composition and their quantity.

And talking about pollutants, don’t forget that you can help making Earth a better place to live in by donating to the #teamseas campaign.

Once again, #teamseas is a global campaign to raise $30 M to remove 30 M pound of plastic and trash from our oceans, rivers and beaches. It’s also the second wave of the largest creator-led fundraising campaign to ever hit the internet: #teamtrees. We launched #teamtrees in 2019 with a goal of raising $20M to plant 20M trees and we smashed it, raising over $23M and generating more than 1B video views. Even after two years, teamtrees.org is still receiving donations for planting 2600 trees every day.

#teamseas has partnered up with Ocean Conservancy and The Ocean Cleanup. All donations to teamseas will be split by the two charities 50/50.

Let’s repeat together the success we made back in 2019. Let’s help the world where we live to flourish again.

And finally, here is the archive with all the files for this project:

Happy Experiments!

How To Make A PCB Using A Laser Printer

When working with electronic circuits, sooner or later we feel the need to make our own PCBs to get a more functional and better looking circuit board.

I already made a video in the past to show how that could be done, for simple circuits, by drawing the circuit manually on the copper clad with a special kind of pen that uses an ink impervious to the chemicals needed to etch the PCB.

This time, I am presenting you a different technique, that allows you to draw the traces, and also the silk layer, with any of the design tools of your choice available on the Internet and the market in general. All you need to have is a laser printer. You can refer to this newer video for a demonstration of the process.

The whole process works on the concept that the printouts of the laser printers are made with a toner that has the characteristic of being able to protect the copper from the etching chemicals, like the ink from the pen in the original video. This is because the toner is made with a sort of plastic material.

Unfortunately, we cannot use a laser printer to print the masks directly on the copper clad, because the PCB boards are too thick for the printer. Therefore, we need to find a way to print on paper and then tranfer the printed ink to the copper afterwords.

This is made possible by a certain quality of glossy paper that do not allow the toner to stick permanently on its surface when exposed to heat. Even paper from magazines that are printed on glossy paper works relatively well for this to happen. However, there are specialized papers, that are designed specifically for this, which are called Thermal Transfer Paper For PCBs. A quick search on-line will give you plenty of places where you can buy it at a relatively modest price.

Once you have your PCB design ready and printed on such paper, the process to create PCBs becomes really straightforward.

First step is the transfer of the traces drawing to the copper. The copper needs to be perfectly clean, so it is always better to use a piece of steel wool to scrape away copper oxide and other dirt from the copper surface. Just move the wool in a circular fashion to remove all the particles of oxide from the copper clad and make sure to use gloves, otherwise the contact with the skin of your hands will soon oxidize again the copper.

Once all the oxide is removed, you need to deep clean the copper to remove any particle of dust from it. To do so, you can use some alcohol. Once done, let the board stand for a a while to make sure it is completely dry.

Then lay the board on the printout, making sure the copper is in contact with the drawing. Wrap the paper all around the board to make sure it will not move during the transfer process.

Once the PCB is wrapped with the paper, put it on the table copper-side up and use an iron at the max temperature, with no steam, to heat uniformly the whole surface of the paper and the pcb wrapped in it. Be careful not to burn yourself in the process, of course. You do not need to press hardly, the weight of the iron is just enough. Just make sure you keep moving the iron so that the whole surface is heated uniformly. Do that for a while, until the copper clad becomes almost as hot as the iron. Don’t worry about burning the paper. it is not going to happen. Paper burns at 451 F while the iron, even at the hottest temperature, doesn’t normally go over 400F.

Once the paper and the clad are well heated, put aside the iron and unwrap the board, making sure that when you remove the paper from the copper side you do that slowly and uniformly. The ink from the printout will now have moved from the paper to the copper.

Second step is the actual etching. Use a plastic container, fill it with some ferric chloride solution, enough to cover the whole pcb, then dump the board in the solution. Once the board is in the solution, you’ll notice that the ferric chloride starts changing color. From the initial brown color, it starts becoming darker and darker. This happens because of the copper on the board that starts dissolving in the solution.

While the etching process continues, try to agitate the solution periodically, which will speed up the reaction. A warmer room will also help. Every now and then, check the status of the board and remove it from the solution as soon as you don’t see any more copper on the surface of it.

Once the etching is completed, remove the PCB from the solution and start rinsing it immediately, to stop the reaction that would continue to attack the remaining copper on the surface.

You now need to remove the toner film from the copper traces, otherwise you will not be able to solder the components on it. To do so, use a Lacquer thinner on a piece f paper or cotton and work slowly a little bit at a time. Do this in a well ventilated area. Solvent vapors are both unpleasant to breath and harmful.

Third step is to drill the holes. It is only necessary if you use pass through components, of course. If you use surface mounted components, this step is not necessary, unless you need holes to hold in place the board.

Finally, the fourth and last step is to do another transfer, on the components side of the board, to transfer the drawing for the silk layer. The procedure is exactly the same, but this time the toner will be lay down directly on the board support, not on the copper.

You can see how this process allows you to quickly repeat the whole procedure on as many boards as you like. You just need to print multiple copies of the layouts on the thermal paper and go through the previous four steps.

Hope yo liked this procedure, and don’t forget to go watch the corresponding video, so you will see exactly how this procedure works.

%d bloggers like this: