Title: Basic Electricity and Electronics
1Basic Electricity and Electronics
- Module One
- Basic Electricity
2How to learn about Electricity and Electronics
- Everybody plays music from a CD
- We start with binary data
- We end up with sound coming from a speaker
- How does this work?
3The process involves
- Electricity
- Electronics
- Digital signals
- Digital logic
- Sound
- Light and optics
4- Here is what our binary data looks like
- 1001000100110101 1110101000111101
- Here is what our audio signal looks like
5How do we get from one to another?
- A series of conversion process steps
- Sound is created by something that vibrates
(moves), which creates pressure changes in the
air - We can use the pressure to make something move (a
coil or diaphram) - We can use motion to create or change some amount
of electricity
6This work is licensed under a Creative Commons
License.
7Sound conversion to CD data
- The value of the voltage depends on the amount of
sound (called the amplitude) - The voltage value is converted to a number that
represents how big or small the voltage is - This number has a binary code that is unique for
each voltage value - The binary code is stored as pits and spaces on a
compact disk - We will look at binary in more detail a little
later
8- CD audio is basically a whole bunch of numbers
that record sound levels and changes in sound
levels - The voltage values are sampled at a fixed rate
44,100 times per second (Hertz) - We sample and record the sound level whether
there is sound or not, resulting in a fixed
amount of data per second (1.4 million bits of
data per second) - You have to understand electricity and
electronics in order to understand how (and why)
this works
9Basic Electricity
- Basic electricity and electronics starts with
electrons. - Electrons are one of the three fundamental
particles - All work involves movement
- Electrons move to create electrical work
- Electronics is the study and use of systems that
control the movement of electrons
10Electrons and Charge
- How do we make electrons move?
- Electrons have a charge
- Like charges repel, unlike charges attract
- These forces make electrons move
11Where do we get charge?
- Charge is a fundamental property of nature
- Electrons and protons have a charge
- Electron charge is negative
- Proton charge is positive
12The Atom
- The fundamental building block of all matter
- Made of protons, neutrons,
- and electrons
- The type of element is determined by the number
of protons in the nucleus
13(No Transcript)
14Voltage and Charge
- Voltage is a measurement of force created by a
buildup of charge - Atoms are usually neutral because they have the
same number of protons and electrons - Charge builds up when electrons are separated
from the atom - This separation takes work in the form of
mechanical energy or chemical energy
15Voltage and Current
- Voltage is the force created by a buildup of
charge - Also called a potential difference
- Voltage can make electrons move
- Electron movement is called current flow
- Current flow does the work in an electric circuit
16Common Electrical Units
- The unit of charge is the COULOMB
- Charge has the symbol Q, abbreviation C
- The unit of voltage is the VOLT
- The symbol is V, the abbreviation is V
- The unit of current is the AMP
- Current uses the symbol I, abbreviation A
- The unit of resistance is the OHM
- Resistance has the symbol W, abbreviation R
17Think in Pairs
- Electricity is two things Voltage and Current
- Voltage has two polarities positive and negative
- Two types of electrical power AC and DC
- Electricity has two purposes as an energy source
(power) and as a signal - Signals can be either analog or digital
18Electricity
- A good power source
- Easy to create
- Easy to control
- Efficient to transmit
- Easy to measure
- Makes everything work our way of life depends
on it
19Common Circuit Elements
20Battery
- DC Voltage source
- Voltage amount is typically given, as in 12 VDC
- Consists of one or more cells
- Cells are in series
- Cell voltage adds to give total source voltage
- The long side is positive
- The short side is negative
- The negative side is usually grounded or called
ground
21Ground
- Also called common
- Meaning shared
- A return path for every circuit branch
- Connected together
- Usually the most negative point in the circuit
- By definition, ground voltage is zero volts
- Why?
- Ground is not a device
22Fuse
- One of the major protection elements
- Another is called a circuit breaker
- A ground fault device (GFCI) is a type of circuit
breaker - Protects the circuit, not the person!
- A GFCI protects people
- Turns off the circuit, like a switch
- A switch is a control element, not a protection
element - Replaced once it is blown
- With the same amperage rating!
23Resistor
- One of the most common circuit elements
- Used to limit or restrict current
- Resistance amount indicated with a color code
- A circle or band around the resistor
- The physical size indicates the power rating
- Not the resistance value!
- The smaller the resistance value, the larger the
amount of current
24(No Transcript)
25Voltmeter
- Measures across a device
- Red lead to positive, black to negative
- Measures a voltage difference
- Has a high amount of internal resistance
- So no current flows from the circuit into the
meter - Does not change circuit voltage, current, or
resistance - Voltage range is usually a meter setting
- Selector switch or button
26Ammeter
- Measures amperage
- Amp meter
- Must be placed in the circuit
- Current must flow into (through) the meter to be
measured - An ammeter has low (zero) internal resistance
- So it doesnt reduce circuit current
- Leads must be changed from volts/ohms
- Dangerous to the meter!
27An Electrical Circuit
- Must have a voltage source
- Must have a load
- A resistor or other device to limit current
- Can be a circuit component, like a light
- Must have a complete path from one side of the
voltage source to the other - Usually a wire
- A path to earth ground is dangerous and unwanted
- Should have a protection device and a control
device
28A Simple Circuit
- All of the voltage is dropped across the resistor
- Current flows from negative to positive
- Ground is defined as zero volts
29- Open switch, no current
- Resistance is infinite
- Voltage is dropped across the switch
30- Closed switch, current flows
- Current flows from negative to positive
- Amount of current determined by Ohms Law
31The Simplest Circuit
VS
R
32The Same Circuit
VS
R
33- An electric circuit must have a complete path
from one side of a power supply (V) to the other
(-V) - Voltage across a resistor creates current
- Voltage, current, and resistance follow a rule
known as Ohms Law - I
-
- Current equals voltage divided by resistance
V R
34Definitions
- Voltage is caused by a buildup of charge
- Current is a flow of charge
- One amp equals one coulomb per second
- Ohms Law shows the relationship between current,
voltage, and resistance
35The Ohms Law Circle
V
I
R
I
I
36Circuit Calculations
37Circuit Calculations
38Circuit Calculations
- I 5.9 mA, R 2.2 kO What is V?
- V I x R .0059 A x 2200 O 13 V
39A Series Circuit
R1
R2
R3
VS
1. What is the formula for total resistance?
RT R1 R2 R3 (Resistance Adds)
IT I1 I2 I3 (current is the same
everywhere)
2. What is the formula for current?
3. What is the formula for voltage across R1?
V1 I1 x R1
VS V1 V2 V3
40Problem 1
R1
R2
R3
VS
VS 12 V, R1 250 O, R2 150 O, R3 500 O
- What is total resistance?
- What is total current?
- What is V1?
41Problem 2
R1
R2
V1 6 V
V2 4 V
R3
VS
600 O
20 V
VS 20 V, V1 6 V, V2 4 V, R3 600 O
What is R1?
42Problem 3
R1
R2
IT 6 mA
V1 3 V
R3
VS
1500 O
18 V
VS 18 V, V1 3 V, R3 600 O, IT 6 mA
What is R2?
43A Parallel Circuit
The voltage across each branch is the same VS
V1 V2 V3
The current from each branch adds IT I1 I2
I3
44A Parallel Circuit
The voltage across each branch is the same VS
V1 V2 V3
The current from each branch adds IT I1 I2
I3
45Parallel Example
300 O
500 O
750 O
12 V
VS 12 V, R1 300 O, R2 500 O, R3 750
O Solve for RT
150 O
300
500
750
46Alternate Method
300 O
500 O
750 O
12 V
IT I1 I2 I3
IT .04 .024 .016 .08 A
47Problem 4
RT 130 O
250 O
400 O
I1 .064 A
R1 250 O, R2 400 O, RT 130 O, I1 .064 A
Solve for I3
48- Electricity creates an electromagnetic wave also
known as a radio signal - Travels at the speed of light through air
- Travels at nearly the speed of light through a
wire - Historically most signals were analog and used AC
principles
49- Using this example, at 1 A of current, the motor
produces 6 oz-in of torque at a speed of 210 RPM. - To lift 200 lb requires a gear ratio of 533.3 to
1 - How long would it take to lift this 1 ft?
50- More recent signals are digital and represent
coded information - Digital signals are basically DC voltage switched
on and off at a rapid rate - The basic digital switch is a transistor
- In order to understand electronics you must
understand how transistors work
51MP3 Audio
- Research Project Technical details of MP3 audio.
- How does MP3 audio data differ from CD audio data?
52Basic Electricity and Electronics
- Module Two
- Basic Electronics
53Transistor Basics
- A semiconductor device
- Conductivity is controlled by current
- An example of a voltage controlled device is a
MOSFET - Made from a silicon crystal
- Doped with impurities to allow conductivity to be
controlled - N and P type doping use different conducting
particles (electrons and holes)
54Silicon Crystal
- Four valence electrons per atom
- Bonds with four more silicon atoms to
create a stable molecule - Creates a solid three dimensional structure
55The diamond unit cell is the basic crystal
building block.
- An atom covalent bonds to four others, which in
turn bond to four others, and so on.
56The diamond unit cell is the basic crystal
building block.
- An atom covalent bonds to four others, which in
turn bond to four others, and so on.
57N-type doping
- Adds arsenic, keeps the stable crystal structure
- Has an extra electron
- Negative charge carrier
- The extra electron becomes free to conduct
current - More arsenic atoms gives more conductivity
58N-type doping
- Adds arsenic, keeps the stable crystal structure
- Has an extra electron
- Negative charge carrier
- The extra electron becomes free to conduct
current - More arsenic atoms gives more conductivity
59P-type doping
- Gallium has only three electrons
- Still keeps the stable crystal structure
- Creates a hole where an electron is needed for a
bond - The hole is a positive current carrying particle
60P-type doping
- Gallium has only three electrons
- Still keeps the stable crystal structure
- Creates a hole where an electron is needed for a
bond - The hole is a positive current carrying particle
61- The simplest semiconductor device is a diode,
which is half P material and half N material - At the junction between the two regions,
electrons from N combine with holes from P - This creates a charged depletion region
62N
P
N
P
63- Reverse bias creates a wider depletion region
- No current flow (No Conduction)
- Forward bias has opposite polarity, and when
greater than .7 V eliminates the depletion
region, allowing current to flow freely
64A Transistor
- A transistor has 3 layers of semiconductor
- NPN or PNP
- The regions are called the emitter, base, and
collector - The key to how it works is that the base is THIN
and LIGHTLY DOPED
P
N
Base
Emitter
Collector
65Turning a Transistor ON
- It takes two connections to the power supply
Base (P)
Emitter (N)
Collector (N)
Reverse Bias
Forward Bias
66- The emitter-base forward bias overcomes the
depletion region of the reverse biased
base-collector junction, creating an electron
flood that goes through the base and spills over
into the collector. - Current flows
Reverse Bias
Forward Bias
67- Current flows from Emitter to Collector
(diffusion), negative to positive, while a
smaller current flows from Emitter to Base
(recombination).
Reverse Bias
Forward Bias
68- Here is the same circuit, shown using schematic
symbols
RC
IC
RB
VCC
VBB
IB
- IB VBB - .7 / RB
- IC VCC (-VCE) / RC
- IE IC IB IB ltlt IC
69- Here is the same circuit, shown slightly
different - This is a standard transistor switch
- Used in computers and other electronic devices
Power Supply (VCC)
RC
Output
Signal In
70The two states of a switch on and off
VCC
VO VCC
Signal In 0
VCC
Transistor Off
VO 0
This circuit is called an inverter When the
input is one the output is zero, when the input
is zero the output is one
Signal In 1
Transistor On
71Here is a better circuit
VCC
T2
Signal In
Voltage Out
T1
T3
This circuit is called a Totem Pole, and produces
better 1s and 0s
72The Truth Table
- A tool used to understand binary logic
- Shows every possible input
- Shows the output for each input
Input A Output X
0 1 1 0
What circuit does this represent?
An Inverter!
73Binary Logic
- A set of rules that applies to a digital circuit
- Logic defines the way the circuit will act
- Given a set of inputs, the output will produce a
specific outcome - Always acts exactly the same way
- We use a truth table to help us define the way we
want the logic circuit to act
74- We build the circuit to perform the logic
- Always does the same thing with the same inputs
- We must define each possible input or input
combination - We have to define exactly what output we want for
a particular input - Lets look at an example
75Two Bit Binary Adder
- Adds two binary bits
- Binary can only have two values, 0 and 1
- 1 1 2, which is not valid binary
1 1
0 Carry 1
0 0
0
0 1
1
1 0
1
76Truth Table for Binary Addition
- We have two inputs
- We generate two outputs
Input A Input B Output S (sum) Carry Co
0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 1
First, we have to understand binary!
How do we do this?
77Binary Numbers
- Binary only has two values, 0 and 1
- The decimal number system has ten values, 0
through 9 - How do we count higher than 9 in decimal?
- We add decimal places
- How do we count higher than one in binary?
- We add binary bits
78- Decimal places are each multiples of ten
- Binary bits are each multiples of two
100 1 (ones)
101 10 (tens)
102 100 (hundreds)
103 1000 (thousands)
20 1 (ones)
21 2 (twos)
22 4 (fours)
23 8 (eights)
79Reading Binary Numbers
- A decimal number like 9437 reads
- Nine thousand, four hundred, thirty, seven.
- The binary number 1011 has values
- One eight, no fours, one two, one one.
- 1011 has a decimal value of 11 (eleven)
- How do read the binary 1111?
- Decimal Fifteen
- How do you count higher than fifteen?
- Add more binary bits (decimal places)
80Binary Bit Values
- To count up to 1000 (decimal) you need ten binary
bits - To count higher, you need more binary bits
0
1
2
4
3
6
5
8
7
9
Bit number
4
2
128
64
256
512
16
1
32
8
Decimal value
81Binary to Decimal
- The binary number
- Has a decimal value
- This process involves addition
1001011001
512 64 16 8 1 601
1
0
0
0
0
1
1
1
1
0
0
1
2
4
3
6
5
8
7
9
16
1
32
8
4
2
128
64
256
512
82Decimal to Binary
- Decimal to binary is a little harder
- The process involves subtraction
- For example, consider the decimal number
- Go back to the binary count
361
83- 36110 equals 01011010012
- 8210 equals 00010100102
- 102310 equals 11111111112
84Binary Count
A B C D Deci Hex
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F
- The easiest way to show all possible input values
is a binary count - Keep adding one to the previous value
- Everyone should be able to count in binary
- D 1, C 2, B 4, A 8
85A B C D Deci Hex
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F
What happens if you have to keep counting?
0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 16 17 31 255 10 11 1F FF
86Hexadecimal
- Computers and electronic devices communicate in
binary - All those 1s and 0s are confusing
- Is there an easy way to tell what the binary
values are? - YES its called Hexadecimal
- Hexadecimal is a base 16 number system
- Hexadecimal exactly represents 4 binary bits
87Using Hex
- To create hex, start with bit 0 and group the
binary number into groups of 4 - For example, our decimal 601 would be
- 10010110012 or 25916
- 70110 10101111012 2BDh
88Using Hex
- To create hex, start with bit 0 and group the
binary number into groups of 4 - For example, our decimal 601 would be
- 10 0101 10012 or 25916
- 70110 10 1011 11012 2BDh
89- There are several ways to indicate the hex number
system - Use the subscript 16
- Use a lower case h right after the number
- Use a dollar sign, eg. 2BD
- Hex is a shorthand way of representing binary
- The hex number always exactly represents 4 binary
bits
90Back to Addition
- Add 2 4-bit binary numbers
- 1 1 2, which is written 10 in binary
1
0101 0011
5 3
1000
8
1
912 Bit Binary Adder
- Lets go back to the truth table for a binary
adder
Input A Input B Output S (sum) Carry Co
0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 1
Now that we understand binary, we can figure out
how to do this!
92We Use Transistors
- All logic uses transistors
- We use voltage to represent binary
- TTL (transistor transistor logic) is common
- 5 V binary 1
- 0 V binary 0
- These voltages will turn on or off transistors
93Basic Electricity and Electronics
- Module Three
- Microprocessor Basics
94An Inverter
- Lets go back to our first transistor circuit
VCC
RC
VO
VI
ground
Dont like the inverter? Here is a circuit that
does not invert
95- We have established the concept that voltage
turns on or off transistors - We use transistors to make the circuits that do
what we need - What circuit do we need to make a binary adder?
- First, lets look at what the adder circuit has to
do
96The OR gate
- When ANY input is high, the output goes high
- Does not perfectly match what we need, but gives
us a starting point
If EITHER input goes high, the transistor turns on
A
B
This is called an OR gate
97- This circuit works better
- The diodes protect one input from the other
- The resistor limits current
98Truth Table
- The truth table for the OR gate
- When ANY input is high, the output is high
A B Q
0 0 1 1 0 1 0 1 0 1 1 1
(Or X)
Q
Schematic symbol
99The AND Gate
- When BOTH inputs are high, we produce a carry
- We need a circuit that will turn on only when
both inputs are on
A B Q
0 0 1 1 0 1 0 1 0 0 0 1
Schematic symbol
100Schematic Symbols
- We have seen the schematic symbols for 2 gates
- AND
- OR
- Here is the schematic symbol for the inverter
- NOT
- With these three gates, you can make any logic
circuit
101Back to the Adder
- Here is how we make a binary adder
- All circuits are made physically with
transistors, but represented by symbols
A B S Co
0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 1
A
B
S (sum)
CO (carry)
102Digital Logic
- Digital logic is used for circuit design
- Also used for mathematical operations
- Called boolean algebra
- The english language use of the terms AND, OR,
NOT do not always have the same meaning as the
logical terms - There are 7 total logic gates
- AND, OR, NOT, NAND, NOR, Exclusive-OR,
Exclusive-NOR - These gates are the building blocks for computers
103Logic Circuit Applications
- A memory decoder
- A memory address is a unique number
- Most logic circuits are simple, as this example
shows
A 2-bit code unlocks one of 4 memory locations
when D goes high
A 4-bit code would unlock one of 16 memory
locations when D goes high
1043 Bit Decoder
- Any 3 bit binary number enables one AND gate
1056 address lines, 16 AND gates and 6 inverters
enable 64 memory locations
106Computer Basics
- A computer uses voltage on wires to communicate
- Communication involves data, addresses, and
instructions - Each of these are represented by binary numbers
in a code - A logic circuit similar to what we have just seen
is used to decode each of these
107A computer has several basic parts
- The input unit
- Keyboard, mouse, modem, transducer
- The output unit
- Monitor, printer, modem
- Memory
- RAM, hard drive, CD-ROM
- CPU
- Central processing unit
108The CPU
- The CPU is also called the microprocessor
- The brains of the computer
- Performs arithmetic and logic
- Has an internal ALU
- Works based on an internal program called
microcode - The primary job of a CPU is to execute
instructions
109Instructions
- Where do instructions come from?
- Humans write programs
- A program is made by a series of instructions
- Instructions are processed sequentially
- Program instructions get decoded
- An instruction set is used for a family of
microprocessors
110- Most program instructions are simple, like load,
store, move, add - The type of program a CPU understands is called
machine code - A higher level language like C or Java is
compiled or interpreted into machine language - Each instruction the computer understands is
represented by a binary number
111- A logic circuit similar to what we have seen
decodes the instruction into a particular
sequence of internal operations - To decode CD audio, a program runs in the
computer - The program describes how to read the data from
the CD and what to do with the data when it is
read - The CD audio data is also a series of numbers
- Voltage on wires is used to represent the numbers
(data, instructions, and addresses)
112- If you look at a motherboard, you can see all the
wires that are used to communicate - Wires are grouped and separated by function
- A group of wires is called a BUS
- For example, a 32 bit address bus is a group of
32 wires that connects chips - RAM to CPU
- Hard drive to RAM
113- Addresses go on an address bus
- Data goes on a data bus
- On a motherboard, the two are separate physically
- Other busses are called the control bus and the
power bus - Program instructions are a form of data
- Data and program instructions are sent at
different times on the same wires
114Examples of control signals
- Clock and timing signals
- Memory read or write
- Memory vs. other input/output types
- RAM vs keyboard/mouse
- Ready to send/clear to send/interrupt
- Enable/disable
- These are all on/off, controlled by voltage on a
wire
115The Clock
- The clock does two basic things
- Tells when to start
- Like a starters pistol
- Starts on an edge of the clock signal
- Tells how long an operation lasts
- The duration
- A half hour show vs. a one hour show
- How long things take can determine clock rates
116The Clock
- The clock signal is used to synchronize all
microprocessor operations
Start of next cycle or process
Duration
Start
(One Clock Cycle)
Time Elapses (Like ticks of a clock)
117CPU Block Diagram
118Key Facts
- The data bus is bi-directional
- The address bus is uni-directional
- The program counter hold the address of the next
memory location to be used - The next address is the last address 1
- The stack holds the addresses of programs and
data the CPU is not currently using - Internal registers form a que of program
instructions and data
119A Program Example
- Lets go through an example of the steps a CPU
goes through to read CD data - A program is a series of instructions
- A program loops over and over again
- What is the program doing while it loops?
- Waiting for user input
- Generating routine output
- Handshaking with devices
- Video output
120Step One
- The address in the program counter gets put on
the address bus - This address is for a program instruction in RAM
- A read control signal is placed on the control
bus - The program instruction code from memory is
placed on the data bus - The program counter adds one to the old address
- The CPU reads the instruction and executes
whatever is necessary to perform the instruction
121Step 2
- The next address (which is the old address plus
1) gets placed on the address bus - A read control signal is placed on the control
bus - The program instruction at that address is placed
on the data bus - The program counter adds one to the old address
- The CPU reads the instruction, decodes it, and
executes it. - This instruction tells the CPU to read data from
the CD
122Step 3
- The address in the program counter is placed on
the stack - The CPU determines the next available free memory
location, and places that address in the program
counter - This address is placed on the address bus
- A write control signal is placed on the control
bus - The CD drive reads data off the CD disk and loads
the data into memory at the location in the PC - A one is added to the address in the program
counter - The next piece of data is loaded into the next
memory location, etc.
123Next Steps
- When the CPU want to go back to running the
program, the current data location is taken from
the program counter and placed on the stack, the
next program instruction is taken off the stack
and loaded into the program counter - Data and program instruction memory locations are
stored on the stack - Only current program addresses (or data
locations) are in the program counter
124CD Data to Audio
- A CD that can read data at 52X can read data off
the disk at 7.8 million bytes/sec - 1X is 150 KB/sec
- CD audio data is recorded and reproduced at
exactly 176,400 bytes/sec - 44,100 samples/sec X 2 bytes/samples X 2 channels
- Excess data is buffered in memory
- Binary data is processed by converting each 16
bit number to a voltage with a signal amplitude
given by the data numerical value - The voltage is sent to the speaker, which
produces sound
125(No Transcript)
126More CD Info
- Red Book is the standard for audio CDs
- Linear Pulse Code Modulation (LPCM)
- A sequence of amplitude values
- Resolution and sample rate are defined
- A form of Resource Interchange File Format (RIFF)
- Apple uses AIFF
127FLAC
- Uses linear prediction
- An equation with simple coefficients
- Code has a value (q) and a remainder (r)
- Position and offset
- Also uses Run Length Encoding
128(No Transcript)
129(No Transcript)
130(No Transcript)
131VO
132(No Transcript)
133(No Transcript)
134(No Transcript)
135(No Transcript)
136(No Transcript)
137(No Transcript)