Section 3 Electrical Concepts

This class and modern life relies heavily on electricity and electronics. Our course electronics text points this out quite eloquently:

The history of electricity starts more than two thousand years ago, with the Greek philosopher Thales being the earliest known researcher into electricity. But it was Alessandro Volta who created the most common DC power source, the battery (for this invention the unit Volt was named after him).

Direct current (also known as DC) is the flow of charged particles in one unchanging direction (most commonly found as electron flow through conductive materials). DC can be found in just about every home and electronic device, as it is more practical (compared to AC from power stations) for many consumer devices. Just a few of the places where you can find direct current are batteries, phones, computers, cars, TVs, calculators, and even lightning.

We will begin exploring a number of concepts relating to electricity as we will essentially be using electrons as our modes of information processing. From the electrons that flow through a button or distance sensor to be read by the microprocessor to those which supply the power for our motors and servos, we are heavily dependent on electricity. Before we get into this, we need to go over some very important concepts. Take out your Raspberry Pi and follow along with the video below.



Rules of this course in regards to electricity:
  1. Always work only with DC electricity, never use AC voltage except for when you plug your Raspberry Pi into the outlet.
  2. Always work on your circuits when the devices are unplugged and batteries removed. Not only is this a safety issue, it will prevent the need to replace electrical components
  3. Only use the components listed in the laboratory activity on which you are working. Do not try new components you have never used before or are unfamiliar with.
  4. Keep your work area clean and uncluttered. Do not keep beverages on your workstation.

3.1 Schematics

Electronics schematics are our map to designing, building, and troubleshooting circuits. Understanding how to read and follow schematics is an important skill for any electronics engineer. Once some basic components are explained, understanding the relationship between these drawings and real circuits becomes easier.

To help us better understand what schematic symbols are, lets start with an overview from our online textboot. Read over Understanding Schematics from All About Circuits. Then, watch the video below that explains these ideas.

Using your newly discovered schematic design skills, you will make your own basic schematic. A great online tool for circuit design is Circuit Simulator and Editor. This is a very straightforward app that allows us to build and save schematics on Google Drive or in a simple text file. Spend some time learning the basics of the interface including, adding components, checking for continuity, saving circuits in text files and sharing circuits.

ASSIGNMENT 3.1.0 - Schematic Design

The electronics schematic is a fundamental piece of robotic design. Since we will be reading and writing schematics quite a bit this year now is a good time to start. After teaching yourself the basics of this app you will build your own schematic of a simple circuit and save it to your assignment repository on GitHub.

Go to the Canvas page for this class and follow the instructions for 3.1.0 - Schematic Design.

3.2 Using a Digital Multimeter

A digital multimeter is a test tool used to measure two or more electrical values—principally voltage (volts), current (amps) and resistance (ohms). It is a standard diagnostic tool for technicians in the electrical/electronic industries. They long ago replaced needle-based analog meters due to their ability to measure with greater accuracy, reliability and increased impedance. Fluke introduced its first digital multimeter in 1977. Digital multimeters combine the testing capabilities of single-task meters—the voltmeter (for measuring volts), ammeter (amps) and ohmmeter (ohms). Often, they include several additional specialized features or advanced options. Technicians with specific needs, therefore, can seek out a model targeted to meet their needs.

The video below demonstrates how to use a multimeter like those we have in the lab. Feel free to get out the multimeter and try out everything you see here EXCEPT A/C VOLTAGE.

In order to expand our understanding of this vital electronics tool, we will look a little deeper into the subject using our online textbook. Read the section explaining the multimeter. Complete questions 1-4 on the voltmeter worksheet that goes with the reading and questions 1-4 on the ammeter worksheet that goes with the reading. Complete these questions on your own to help ensure you have a basic understanding of the voltmeter and ammeter functions of a digital multimeter. These questions will be similar to those that you will see on your unit exam. Once you understand what is asked, move on to the assignment.

ASSIGNMENT 3.2.0 - The Digital Multimeter as an Electronics Tool

Go to the Canvas page for this class and follow the instructions for 3.2.0 - The Digital Multimeter as an Electronics Tool.

3.3 Circuits

A basic understanding of circuit electricity is essential going forward. For this section of the course, we will begin using our online textbook. It gives us an excellent overview of electrons, circuits and polarity.

Key Concepts of Section 3.1

  • A circuit is a loop of conductive material.
  • In order for electrons to flow a closed circuit is required.
  • A circuit is open or broken if a complete path for the electrons to flow no longer exists.

To help you understand this concept, here is an excellent video from SparkFun Electronics on the topic.

Rather than me trying to do a better job than our textbook, you are going to read the short section on circuits. Complete questions 1-5 on the worksheet that goes with the reading on your own to help ensure you have a basic understanding of circuits. These questions will be similar to those that you will see on your unit exam. Once you understand what is asked, move on to the assignment.

