E40M An Introduction to Making: What is EE? Mark Horowitz Stanford University horowitz@ee.stanford.edu Copyright © 2015 by Mark Horowitz M. Horowitz E40M Lecture 1 1 WHAT IS MAKING? M. Horowitz E40M Lecture 1 2 Big Picture • Want to go from this: M. Horowitz E40M Lecture 1 3 To M. Horowitz E40M Lecture 1 4 It Has Never Been A Better Time For Making • You have access to technology I never dreamed of – That is, you can do almost anything • Most of it is cheap, cheap, cheap – So you can afford to play around • There are so many areas where we need help – Energy, environment, health – And toys, too! M. Horowitz E40M Lecture 1 5 The Problem: Last of Clarke’s Three Laws • When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is probably wrong. • The only way of discovering the limits of the possible is to venture a little way past them into the impossible. • Any sufficiently advanced technology is indistinguishable from magic. M. Horowitz E40M Lecture 1 6 Demystifying Magic: Learning to Look Inside • To become the magician – And not be part of the audience • You need to take things apart – Both literally – And figuratively • So you understand how it works – Someone had to put it together – And they weren’t smarter than you • You need to have faith in yourself – And a little practice M. Horowitz E40M Lecture 1 7 Who is Mark Horowitz? The Key to Understanding E40M… M. Horowitz E40M Lecture 1 8 I Have Been Breaking Things for Over 55 Years • Starting by throwing toys against the ground – Made it a little hard to put them back together – Other kids did not like me to visit them … • Learned to be more careful – Everything had to be put together – And glue is “expensive” • When I was a kid I would offer to fix anything for free – But you couldn’t need to get it back – There was a chance I would destroy and not fix it • But something amazing happened – I stopped breaking stuff M. Horowitz E40M Lecture 1 9 E40M Is A Way To Share My Passion • After taking a ton of things apart – Almost everything today is a combination of: • Electronics, computing, and some mechanicals • We want to help you leverage today’s technology – To create a future I can’t imagine – And have fun in the process • Goal of this class is a first step in this process – Enable you to create things that combine EE/CS/ME – Further your passion to learn more about EE M. Horowitz E40M Lecture 1 10 Class Projects • Solar USB charger • Useless box • LED cube • EKG All based on learning some EE, and Arduino programming M. Horowitz E40M Lecture 1 11 CLASS LOGISTICS M. Horowitz E40M Lecture 1 12 Workload • We think that you will get out of a class what you put into it – And we want you to get a lot out of this class • So if you are looking for an easy class to satisfy GER – Take another class! • But in return for your time you will learn valuable skills – For both work and play – And you will build toys you get to keep • And we will try to make the class fun! – So (we hope) the time you spend on it just flies by – If it is not fun, please let us know! M. Horowitz E40M Lecture 1 13 Class Requirements • Attend lecture and do the prelabs! – We will work on some of the prelabs/homework in class • Do the lab project each week – You will sign up for a 3 hour lab slot – Work in 2 person teams – partners will change w/ projects • Homework each week reviews key concepts – Not meant to be time intensive, checking you got key points • There will be a midterm and final M. Horowitz E40M Lecture 1 14 Grading • 50% - Lab assignments – 25% Function – 25% Style • How clean is your physical design? – Did you follow good lab techniques – Clean construction will also make your designs easier to debug • How easy is it for us to understand your code? – Or, how easy will it be for you to understand your code in 3 months • 40% - Exams – Midterm, Final – equally weighted • 10% - Homework M. Horowitz E40M Lecture 1 15 Lab Logistics • Class will be divided into groups of 8 - 10 people – Each group will have a “master maker,” a.k.a. CA, SL – That person will help you throughout the year – Projects will be done in teams of 2 people – You will partner with ½ the people in your group • Lab is located in Packard 130, 131 – It is the first floor near Bytes Café – You will have an assigned time – But can come to the lab at other times to finish up projects, if there’s a free bench. Monday will have no scheduled lab sections, but the lab will be open for much of the day. M. Horowitz E40M Lecture 1 16 Part Kit / Lab Fee • You will each get parts to build all the projects • The parts cost the EE Dept. more than $100 – Even though we tried to find the cheapest vendors … • So the $100 lab fee for the class is to pay for the parts – They are in the boxes up front • If you are sure you are going to take this class – Please pick up a box. We will need to check your name off M. Horowitz E40M Lecture 1 17 Important! • Debugging is hard – By definition things are not working they way they should • Or at least the way you think they should – You need to find the error • Could be in your understanding of the problem • Could be what you built is not what you think you built • Could be that the part/board is broken • Don’t let it get to you – It is frustrating for everyone – Ask for help, fresh eyes are great • That is what the Master Makers are for M. Horowitz E40M Lecture 1 Clipart from Cliparts.co 18 General Life Advice: Focus on What You Know • The fact is there is a ton you don’t know – But there is a ton we all don’t know • (even your Profs, CAs, and section leaders) – That doesn’t mean you can’t work out the problem • To work problems, you need something to work with – And that has to be the stuff you know • Take that information and see how far you can run with it – Work as far as you can, and find more information – Work in multiple directions at the same time – Learn to connect what you know M. Horowitz E40M Lecture 1 19 Rough Outline of the Class • • • • Week 1 – Introduction to Making; Building a solar charger – Voltage, current, power; Batteries, DMM Week 2 – Solar Cell, understanding how to reason about circuits – Building a useless box; switches, motors Week 3 – Breadboards, MOS transistors, digital logic – Building a computerized useless box; Intro to Arduino Week 4 – Learning how simple computers work; Coding – LED Cube; Light and diodes revisited; Planning M. Horowitz E40M Lecture 1 20 Outline cont’d • • • • Week 5 – Midterm; Controlling you LED cube; – Music; Signal Representation Week 6 – Capacitors; A new way to think about circuits, impedance – Tricking out your LED cube Week 7 – Filters; Human electrical system; Op-amp – Building an ECG; Building amplifiers; Week 8 – Safety issues for ECG; Instrumentation Amp; Noise filtering – Measuring your ECG; Introduction to power conversion M. Horowitz E40M Lecture 1 21 Outline cont’d • Thanksgiving • Week 9 – Creating circuits to shock you, and power your laptop • Week 10 – Course review M. Horowitz E40M Lecture 1 22 The Textbook • We are putting together a reader for this class, and most of the material should be found there • In addition we will have references to A. Agarwal and J. Lang, Foundations of Analog and Digital Electronic Circuits, Morgan and Kaufmann, 2005 • The textbook is generally more mathematically rigorous than the lectures, the homework, the labs, or the exams, and is available on-line • Coding in general and Arduino coding in particular are not covered in the textbook, but will be covered in the labs M. Horowitz E40M Lecture 1 23 BREAKING BREAK M. Horowitz E40M Lecture 1 24 Please Bring Me Your Broken Stuff • Most classes will have a breaking break – Where we will look inside a device to see how it works • I have lots of stuff that I have taken apart – But it is more fun, if new stuff shows up too • So if you have some old electronic thing that doesn’t work – Bring it in, and we can try to fix it during class – Or at least show what is inside during class • And we can try to fix it later in the lab M. Horowitz E40M Lecture 1 25 What Is This A Picture Of? M. Horowitz E40M Lecture 1 26 Taking an LCD Apart M. Horowitz E40M Lecture 1 27 The LCD Backlight http://www.dpes.com.cn/products/detail/2012/04/4289.html M. Horowitz E40M Lecture 1 28 Let’s Start With Something Simpler M. Horowitz E40M Lecture 1 29 E40M Lecture 1 Building a Solar Charger: Charge, Current, and Voltage Copyright © 2016 by Mark Horowitz M. Horowitz E40M Lecture 1 30 Roadmap In this lecture we start talking about the fundamental things we need to understand if we want to “make” a solar charger. We start with charge, which is the thing that makes the system electrical. Electrical signals are about the movement of charge. The movement of charge is called current (i), and voltage (V) is the potential energy that causes charge to move. M. Horowitz E40M Lecture 1 31 Learning Objectives • Understand that charge is what makes components electrical – Moving charge is called current, and often represented by “i” • Measured in Amps = Coulombs/sec • Understand that all components and wires are charge neutral – This means that the net charge flowing into an object is 0 – KCL – The sum of the currents into an device or wire = 0 • The energy that causes the charge to move is called Voltage – Measured in Volts = Joules/Coulomb – Voltage is a potential energy difference • Measured between two nodes • Be able to use your DMM to measure voltage M. Horowitz E40M Lecture 1 32 What Does It Do? • Takes energy from sun light • Stores it • Provides that energy later – To charge your cellphone – Create reading light, flashlight How does it do that? M. Horowitz E40M Lecture 1 33 How Our Solar Charger Works • Converts some energy from sunlight into an electrical signal • That electrical signal connects to a rechargeable battery – So energy flow from solar cell to battery • Another electrical signal connects the battery to the USB port – So energy can flow to the USB, and charge your phone • So to understand how this and other stuff is made – Need to understand electrical signals M. Horowitz E40M Lecture 1 34 Electrical Charge • In electrical systems charge is the stuff that does the work – In some ways, charge is what makes the system electrical • Charge is measured in Coulombs – 1 coulomb is a lot of charge – Each electron has a charge of -1.6 x 10-19 Coulombs • Charge can flow (move) in a material that conduct – Usually call this an electrical device M. Horowitz E40M Lecture 1 35 An Electrical Device • An object that charge can move through – That is current can flow through it M. Horowitz E40M Lecture 1 36 Inside a Device • A device is charge neutral – Has both + and – charges – In a device, one of the charges can move - - - - M. Horowitz + - + - + - + - + + - - + - + - + - + + - + - - + - + E40M Lecture 1 + + - - - + + - 37 Current • Moving charge is called current – Current is the flow of charge per second • Past some measure point • Its unit is the Ampere, usually called amps and abbreviated A – 1 A = 1 Coulomb/sec = 1 Cs-1 • When people write equations for current – Current is represented by ‘i’ in most equations (huh?) • First referred to as “l'intensité du courant électrique” M. Horowitz E40M Lecture 1 38 1st Rule: All Electrical Devices Have Two or More Terminals • All electrical devices are charge neutral – That means the charge stored in the device is zero – The charge that leaves one terminal, must re-enter another • Thus, they must have more than one lead • The net current into any device is always zero – Current that flows into on end of a wire must flow out the other – Often called KCL (Kirchhoff’s Current Law) M. Horowitz E40M Lecture 1 39 Charge Entering = Charge Leaving • A wire is charge neutral – Has both + and – charges – In a wire, one of the charges can move - - - - M. Horowitz + - + - + - + - + + - - + - + - + - + + - + - - + - + E40M Lecture 1 + + - - - + + - 40 What are the Little Black Lines • When you want to connect two devices – Generally draw a line between then – This line just indicates the path of the current between the devices • In the real world you use a device called a wire – More about the properties of wires later M. Horowitz E40M Lecture 1 41 Constraints on Currents (KCL) M. Horowitz E40M Lecture 1 42 If You Think of Charge as a Liquid • Current is then the flow of the liquid • Current constraints are then about fluid conservation – The fluid in any object is constant • But we know that a fluid doesn’t move unless it is pushed – What pushes charge to make it move? A Voltage Source M. Horowitz E40M Lecture 1 43 More About Charge • In Physics, charge is a fundamental property of particles – Particles can have + charge (protons), - charge (electrons) or have no charge (most stuff) • Like magnets, like charges repel, and opposites attract – Think of balloons and static electricity (that is charge) M. Horowitz E40M Lecture 1 44 What Happens If You Separate Charge? • Imagine inside of a device you have an electron pump* – The pump takes electrons and moves them to one side – It leaves the a positive charge on the other side of the device • So the device is still charge neutral as it must be *an M. Horowitz example of an electron pump: a battery E40M Lecture 1 45 Separating Charge • The device is still charge neutral - + - - M. Horowitz + - + - + - - + + - + - + + - + - + - + - + - + E40M Lecture 1 + + - + + 46 Remember That Like Charges Repel? • They don’t like to be with their brothers – Repel means that there is a force pushing on the charge as you try to move the electrons together – It takes energy (force * distance) to move the charge – It is just like pumping water up a hill • I have a little demo here… M. Horowitz E40M Lecture 1 47 Measuring the Potential Energy • Voltage is a measure of this potential energy per unit charge – It is measured in Volts • Which has units of Joules per Coulomb. • The charge on the higher energy side of the device will move through an external path (a wire) to neutralize the negative charge on the other side of the device. – This causes the charge to flow in the circuit, as well as through the device. M. Horowitz E40M Lecture 1 48 Representing a Simple Circuit lead node M. Horowitz E40M Lecture 1 49 Representing a Simple Circuit 5V M. Horowitz + – E40M Lecture 1 50 What is a Battery? • It is a chemical pump for electrons! – There is a pair of chemical reactions that pump electrons from anode to cathode • Actually, a battery absorbs electrons at the anode and creates electrons at cathode (with ions moving through the middle), but it has exactly the same effect – The battery voltage is the potential energy given to electrons as a result of this pump. • The voltage of the battery depends on chemicals – Generally either 1.5 V, or multiples – Or around 3.5 V (lithium) M. Horowitz E40M Lecture 1 51 IN CLASS ACTIVITY M. Horowitz E40M Lecture 1 52 Digital Multi-Meter (DMM) • Is going to be your friend • It measures voltage and current – Measures voltage from red wire to Voltage the black wire – Measures current flowing from the red wire to the black wire • • Current It steals very little current when Resistance measuring the voltage It has a small voltage when measuring current (< 100 mV = 0.1 V) M. Horowitz E40M Lecture 1 53 Measure the Voltage of an AA battery • Take out your DMM – Turn the main dial to 2000 mV = 2 V – Put the red lead on the + end – Put the black lead on the - end • Is the result 1.5 V, as advertised? • What happens if you put the red lead on the – end? • Measure the voltage of two batteries in series – Hint: need to move to the 20 V scale M. Horowitz E40M Lecture 1 54 Learning Objectives • Understand that charge is what makes components electrical – Moving charge is called current, and often represented by “i” • Measured in Amps = Coulombs/sec • Understand that all components and wires are charge neutral – This means that the net charge flowing into an object is 0 – KCL – The sum of the currents into an device or wire = 0 • The energy that causes the charge to move is called Voltage – Measured in Volts = Joules/Coulomb – Voltage is a potential energy difference • Measured between two nodes • Be able to use your DMM to measure voltage and current M. Horowitz E40M Lecture 1 55