Family Science Program Introduction to Electronics...2020/05/28 · Introduction for parents In...
Transcript of Family Science Program Introduction to Electronics...2020/05/28 · Introduction for parents In...
© 2020 IBM Corporation
Family Science ProgramIntroduction to Electronics
Ruud Haring
05/26/2020 1
© 2020 IBM Corporation
Introduction for parents In this class we will introduce basic electronic circuits and basic “Boolean logic” to explain how
computers do their magic – that is: what is going on inside.
The 1st part of the class includes two pencil-and-paper exercises. Parents: before the class, it is recommended to print at least page 54 and 55 at the very back of this handout. One copy of page 54 and multiple copies (e.g. 5x) of page 55 would be good.
The 2nd part of the class has an exercise that can be done on an external non-IBM website:https://logic.ly/demo. Please start this link before the 2nd class, so that you can use it right away.The web version allows you to load, but not save circuits.If you really like it, and want to save your creations, a desktop version is also available for free for a trial up to 30 days; then for sale.
Please feel free to ask questions and enjoy!
205/26/2020
© 2020 IBM Corporation
Have you ever wondered how computers work, inside?
You can do lots of things with computers:– do your homework– browse the internet– write a report– play video games– play music– even calculate …
So how does that all work ? How can some box of electronics do all that?
Let’s dive right in…
305/26/2020
© 2020 IBM Corporation
Open up any electronics box and you will see something like this…
“printed circuit board”
with
“chips”
wires
other small stuff…
How is that made and how does it work?
405/26/2020
"© Raimond Spekking / CC BY-SA 4.0 (via Wikimedia Commons)"
© 2020 IBM Corporation
It starts with sand and water …
505/26/2020
Sand is ground-up rock. It contains mostly silicon-dioxide (and some other stuff) extract the silicon
Water – we’ll talk about later…
https://www.slideshare.net/judan1970/unit-2-lesson-23-mixtures
© 2020 IBM Corporation
https://www.sil-tronix-st.com/webuploads/display/200/Charlotte-Le-Mesle-Photographe-Sil-Tronix-ST-Transformation-Lingot-1.jpg
Silicon is melted and then “grown” into large cylinders (“ingots”) of very pure silicon
605/26/2020
https://media.wired.com/photos/5b68fc315bac5521a29ba720/master/w_1927,c_limit/silicon-96588401.jpg
On such a silicon slice (“wafer”) we then “print” our circuits.
When done (and tested), we saw the wafer into little squares: “chips”.
https://www.silicon.fr/wp-content/uploads/2011/12/Wafer-Silicon-Cr%C3%A9dit-photo-%C2%A9-Scanrail-Fotolia.com_.jpg
which are then sliced up…
© 2020 IBM Corporation
A chip photograph (BlueGene/P)
705/26/2020
3 of these chips encapsulated in “modules”…
… and then assembledon a printed circuit board, with cooling fins on top, and other (memory) chipson the side13.16 x 13.16 mm die size
can be covered by a dime!
© 2020 IBM Corporation
But why silicon ?
Silicon is shiny … like a metal it conducts electricity
But it is brittle … it breaks like glass but glass does not conductelectricity
805/26/2020
© 2020 IBM Corporation
Silicon sits on the fence between metals and non-metals…
… means we can push it off the fence… one way or the other
We can make silicon conduct electricity … or we can make it non-conductive.Back and forth.
We can make silicon switch current on and off -- and do it very fast
And with switches, we can do a LOT…
905/26/2020
© 2020 IBM Corporation
Water logic
1005/26/2020
A sink with a hot and cold water faucet
How can I get water to flow into the sink?
Water flows when we open valve A OR valve B(or both).
A B Water flows?0 0 00 1 11 0 11 1 1
Hot
A
Cold
B
?
© 2020 IBM Corporation
Electrical circuits
1105/26/2020
XA light bulb with one switch
How can I get the light to go on?
Light goes on when we close the switch
Light bulb
Battery
switch
© 2020 IBM Corporation
Same with electrical circuits
1205/26/2020
X
A B
A light bulb with two switches, A and B
Light goes on when we close switch A OR switch B(or both).
A B Light on ?0 0 00 1 11 0 11 1 1
Light bulb
Battery
switches
How can I get the light to go on?
© 2020 IBM Corporation
Water or electricity: the same OR logic applies
1305/26/2020
X
A B
A B Output0 0 00 1 11 0 11 1 1
Hot
A
Cold
B
?
A OR B
A
BO
logic gate -- OR gate
© 2020 IBM Corporation
Examples of OR gates Home
Car
1405/26/2020
X
A B C D
© 2020 IBM Corporation
More water logic
1505/26/2020
A
B
?
Now I have two water valves (in series).
How can I get water to flow into the sink?
Water flows when we open valve A AND valve B
A B Water flows?0 0 00 1 01 0 01 1 1
© 2020 IBM Corporation
Same with electrical circuits
1605/26/2020
X
A
B
A light bulb with two switches in series
How can I get the light to go on?
Light goes on when we close switch A AND switch B
A B Light on ?0 0 00 1 01 0 01 1 1
© 2020 IBM Corporation
Water or electricity: the same AND logic applies
1705/26/2020
A B Output 0 0 00 1 01 0 01 1 1
A AND B
AB
?
X
A
B
A
BO
AND gate
© 2020 IBM Corporation
Examples of AND circuits Home
Car
1805/26/2020
© 2020 IBM Corporation
Inverter (NOT gate)
1905/26/2020
A Output 0 11 0
NOT A
A O
Output is 1 if input is 0Output is 0 if input is 1
NOT gate -- inverter
© 2020 IBM Corporation
Interesting facts This manipulation of 0s and 1s with AND, OR and NOT is called “Boolean logic”,
after British mathematician George Boole (1815-1864).He lived long before electronics existed! I don’t know if he even had running water with faucets and sinks…
With AND, OR and NOT gates, you can actually make any logical circuit,meaning any circuit that handles 1’s and 0’s.
You don’t really need anything else!
But … there are other circuits that are handy to have around as building blocks.
– These can be built from AND/OR/NOT, but we tend to think of them as building blocks by themselves.
One such (slightly more complicated) building block is the following.
2005/26/2020
© 2020 IBM Corporation
Interesting combination: XOR (exclusive OR)
2105/26/2020
(A and (not B)) or (B and (not A))
How can I get the light to go on?
Light goes on when A and B are different
A B Light on ?0 0 00 1 11 0 11 1 0
X
A B
not_B not_A
AB O
A XOR B
XOR gate
© 2020 IBM Corporation
Exercise
2205/26/2020
A B Output0 0 0
0 1 1
1 0 1
1 1 1
A OR B
A=0
?
?
?
?
B=0
01
11
10
A B Output0 0 0
0 1 0
1 0 0
1 1 1
A AND B
0
?
?
?
?
1
11
10
00
A B Output0 0 0
0 1 1
1 0 1
1 1 0
A XOR B
1
?
?
?
?
0
00
01
11
1
0
1
1
0
1
0
0
1
1
0
0
© 2020 IBM Corporation
Combinations A single “0” or “1” is called a “bit”.
– Note: Bits are the smallest units of information.Computer scientists and engineers use bits (0 or 1) to represent things that have only 2 possibilities: a switch that can be open or closed, a light that can be “off” or “on”, a statement that can be “false” or “true”, an answer that can be “no” or “yes” a voltage that can be “low” or “high”.
But what have these “bits” have to do with anything real?
With combinations of bits, you can represent lots of things:– Colors– Text– Numbers– Sound
… which means that with electronic circuits you can handle that information:videos, games, reading, writing, calculating, playing/making music, …
2305/26/2020
© 2020 IBM Corporation
Colors
2405/26/2020
Any little dot (called “pixel”) on your screenis actually 3 dots: a red, a green and a blue dot.
You may be able to see that with a magnifying glass.
The bits tell the screen which colored dots to switch on or off. Your eye then mixes the colors so that you end up seeing the colors in the table.
With more bits, you can do more tricks: like turn green off – little green – much green – full green.Then you get different color hues.
Note: Modern screens have e.g. 24 bit color, meaning 8 bits each for blue, green and red.This allows 256 shades of each color, or 256*256*256 = 16.7 million colors altogether.
© 2020 IBM Corporation
Characters
2505/26/2020
Any letter you type on the keyboardbecomes a little series of eight high and low voltages, expressed as 1’s and 0’s -- thus 8 “bits”.
These fly from your keyboard to the computer,go on the hard drive, fly over the internet.
Only when they get back to your screen or printerdo you see a familiar letter again!
Such a group of 8 bits is called a “byte”.
Note: You will have heard of kiloBytes (1000 characters, say like an e-mail)MegaBytes (a million characters, like a book)GigaBytes (a DVD holds a couple of GB)
© 2020 IBM Corporation
NumbersBinary Decimal
000 0001 1010 2011 3100 4101 5110 6111 7
2605/26/2020
Humans think in the familiar decimal numbers…but computers only handle “binary numbers”.
With 3 bits that each can be 0 or 1 (thus, 2 possibilities) you can make 2*2*2=8 possible combinations.
With those 8 “binary” combinations you can express our decimal numbers 0 to 7.
How do you represent a bigger number, like 8?
© 2020 IBM Corporation
NumbersBinary Decimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 152705/26/2020
With 4 bits you can make 2*2*2*2 = 16 combinations,enough to express decimal numbers 0 to 15.
So: add one bit (in front), and you get twice as many combos.
How would you make 16?
Note: Computers encode whole numbers (integers) into strings of 32 or 64 bits -- so that they can handle really large numbers.
How big? 64 bits max = (2**64 – 1) ~ 18 billion-billion (18 with 18 zeroes)Suggestion: Look up the grains-of-rice story!
© 2020 IBM Corporation
Adder So can we do computing with these binary numbers?
YES!– We said before that once something is represented as zeroes and ones (bits),
our AND/OR/NOT gates are all you need to manipulate these bits.
– So…with the right combination of gates we can manipulate binary numbers to do such things as addition (and subtraction), multiplication, division.
– The trick is to have the right gates, and wire them together correctly in a larger circuit that does what you want it to do.
So next we will look at an “adder” circuit - specifically a “3-bit adder”: a circuit that can do any addition (from 0+0 up to 7+7) using binary numbers
2805/26/2020
© 2020 IBM Corporation
Adder exercise
2905/26/2020
A2 A1 A0B2 B1 B0
Decimal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7
Inputs
S3 S2 S1 S0 Decimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 15
Output
Pick any two numbers from above table to add up.
Example: 3+6Inputs:3 A2, A1, A0 = 0116 B2, B1, B0 = 110
Output:S3, S2, S1, S0 = 1001 9
https://researcher.watson.ibm.com/researcher/files/us-wendych/IntroElectro_adder.pdf
0 1 11 1 0
00110 1
00
1
01
S31
© 2020 IBM Corporation
Bigger adder
3005/26/2020
S3S3S4
A3B3
G3 P3
C2
S4S5
A4B4
G4 P4
C3
S5S6
A5B5
G4 P4
C3
6 bits inputs, 7 bits output can do any addition up to 63 + 63 = 126“Ripple-carry adder”
© 2020 IBM Corporation
Speed So addition with bits works … but looks a little cumbersome.
However, the AND, OR, XOR gates are made out of silicon and therefore can do it very fast. And they can do it all day!
How fast: if I drum my fingers, I can do 12 taps/second -- which is about 1 million per day.– A billion taps would take me 1000 days – almost 3 years!
– Any modern computer, however, like your laptop, can do a billion additions in a second! Note: It actually has to do 100s-of-millions of additions per second just to change the
screen when playing a video or videogame!
Here at IBM we have designed “supercomputers” that are thousands to even millions of times faster than that – used for really big calculations like weather/climate simulations, or for calculating what drugs might help with diseases, like COVID-19.The chips shown before are part of such a supercomputer – see next page.
3105/26/2020
© 2020 IBM Corporation 32
IBM’s BlueGene/P was one of the fastest computers in the world 2008-2012.Was preceded by BlueGene/L (2004-2008) and succeeded by BlueGene/Q (2012-2020) and Summit/Sierra (2018 – current).
05/26/2020
© 2020 IBM Corporation
So that’s the story Anything electronic has at its heart silicon chips
These chips contain millions of tiny circuits (logic gates), that are actually quite simple: AND, OR, XOR, NOT
Collections of these circuits, wired together, pass each 0’s and 1’s to each other, and can do something interesting together: like addition or multiplication … or playing music, or displaying information on a screen, or communicate information between each other.
… and do it all very fast -- because silicon can switch electrical currents on/off very fast.
Since text, numbers, colors and sound can all be expressed in 0’s and 1’s, that means that computers can handle all of that, using these simple logic gates…
The result is that you can see this remote presentation, you can hear my voice, you can do your homework, browse the internet, play music, etc.
So that’s how computers work on the inside! 3305/26/2020
Hands-on circuitsThis will be in the second part of the class
3405/26/2020
© 2020 IBM Corporation
Hands-on circuits In the class we have “suitcases” to wire circuits together
From home, we can do it on the web: e.g. https://logic.ly/demo
3505/26/2020
© 2020 IBM Corporation 3605/26/2020
1. Inverter(NOT gate)
2. OR gate
3. AND gate
4. XOR gate
A Out
0 1
1 0
A B Out0 0 0
0 1 1
1 0 1
1 1 1
A B Out0 0 0
0 1 0
1 0 0
1 1 1
A B Out0 0 0
0 1 1
1 0 1
1 1 0
© 2020 IBM Corporation 3705/26/2020
Note: the circuits on this page and next work well with our electronic suitcases, because each gate has a built-in delay,and because undriven inputs are “pulled down” (i.e. are 0).
On logic.ly a few settings will need to be invoked to make it work similarly:• Edit -> Document Settings -> No connection: Low• Edit -> Application Settings -> Simulation -> Limit Propagation to Frame Rate• Note buttons at lower left: Reset, Start/Pause Simulation, Advance Simulation One Step
10 Out
5. Delay Line
Tips: • Attach a light bulb to each output. Note the alternating pattern!• “One step” the simulation : ►► button at bottom left.• What happens if you use a clock instead of a switch at the input?
NOR gate = NOT OR = OR followed by inverter (NOT gate)
Not connected or drive by fixed 0
© 2020 IBM Corporation 3805/26/2020
OFF 1ON 0 Out
6. Ring Oscillator
Same as previous circuit, but we added the blue “feedback” wire.
Tips: • Attach a light bulb to each output• Use the reset ▐◄, start/pause ► / ▐ ▌ and one-step ►► buttons at bottom left
Question:• It works with 5 gates. Would it work with 4? With 3? With 2? With 1? Try it!!
How would you explain what you see?
© 2020 IBM Corporation 3905/26/2020
A1B1
A0B0
decimal
0 0 0
0 1 1
1 0 2
1 1 3
Inputs
S2 S1 S0 decimal
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
Output
Demonstration circuits in logic.ly
4005/26/2020
© 2020 IBM Corporation
1. Inverter (NOT gate)
• Input is toggle switch. You can toggle it between 0 = up and 1 = down.• Note that both the input and the output have a lightbulb and a 0/1 “digit” indicator, to make it easy to see the 0 and 1.• Does it behave like the truth table?• You can delete the toggle switch and replace it with the clock symbol as a driver.
(But if you delete something, you also lose its connecting wires, so you’d have to rewire it.)
A Out
0 1
1 0
05/26/2020 41
© 2020 IBM Corporation
2. OR gate
The two toggle switches are the two inputs, A and B
Again, each input and output has a light bulb and a 0/1 indicator
Can you toggle the inputs and verify that this indeed behaves like the truth table?4205/26/2020
A B Out0 0 0
0 1 1
1 0 1
1 1 1
© 2020 IBM Corporation
3. AND gate
The two toggle switches are the two inputs, A and B
Again, each input and output has a light bulb and a 0/1 indicator
Can you toggle the inputs and verify that this indeed behaves like the truth table?4305/26/2020
A B Out0 0 0
0 1 0
1 0 0
1 1 1
© 2020 IBM Corporation
4. XOR gate
The two toggle switches are the two inputs, A and B
Again, each input and output has a light bulb and a 0/1 indicator
Can you toggle the inputs and verify that this indeed behaves like the truth table?4405/26/2020
A B Out0 0 0
0 1 1
1 0 1
1 1 0
© 2020 IBM Corporation
5. Delay Line
There is one toggle switch -- which you may want to replace with a clock.
Again, each input and output has a light bulb and a 0/1 indicator.
All intermediate stages have a light bulb.
Can you see how the signal propagates left-to-right?
Bottom left buttons allow you to “pause” and “single step” the simulation
4505/26/2020
On logic.ly a few settings will need to be invoked to make it work:• Edit -> Document Settings -> No connection: Low• Edit -> Application Settings -> Simulation -> Limit
Propagation to Frame Rate• Note buttons at lower left: Reset, Start/Pause
Simulation, Advance Simulation One Step
© 2020 IBM Corporation
6. Ring Oscillator
Same circuit as delay line – but with a wire that feeds output back to the first NOR gate.
There is one toggle switch -- it now serves to start/stop the circuit
Again, each input and output has a light bulb and a 0/1 indicator.
It may require little playing to make it work.Start with Pause simulation, switch down (1 = circuit off), reset. Single step a few times, until it is stable. Then switch ON (up), single step further. Then let it run!
4605/26/2020
© 2020 IBM Corporation
7. 2-bit adder
The A inputs have the “ones” switch A0 above the “two-s” switch A1 By switching A0 and A1, you can make numbers 0 (up-up), 1 (down-up), 2 (up-down), 3 (down-down), as indicated by the top digit.
Same for the B0 and B1 -- indicated by bottom digit.
The sum is gathered in the right hand side digit indicator
Together, this circuit will add any number up to 3+3=6
Table on the right spells out all the16 possible additions you can do with this circuit, and all the binary stuff.
For bigger numbers, see page 29, which repeats the bottom 5 gates (a “full adder”) once more.On p.30 we show extension to a 6-bit adder.
4705/26/2020
© 2020 IBM Corporation
Questions ? Family Science Introduction to Electronics team:
– Ruud Haring– George Almasi– Eduardo Castro– Paul Crumley
Family Science coordinator:– Grace Kaplan
4805/26/2020
Extras
4905/26/2020
© 2020 IBM Corporation
Silicon is magical stuff -- it is a “metalloid”,sitting on the fence between metals and non-metals
5005/26/2020
https://commons.wikimedia.org/wiki/File:Simple_Periodic_Table_Chart-en.svg
MetalsNon-metals
Periodic system of the elements
© 2020 IBM Corporation
Binary NumbersBinary Decimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 155105/26/2020
In the familiar decimal system, the position of each digit matters.
For example, 4537 means (working right-to-left): 7 in the “ones” position (100) 73 in the “tens” position (101) 305 in the “hundreds” position (102) 5004 in the “thousands” position (103) 4000 +
4537
The binary number system also works this way, but with the positions taken by powers of 2 instead of powers of 10.For example, binary 1101 means (again, working right-to-left):
1 in the “ones” position (20) 10 in the “twos” position (21) 01 in the “fours” position (22) 41 in the “eights” position (23) 8 +
13
Q: what decimal number corresponds to 0010 1010 ?what decimal number corresponds to 1101 1011 ?
© 2020 IBM Corporation
Number systems -- it’s all about which tribe you belong toRoman Decimal Binary Hexa-
decimalN 0 0000 0
I 1 0001 1
II 2 0010 2
III 3 0011 3
IV 4 0100 4
V 5 0101 5
VI 6 0110 6
VII 7 0111 7
VIII 8 1000 8
IX 9 1001 9
X 10 1010 A
XI 11 1011 B
XII 12 1100 C
XIII 13 1101 D
XIV 14 1110 E
XV 15 1111 F5205/26/2020
Roman numerals worked, were used in Europe up to the 1300s, and are still found on clock faces and buildings. But calculations must have been very cumbersome. Good that you don’t need to go to a roman or medieval school!
Most humans these days use the (Hindu-Arabic) Decimalsystem. But different languages use different symbols!
Electronics (computers, robots, …) use binary numbers, because that simply corresponds to voltage on / voltage off.
Computer scientists and engineers use hexadecimalas shorthand for groups of 4 bits. It is simply more convenient to work with C0FFEE37 than with 1010 0000 1111 1111 1110 1110 0011 0111
Print-outsBefore the class, please print one copy of slide 54and 5 copies (or more) of slide 55
5305/26/2020
© 2020 IBM Corporation
Exercise
5405/26/2020
A B Output0 0 0
0 1 1
1 0 1
1 1 1
A OR B
A=0
?
?
?
?
B=0
01
11
10
A B Output0 0 0
0 1 0
1 0 0
1 1 1
A AND B
0
?
?
?
?
1
11
10
00
A B Output0 0 0
0 1 1
1 0 1
1 1 0
A XOR B
1
?
?
?
?
0
00
01
11
© 2020 IBM Corporation
Adder exercise
5505/26/2020
A2 A1 A0B2 B1 B0
Decimal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7
Inputs
S3 S2 S1 S0 Decimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 15
Output
Example: 3+6=9Inputs:3 A2, A1, A0 = 0116 B2, B1, B0 = 110
Output:S3, S2, S1, S0 = 1001 9https://researcher.watson.ibm.com/researcher/files/us-wendych/IntroElectro_adder.pdf
S3