ASSIGNMENT 3.3.0 - Building Circuits

Closed DC circuits will allow us to create robotic systems which will interact with the world. For this assignment, you both create new and debug existing DC circuits.

Go to the Canvas page for this class and follow the instructions for 3.3.0 - Building Circuits.

3.4 Voltage and Current

The movement of electrons from one pole to another is what we use in robotics to make our robots work. By altering the volume of electrons moving through the wires connected to a motor we can alter the speed of the wheel attached to the motor. The potential energy coming in to our microprocessor pin over a wire attached to a photoresistor tells us the level of brightness or lumosity in a room. Putting these two concepts together we could create a robotic system that opens the blinds on our lab when the sun sets in the west. That is, of course, if we can program our system to make that decision on its own. We will get to the programming part later. For now, we will examine the concepts of voltage and current which allow us, along with resistance, to receive information through sensor and send information out to an actuation device like a motor.

To help you understand this concept, here is an excellent video from SparkFun Electronics on the topic.


Read short section on voltage and current. Be sure to review the concepts at the bottom of the page for understanding.

ASSIGNMENT 3.4.0 - Voltage Versus Current

Voltage is the potential power of a DC circuit while current represents the actual power at a given moment. Comparing these two concepts will help us better understand them both.

Go to the Canvas page for this class and follow the instructions for 3.4.0 - Voltage Versus Current.

3.5 Resistance

The final concept needed to understand how electricity in a DC circuit may be used to control devices is resistance. One day last year I was sitting in my office upstairs. I had just come from the mechatronics lab and had packed a bunch of supplies from the lab into my backpack so I could do a little work on a demonstration I would be giving later in the week. All of a sudden I smelled smoke. I looked down and it was coming from my backpack! After digging around a bit I found the culprit. I had put a battery pack in my bag like the one here:

Can you see the problem? I had left all of the batteries in the pack. When I threw it in my bag, the red and black leads touched and starte what is know as a short circuit. With no resistance on the flow of electrons through the wires. The by product of this rapid flow was heat which began to melt the inside of my backpack and start it smoking. Remember this example and always pull one battery out of your battery packs when not connected to your device. Also, never connect two poles of a power source without any resistance. It can cause serious injury.

This problem is prevented by placing a resistive force on the circuit. Small electrical components like LEDs and sensors cannot handle even the two amperes of current available from the Raspberry Pi’s 5V pin. A reisistor is used to prevent the LED from burning up. In order to understand how resistance works, read short section on resistance.

ASSIGNMENT 3.5.0 - Modifying Resistance

Resistors come in many formats from simple in-line resistors to more complex rheostats and potentiometers. Additionally, they may be wired in series or parallel to increase and decrease total resistance.

Go to the Canvas page for this class and follow the instructions for 3.5.0 - Modifying Resistance.

3.6 Ohm’s Law

All three of these concepts come together in Ohm’s Law. In the 19th century many scientists were experimenting with electricity in an attempt to understand it. One of these scientists, Georg Ohm, determined that there was a relationship between Voltage, Current and Resistance. This is why an LED burns up (receives too much current) when no resistance is placed on the circuit. If we create resistance on the circuit with a resistor the voltage, or potential energy, remains constant but the current decreases. Ohm’s law is represented by this simple formula:

\[V = I * R\] On a simple circuit with one 5V power supply and two grounds we can visualize the interaction between the three concepts in this way. The animation here represents such a circuit.

Ohm’s Law tells us that, if we maintain a constant voltage, current is inversly proportional to resistance.

In the animation above a 5V power source is connected to two different circuits at once. One circuit has a 100 Ohm resistor while the other has a 1,000 Ohm resistor. The result is that the circuit with a resistor that is ten times larger produces a current that is one tenth of the other.

If we have any two of the components of Ohm’s Law, we can calculate the other. The formula may be adjusted with some simple algebra or by using what is known as the Ohm’s Law Triangle

The video here explains this in more detail.


As we will see, this formula is quite handy. It may be rearranged to solve for any one of the three possible outputs (V-voltage, I-current, R-resistance). In order to understand how resistance works, read this short section on Ohm’s Law.

To help you understand this concept, here is an excellent video from SparkFun Electronics on the topic.


ASSIGNMENT 3.6.0 - The Fundamentals of Ohm’s Law

Closed DC circuits will allow us to create robotic systems which will interact with the world. For this assignment, you both create new and debug existing DC circuits.

Go to the Canvas page for this class and follow the instructions for 3.6.0 - The Fundamentals of Ohm’s Law.

3.7 Transistors

A transistor is a semiconducting devise that may be used as an electrical switch in order to amplify an electronic signal. They are the singal most important component in modern electronics systems. Most transistors have three terminals which may be connected to an external circuit. Voltage applied to one of the terminals acts as a switch when power is applied to it.

