Electrical Crash Course

2018 Summer

Revision: 0.1

Vincent Yuan

yuanv@alumni.ubc.ca

# How to Use

In most cases the information is provided and chosen by 20/80 principle. It is the 20% of knowledge that you will use 80% of the time. It will not be deep with theory, rather a pointer for you to know what to google next to solve your problem. Or you can think of it as information that will allow you to carry out small talk in the electronics shop.

In most cases, there are always exceptions for generalizations I make. If you decide that you do need something specific and it is not mentioned, that does not mean it doesn’t exist. Most things you imagine should exist, will exist, it’s just a matter of finding it. (This is in respecting to sourcing parts or chosing designs). And in any case where something you are looking for lands outside of the 20% common knowledge, you should probably think about why.

This document will be split up into two main components:

1. Knowledge, information, and where to find more

2. Projects and hands on tutorials.

For the knowledge components, it is mostly used for reference. It is also information I use very commonly myself. This section would hold most of the 20/80 generalized knowledge that I think are important.  Information that I consider from this section will be labeled and numbered with ‘k’. Eg. (k.1 - Electrical Prototyping).

For the projects sections, they will include references to sections from the knowledge section that you will need to complete the project. It will also include skills you would get to practice and learn from. Projects will be labeled and numbered with ‘p’. Eg. (p.1 - Flashing LED)

In both the Knowledge Section and the Projects section, I will do my best to cross reference the relevant sections.

# Course Number Reference

Below covers a list of courses I can remember off the top of my head that covers similar topics in reference to the different sections:

 Course Number Course Name Sections

# K.1 Electrical Prototyping

## K.1.1 - Wires

### Wire Gauges

Like recognizing fasteners and threads, learning constraints, wire gauge is something that is important when you are designing for specific safety factors. Wire gauge is often denoted as AWG (American Wire Gauge). Key notes on AWG:

• It’s a logarithmic scale, so don’t try to do it in your head. [1]
• AWG is inverse to diameter. Large AWG means THINNER, Small AWG means THICKER
• How we call it. Eg. We would call a 22AWG: “22 Gauge”, “No. 22” wire
• Thicker wire can hold more current, so battery wires have smaller wire gauge and sensor wires generally have larger wire gauge
• The sixth power of  is very close to 2, as a result, some rules of thumb[2]:
• When cross sectional area of wire is doubled, AWG decreases by 3.
• When diameter doubles, AWG decreases by 6.
• Decreasing wire gauge number by 10, reduces electrical resistance by a factor of 10.
• Aluminum is less conductive, therefore AWG of Al wire has same resistance as Cu wire with 2 AWG smaller.

In most cases, the wires you use will be copper. Since we generally are choosing wire gauge based on the required current carrying capacity, below is a table for quick reference of common wire gauges you would be using:

 Current(A) 472A 333A 235A 117A 83A 58.5A 41A 29A 20A 14A AWG(No.) 8 10 12 16 18 20 22 24 26 28 Diameter(mm/in) 3.264/0.12885 2.588/0.1019 2.053/0.0808 1.291/0.0508 1.024/0.0403 0.812/0.0320 0.644/0.0253 0.511/0.0201 0.405/0.0159 0.321/0.0126

* The current in reference on this table is based off of Preece Fusing Current for ~10s. Basically it’s the amount of current you will need to apply for 10 seconds to melt your wire. So chose wisely.

### Solid v. Stranded

Should I chose solid core or threaded/stranded wire? Here are rules of thumb:

• Bend radius: If you need flexibility or a lot of motion: Chose stranded wire. Solid core would shear.
• Corrosion: Generally not a problem, but if you have uninsulated wire, solid core would not corrode as fast.
• Electromagnetic Interference: If you are worried about EMI, chose stranded wire is better.
• Making an antenna: stranded wire would be better for gain, due to less Eddy Current Loss.

### Wire Color

We don’t like to segregate, but choosing your colors correctly will help you with understanding circuits that you have built. In general we chose the following for DC circuits:

 Vcc/Positive Terminal/+ Gnd/Ground/Negative Terminal/- Signal/S Red Black/Blue White/Yellow

## K.1.2 - Building Circuits

We will need ways to connect wires to components most of the time. Examples include breadboards, prototyping boards, terminal blocks...etc.

Breadboards are friends, not food. As you can see below, there are conductors that connect the pins in a breadboard.

Good practice is always to connect your power input to the power rails and then connect the power rails onto the other components on your system. This is because when you start having circuits that you would need to clean up signals with, or isolate noise from, it will be easier. This will be explained in later sections. Breadboards are desirable to test with because the pitch of the pins match most IC chips you use.

### Prototyping Boards

In general, to move to something more permanent without designing your own PCB, we use prototyping boards, they look like:

As can be observed, the layout is very similar most of the time, which makes transfering your prototypes easier.

### Terminal Blocks

Now, in the case where you have chosen to distribute a casual few hundred watts to your circuits, you might have chosen some pretty thick wire. You would notice that breadboards and prototyping boards are quite limited in their ability to accomodate big wire gauges. In those cases, we would need other methods of connecting things. Most commonly, we will chose to use terminal blocks and crimps.

These are terminal blocks:

These are crimps:

The connection (ha.) should be obvious. The terminal blocks on the left and middle will be able to use the crimps with circular connectors. The terminal block on the right would not need crimp connectors on the wires to be able to connect them.

The biggest difference between the two types of terminal blocks would be that for the terminal blocks that require crimp connectors, you are able to stack multiple wires together. Contrary, the terminal block on the right would only be able to hold a single wire on either end of the connector.

## K.1.3 - Bench Tools

### Multimeters

Multimeters are your friend. You have probably seen these:

There are bench multimeters and handheld multimeters: In general they are the same, only difference would be size, and power rating they may be able to handle. Multimeters are also amongst the simpler devices to use. However, there are two things that think requires comments on.

First is the 4 connections to choose from on the multimeter:

From left to right:

• For your positive terminal: The symbol means that it measures AC Current with a maximum rating of 20A.
• For your positive terminal: Similar to the first input jack, but for measuring mA signals
• For your negative terminal: COM stands for common, in most cases will be your ground. Your black probe should always be connected to this.
• For your positive terminal: This is for measuring DC Current, Voltage, Resistance, Capacitance and diode tests.

Second, one of the most useful functions of the multimeter that I don’t think people are using enough is the diode/short circuit test. Or as I like to call it, the beep beep test. On all multimeters you will find a mode with the diode symbol. It will be your friend to make sure that you have connected things correctly.

### Function Generators

This is a function generator:

As it’s name suggests it generates oscillatory signals. Using it is straightforward, so this will be something to learn during tutorials. However below are a few use cases for this:

• When you need reference signals for testing sensors with
• Checking amplifier circuits that are frequency dependent
• Checking filter circuits
• Testing oscillatory responses of piezoelectric resonant devices...etc.

Just the usual stuff.

### Oscilloscopes

This is the inverse function generator:

You will use this to observe AC signals. Good for observing specific behaviors that you are/are not looking for, like, damped signals, delays, decays...etc.  You probably learned how to use this in first year physics, so like the other devices, I won’t go in detail.

## K.1.4 - Circuit Simulators/Software

There are a lot of circuit simulators that exist right now. That includes SPICE (Simulation Program Integrated Circuits Especially) programs, layout programs or mixtures of both for large and small circuits:

• SPICE Programs:
• Circuit Maker 2000 Student:  It’s free, but it has limited number of component support. It’s also old. This is what you learn in EECE.
• LTSpice: Free, commonly used these days
• GNUCAP: Free but runs on linux
• Layout Programs:
• EAGLE: PCB Design
• Altium CircuitMaker: PCB Design
• Solidworks Electrical: Chassis wiring, 3d wiring layouts

## K.1.5 - Sourcing Components

The best place for you to find components would be Digikey. Some notes:

• Make sure you are on Digikey.ca
• I would suggest to search and filter by in stock first
• Make sure whatever you are buying does not have a 1000pc price break.
• Careful not to buy sensor IC chips that need biasing or circuit protection. Eg. There is a difference between buying the evaluation boards and the sensor chips themselves. In most cases I would suggest getting the evaluation boards unless you are designing your own PCB.

In other cases where you are looking for more general hobby components I would suggest:

• Amazon.ca
• Always check shipping times on things, don’t buy from China
• Ebay
• Don’t recommend for small cheap components, customs and shipping generally is not worth it.
• Good for buying whole Arduino Starter Kits though.
• Hobbyking
• Good for LIPO Batteries, RC Remotes.
• Make sure you are looking at the international warehouse.
• You can find a lot of sensor evaluation boards here. Though some of these can be found on Digikey as well.
• Sparkfun
• Similar to Adafruit, good for sensor evaluation boards

# K.2 Electrical Components and Circuit Theory

## K.2.1 - RLC

### Resistors, Inductors and Capacitors

Resistors, Inductors and Capacitors are the fundamental components of circuit theory. Here are what they look like, and what they do:

 Resistor Inductor Capacitor Picture Symbol (Std./Int.) Common Range (Unit) 0-Mega (Ohms) 1 Micro - 20 (Henrys) 1 Pico - 1 Milli (Farad) Equation What happens Resistors prevent current flow. Inductors prevent change in current. Capacitors prevent change in voltage. Mechanical Equivalent Damper Spring Mass