There are two main types of transistor: bipolar junction transistors (BJTs) and field effect transistors (FETs). BJTs are made of doped materials and can be configured as NPN and PNP. A transistor is an active device with three terminals, and these three terminals are known as the Emitter (E), the Base (B), and the Collector (C). The Base is responsible for controlling the transistor while the Collector is the positive lead, and Emitter is the negative lead.

In small, discrete quantities, transistors can be used to create simple electronic switches, digital logic, and signal amplifying circuits. In quantities of thousands, millions, and even billions, transistors are interconnected and embedded into tiny chips to create computer memories, microprocessors, and other complex ICs. Later in this unit we will cover integrated circuits (ICs) in more detail.

All transistors have three leads. One lead acts as an electronic switch which allows current to flow between the other two. In this way, a small current (as in the case of current from a microcontroller like a Raspberry Pi or an Arduino) may be used to control a larger current (for example, to turn on a motor).

The first transistor type we will look at is the BJT. BJTs exist as PNP and NPN types, based on the doping types of the three main terminal regions. Examination of the figure below shows a small arrow on each schematic symbol for the transistor. This arrow illustrates the direction of current flow. The base (B) lead is the switch which activates the connection between the other two leads.

NPN and PNP Transistors

This short video illustrates the function and differences between the two types of BJTs.


Transistors may also be used to amplify a signal as shown in the diagram below:

Transistor Amplifier Circuit

In our class we will utilize BJTs but it is worth noting that there are other types that may be useful as well. A very widely used transistor is a metal–oxide–semiconductor field-effect transistor (MOSFET) transistor. A key advantage of a MOSFET is that it requires almost no input current to control the load current, when compared with BJTs.

MOSFET

For a slightly more thorough explanation of the differences between BJTs and MOSFETs, watch this video from our online text about the differences.

ASSIGNMENT 3.7.0 - Transistors as Electrical Switches

Practice wiring electrical switches with a simple BJT switch. Be sure to use resistors properly in your circuit to avoid overheading your transistor or other components.

Go to the Canvas page for this class and follow the instructions for 3.7.0 - Transistors as Electrical Switches.

3.8 Capacitance

The capacitor is a component which has the ability or “capacity” to store energy in the form of an electrical charge producing a potential difference (Static Voltage) across its plates, much like a small rechargeable battery.

There are many different kinds of capacitors available from very small capacitor beads used in resonance circuits to large power factor correction capacitors, but they all do the same thing, they store charge.

In its basic form, a capacitor consists of two or more parallel conductive (metal) plates which are not connected or touching each other, but are electrically separated either by air or by some form of a good insulating material such as waxed paper, mica, ceramic, plastic or some form of a liquid gel as used in electrolytic capacitors. The insulating layer between a capacitors plates is commonly called the Dielectric.

Capacitors

Due to this insulating layer, DC current can not flow through the capacitor as it blocks it allowing instead a voltage to be present across the plates in the form of an electrical charge.

Capacitor Diagram

In order to more deeply understand capacitors, read over this section from our online text about them.

ASSIGNMENT 3.8.0 - Using Capacitors

Capacitance is a fundamental and highly useful electrical concept. Smoothing signals in inverters and other systems help make our robotics systems more reliable.

Go to the Canvas page for this class and follow the instructions for 3.8.0 - Using Capacitors.

3.9 Logic Gates

Boolean logic is the fundamental mathematics of the integrated circuit (IC). It allows us to build complex computational devices from binary switches. Logic Gates are used in engineering projects to build decision making systems. Robotics systems use that decision making aparatus to control the flow of electricity in order to create the desired behaviors of the system. For example, a NAND gate on an IC, which produces current output in all conditions except when its two input pins are receiving a high voltage, may be used to activate a system when any single condition becomes true but not when both are true. For example, let’s say you are a shop owner and have an access gate to your back lot that is used fairly often during the day but very rarely at night. You would like a simple alert tone to sound once first thing in the morning to ensure that the system is activated and then when someone opens the gate at night since that would be an unusual event. During the day when people are frequently open the gate you do not need an alert. In this case if we build this system using the NAND gate we can accomplish this task. This logic gate will only send an output of high to an alarm when either the gate is opened or the light sensor initially senses light (first thing in the morning). If the gate is opened during daylight hours, no alert is created. In this way, we can control the alert system with a simple electronic component like the 7400 IC chip.

Hobby circuits like the one shown here may be used to learn how these systems interact with electrical signals in making decisions:

Texas Instruments 7400 IC

These chips are designed to fit into solderless breadboards and usually placed over the channel in the middle.

They also generally fit in many ICs and may be soldered dirctly on them.

3.9.1 Reading the IC Number

The most widely manufactured logic family series are the 7400 series ICs. Military grade ICs contain the 54 prefix instead. The derivation of these IC numbers is given below:

Manufacturer This code normally consists of two letters and is a code normally used by a given manufacturer. SN is one used by Texas Instruments. Other manufacturers have their own codes that they place here.
Temperature Range This is indicated by these two figures. 74 indicates 0°C to 70°C commercial and 54 military: -55°C to +125°C. For most applications the 74 series is perfectly acceptable and this series will be found in consumer devices.
Logic Series This is the sub-family. 7400 for example is the basic series, but there are many others.
Device This indicates the device function / type. For example devices with 04 are hex inverters, etc. They are the common across all sub-families.
Package Code This is the package suffix. It is necessary to refer to the manufacturers datasheets as these codes vary between manufacturers.

Almost all of the IC logic gates we use in this course are large footprint (made to fit on a breadboard) 74x00 to 74x99 gates. A comprehensive list of those ICs may be found on this Wikipedia page.

3.9.2 Truth Tables

Before getting to the actual electronics we should discuss truth. All logical functions follow the concept of logical truth which creates a model that may be used to understand and build circuits. A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional arguments, that is, for each combination of values taken by their logical variables. In particular, truth tables can be used to show whether a propositional expression is true for all legitimate input values, that is, logically valid.

A truth table has one column for each input variable (for example, P and Q), and one final column showing all of the possible results of the logical operation that the table represents (for example, P XOR Q). Each row of the truth table contains one possible configuration of the input variables (for instance, P=true Q=false), and the result of the operation for those values.

The truth table for p AND q (also written as p ∧ q)

p q p ∧ q
T T T
T F F
F T F
F F F

The truth table for p OR q (also written as p ∨ q)

p q p ∨ q
T T T
T F T
F T T
F F F

The truth table for NOT p (also written as ¬p)

p ¬p
T F
F T

The truth table for p NAND q (also written as p ↑ q)

p q p ↑ q
T T F
T F T
F T T
F F T

The truth table for p NOR q (also written as p ↓ q)

p q p ↓ q
T T F
T F F
F T F
F F T

The truth table for p XOR q (also written as p ⊕ q)

p q p ⊕ q
T T F
T F T
F T T
F F F

The truth table for p XNOR q (also written as p ↔︎ q)

p q p ↔︎ q
T T T
T F F
F T F
F F T

With these basic logical functions we can create electronic logical switches. All logic gates are built off the rules expressed in the tables above.

3.9.3 Inverters and Buffers

Both of these gates have only a single input pin and single output pin.

Inverters apply logical NOT and are represented with the following schematic symbol:

Logical NOT

Logical NOT is most widely used to invert either the input or output signal of another gate. The 74x06 and 74x14 ICs each provide six input and output gates that invert the signal.

All logic gates placed on silicone ICs have external power and ground. This allows them to be utilized as buffers which may boost the single input signal. In this way the buffer gate shown below is only used in order to increase the electrical charge used as in input in other logic gates. While it might seem illogical to do this a buffer is essentially two inverters in a row. In a schematic diagram they are drawn as two NOT gates in a row or the specific buffer symbol.

The 74x07 chip contains six hex buffer gates.

Buffer

3.9.4 Basic Logic Gates

The simplest two input logic gates are AND and OR. They each have two input pins and one output. AND and OR gates are shown here.

The 74x08 and 74x32 chips each have four sets of their respective logic gates (AND and OR).

AND Gate

OR Gate

Two other useful logic gates are XOR (exclusive OR) and XNOR (exclusive NOR). It is not yet immediately apparent for the need for the exclusive NOR but, like the exclusive OR, it modifies the gate by interpreting OR a little differently. In the exclusive case two input arguments that are true, do not equal an OR or NOR truth. (See the truth tables above.)

The 74x86 IC Chip is a commonly used XOR gate which contains four gates with two inputs and one output each.

XOR Gate

The 74x266 IC chip is one of the chips which uses four XNOR gates with four output pins.

XNOR Gate

3.9.5 Universal Logic Gates

The final two cases of logic gates are special. They are the only two gates which may actually be used to build all of the others. In that way, the chips that include these two gates (74x00 and 74x02 among others) function in prototyping projects as a basis for any other system given we have enough room to build the circuit.

The 74x00 IC chip is the most commonly used IC because it contains four sets of NAND gates.

NAND Gate

The 74x02 IC chip contains four sets of NOR gates.

NOR Gate

This section of the Wikipedia article on logic gates illustrates how to do this.

ASSIGNMENT 3.9.0 - Logical Decisions with Integrated Circuits

The foundation of computer science is built on the integrated circuit. These fundamental computer components require practice to understand. Be sure to carefully read the datasheets for the ICs before using them.

Go to the Canvas page for this class and follow the instructions for 3.9.0 - Logical Decisions with Integrated Circuits.