## K.2.2- Solving Circuits

Fundamental circuit solving theory is build around two laws:

• Ohm’s Law: Current flowing through a resistance generates a potential difference (gradient) in net charge on either side of the resistive element.
• ELI5: Consider 10 electrons flowing through a circuit at constant rate (I), when it runs into a segment of the circuit that only allows 5 electrons through at a time (R), a gradient of 5 electrons and 0 electrons on either side of the segment occurs.
• Equation:
• Kirchoff’s Law(s):
1. Voltage Law: Voltage difference along a loop is equal to zero.
2. Current Law: Total current travelling into a node (intersection of wires) is going to be equal to current exiting the node.

As conservation of energy is true no matter what system you are looking at, remember that  is your friend for that. Where P is power in units of Watts, V is voltage in Volts and I is current in Amperes.

IMPORTANT: Current is defined as the flow of positive charge! What does that mean? It means that electrons move in the opposite direction to the arrows you draw on your circuit.

## K.2.3 - Antennas

The governing high level concept for antennas and wireless energy transmission would be based off of Friis Transmission Formula:

• Friis Transmission Formula states that the total power received is the power density of transmission at receiving distance multiplied by the effective area of your receiving antenna.
• Where P is power, G is gain, r is distance, subscript r indicates received, subscript t indicates transmitted and  is our transmission wavelength
• Key observations:
• Large wavelength (low frequency) means more power received.
• Power decays by inverse square law to distance

There are a few types of common antennas:

• Half wave dipole:
• Length of antenna is half the transmission wavelength. This allows a standing wave to exist across the two poles of the antenna.
• The nature of this antenna would mean that the coaxial cable connected is split across the two poles.
• Gain is generally around 1.64 (2.15dBi).
• Input impedance is around 73+j42.5 Ohms, however if you shorten the length of the antenna to be slightly less than half wave, the reactance disappears leaving the impedance to be around 70 Ohms. This make impedance matching and feeding the lines simpler.

## K.2.3 -Transistors and Relays

Transistors and Relays are the controllable valves of electrical circuits.

### Transistors

BJTs (Bipolar Junction Transistors) and FETs (Field Effective Transistors) are the two major types of transistors. MOSFETs (Metal-oxide Semiconductor Field Effective Transistors) are one of the more common types of FETs you will see. Most commonly they can be differentiated by their look:

The one on the left is what a FET would usually look like, and the one on the right is representative of the most common packaging for transistors. As can be seen, they each have 3 pins:

FETs:

• Source: Where the carriers enter the channel
• Gate: The terminal that modulates the channel
• Drain: Where the carriers leave the channel

BJTs:

• Collector: Where the majority carrier is collected
• Base: Where the majority is being regulated
• Emitter: Where the majority carrier is coming from

The biggest difference between FETs and BJTs are that one is unipolar and the other, as the name suggests, is bipolar. Polarity refers to the carriers, more specifically holes, denoted p, and electrons, denoted n. In other words, during operation FETs will only have holes moving or electrons moving. On the other hand, during operation BJTs will have both the holes and the electrons moving. Knowing that there may be a difference in majority carriers, there are two sub-types for each type of transistors. BJTs are split into NPN and PNP transistors, while FETs are split into N-Type and P-Type.

For both these devices, you would control the flow of current by adjusting your voltage on the regulating terminal. (Gate for FETs, Base for BJTs).

### BJTs in Detail

This picture below is a depiction of the the material construction inside a BJT, specifically an NPN BJT.

The way to observe and understand what’s happening is as follows:

1. First recognize that there is an external potential gradient denoted by Vcb and Vbe. This means that all the positive charge (holes) is aggregated on the right side of the diagram. What this means is that electrical current will prefer to flow in the counter-clockwise direction, whilst the traditional electron is moving the the clockwise direction as denoted in the diagram.
2. However, it is important to note that there is the P-junction filled with holes dividing the circuit up. If Vbe did not exist, there would be no potential gradient across the NP junction on the left side of the device. As a result the white arrow of holes would not exist. Since Vbe does exist, holes are able to travel from the P junction to the N junction on the left.
3. In attempt to balance out the system, electrons would move in the opposite direction from the N junction on the left to the P junction completing the flow of the circuit.

### FETs in Detail

Below is a cross-sectional diagram of a N-MOSFET.

For FETs, the operational steps are as follows:

1. A voltage is applied to the Gate, creating a gradient that forces positive particles (holes) to move into the depletion region.
2. To balance out the change, the electrons will move towards the depletion region right below the gate.
3. Electrons can now freely flow between the source and the drain.

### Relays

The main difference between relays and transistors using the valve analogy is that relays is toggling between 2 different sources, while transistors open and close. Traditionally relays were made with little electromagnets that toggle the connection like the following:

As can be seen, a pair of connections are needed to supply power to the coil, and a trio of connections are being toggled. The trio is usually labeled NC, C and NO for Normally Closed, Common and Normally Open. The context for normality refers to the state when the coils are not being powered. Therefore as can be observed, when you power the coil, the connection between Common and Normally Open are now closed, completing the circuit.

This is a really good feature of the device for safety circuits because when power to the coil is disconnected, the circuit will return into its natural state, disconnecting Common and Normally Open.

As technology has progressed, relays have also been recreated with semiconductor materials. These are commonly referred to as solid state relays as opposed to the mechanical relays discussed above.

Common packaging for mechanical relays can be seen in the images above. The three on the left are mechanical relays, while the one on the far right is a solid state relay. The packaging of the first relay from the left is of automotive standards, hence why you will find some weird numbers for the terminal labels, as well as the flat metal terminals that connect to crimps.

## K.2.6 - Special Applications

Flyback diode

Coupling and decoupling capacitors

# Motors

## Terminology

### Accuracy and Precision

You might find this common sense, but I want to make sure we understand the difference between accuracy and precision. Being accurate refers to how close our measured value to is to “the truth”. Precision on the other is all about the consistency of data we are receiving.

This distinction is important because with Sensor Fusion, we are extracting higher accuracy by combining multiple sensors measuring the same thing. In the process of doing so, we have to account for the precision of our sensors. We cannot simply assume the accuracy of a sensor even if it was precise, hence the need for calibration on all the sensors we use. For sensors, precision is static relative to the operating point you chose. In other words precision is not something we can improve without making a new sensor. On the other hand, accuracy is something that the end stream engineers like us can improve on. Improving accuracy would require more sophisticated techniques detailed in the other sections.

## Sensor Fusion

Sensor fusion is a huge topic with various methods.

# Projects and Tutorials

## P.1 - Designing a blinking LED Light Circuit

Purpose:

This purpose of this project is for people to be familiar with the basic hands on prototyping skills. This includes choosing components, clean wiring on breadboards, soldering and some very basic circuits.

Reference Sections:

Components Needed:

• 1x 555 timer
• 2x 1k resistor
• 1x protoboard
• 22 gauge solid core wire
• 1 LED
• 1x battery connectors
• 1x 9V battery
• 1x 100uF Capacitor

Tools Needed:

• Soldering Iron

Process:

## P.3 - Reading Radio Signals and Controlling Motors and coiling transformers

K.1.1 - American Wire Gauge - https://en.wikipedia.org/wiki/American_wire_gauge

K.4.1 - PWM - https://www.arduino.cc/en/Tutorial/PWM

# Motivation

The purpose of this document is to provide the lesson plans/information that can be reused for teaching practical electrical engineering skills that I consider important for students on working on project teams. It is a collection of things I had wished I would’ve learned earlier in electrical engineering to be more productive working on projects.

The main motivation for running this course is out of frustration of the lack of practical knowledge provided by the current electrical engineering curriculum. This has become evident to me through my attempts at finding a co-op job in second year and recruiting electrical engineering students for project teams. It has not necessarily been the case where theory was lacking, but rather the applications of the wealth of knowledge built up from courses that was lacking.

I am in no position to criticise the current electrical curriculum as I have gone through long discussions with instructors around the current state of the UBC EECE curriculum. However a clear comparison between second year EECE students and students having gone through the Mech2 program will show you the difference in problem solving ability built up. Though this situation has since greatly improved through the improvement of the first year UBC APSC program.

This course plan is most certainly not an exhaustive list of things I wish was taught, but it should be enough for any student to join a student team and understand the basics in contributing to a project that concerns the electrical engineering discipline.  It should also be noted that I am most certainly was not the most hard working student in school, my failed courses and low GPA is evidence. However, in most cases I see a lot of students having to struggle through courses simply because the topics are not of interest, the instructors are not helpful, or simply because they do not see if the potential of the knowledge they are obtaining.

There are a lot of things I personally have not learned, for example Altium or Solidworks Electrical...etc. These are all essential tools, and powerful tools that I think students should learn to use. Unfortunately since I do not not have enough knowledge in those subjects, I will not be able to discuss them. The hope is that revisions of this document by the more experienced can provide the necessary resources to gain knowledge on these subjects.

All in all, I hope that this lesson plan can be used, improved over time by other leaders amongst the Engineering Design Team and UBC to provide new engineering students with the basic prototyping skills to create fun and interesting projects.

Vincent

[1] For people that want to try, wire gauge of n can be calculated via: [ n=-39log_92(d/0.005in)+36 ]. Where n is AWG, d is diameter in inches, and the log is base 92.

[2] https://en.wikipedia.org/wiki/American_wire_gauge