We are going through a tremendous revolution right now in terms of hardware. So in the old days if you wanted to build something, you'd either have to go get a PhD in Electrical Engineering. Have to sit down and figure out, hey, I want to build a circuit. I got to really think about the details about how the electricity flows, and how to put all these things together. So it was really hard to build stuff. But recently things have been changing. There have been some amazing innovations that have happened that enable rapid prototyping without extremely advanced Electrical Engineering Knowledge, and there's been a few key breakthroughs, one of which is the advent of componentized circuits. Suppose you want to build something like a PH monitor for soil or something to stabilize your drone aircraft. Those are very advanced circuits. These are very challenging problems that you need to solve in hardware. But today, you can go buy a circuit that does these things. You don't have to go fabricate it yourself and design it yourself. It's already been designed, it's been componentized, so you can go to websites or commercial systems that sell these circuits, and you can just buy it and plugin into your design. Another recent innovation is Cloud-based Fabrication. So the idea here is if you want to build something, in the old days you'd have kind of have to get out your soldering kit, plug together wires, get everything working and it would never really be stable. Things would kind of fall apart, but now what you can do is you can go to websites and you can type in your design, or design it in a nice graphical interface and hit a button and they'll print it for you on a PCB and mail it to you. You could actually fabricate your design using commercial grade systems in billion dollar fabrication facilities to construct or design and they'll mail you a bunch of copies of your circuit. So you can build very stable, very rigorous systems using these sorts of technologies. Another thing that's been happening is the advent of Open Source Designs. So we've seen this happen in software. We've been hearing about Open Source Software for decades, Linux and Hadoop. There's all this work on kind of building code and putting it out there. So nowadays if you want to build a software system, you don't build it from scratch. You use existing APIs and Functions and software libraries. You got to take all that stuff and you build your system and you can do amazing stuff these days, you can build huge software systems that do incredibly advanced things by leveraging open source software. What's been happening recently is this has been happening in hardware as well. You can buy a chip that's empty. You can buy an empty chip and you can just download a design and put it on that chip. So there's been this creation of virtualization of hardware, and you can go online you can download IP cores and ALUs and you don't have to design the stuff. You can just download and use and use it as a black box. This has allowed IoT designers to do very advanced things without spending huge amounts of time or huge amounts of money to build all these little details. So in this lecture series, we're going to get under the hood and we're going to understand how that stuff works. But when you design this stuff, you can use the stuff often as a black box. Understanding it will help you build more advanced things, but when you build stuff yourself, you can often plugg together this existing stuff to build very powerful things and we'll talk about how to do that. So to kind of start from the beginning, let's talk about what hardware is, and let's start by talking about what electricity is. So you may have noticed that in your wall, there are these electrical outlets where you can kind of plug things in and they turn on, your light bulb turns on. Okay, but what is that? What is electricity actually? It turns out that there are these things called atoms. Okay. So all matter is made up of atoms. These little tiny pieces of matter and atoms themselves are made up of subatomic particles. You kind of think of them as being made up of protons and neutrons and electrons. Protons and neutrons you can kind of think of them as sticking together in a nucleus, and those are fixed in position and electrons kind of think of them as kind of orbiting around the outside of them. If you have a piece of material like a piece of steel or a piece of plastic, the nucleus, the nuclei of these atoms are held in position and they're fixed and the electrons kind of spin around the outside. Some electrons are different than others. Some electrons are really bounded that nucleus, they're like sticking really close to that nucleus, they spin around, but other electrons which are like a little bit further out are more free to move around and these are called valence electrons. What happens is these valence electrons can actually hop between different atoms. So usually these free electrons will hop around randomly. So if you have a piece of material with set of atoms and electrons kind of spinning around, these electrons will spin around the hop around randomly between the atoms, and so they'll spin around. But what we can do is if we apply a force to these atoms, like a magnetic force or an electromagnetic force, we can actually causes these electrons to be sucked in a certain direction, and this is what current is. Current is the movement of valence electrons through a conductor, through a material. These electrons typically move very slowly and it might be like a meter per hour, but what happens is the flow of electricity is fast because we have waves of these electrons moving quickly through the material. So it turns out that we can use these electrons, these flows of electrons to do useful work. So what we can do is we can take these things, we can take electrical sources so we can generate these electrical sources where we can create forces on these electrons and make them do work. So for example here I've placed a battery. Here a battery is a thing that stores electrical charge and I've placed a wire in a circle pattern. So a circle for electricity is called a circuit. So I've created a electrical circuit here and this isn't a very useful one. I mean, the batteries making electrons flow through the circle, it's not really doing anything very useful. In fact, it might be a little bit dangerous because there's nothing slowing down the flow of electrons here, they're just moving faster and faster, might overload the wire. But what I can do is I can take the wire and cut it, and stitch in a component that does something useful, and now I have a more useful circuit. I have a battery powering a light bulb. The electrons are flowing through and then they're going through the light bulb causing the light bulb to light up. So in general what I can do is I can make these electrical circuits and I can put components in there that do useful work. So some of these components do useful work like light bulbs and motors, but there's other sorts of components too that can manipulate the flow of current, and this turns out to be useful to you for various reasons. So it's possible to take current and manipulate it in certain ways that make it more useful to us. An example of a component that can do this is a resistor. So a resistor is a particular kind of component that can reduce the flow rate of electricity. Electricity is coming in really fast on one side and it'll slow it down, make it so less electricity comes out the other side is called a resistor. Another example is a capacitor. So a capacitor is a component that can store charge. So what I can do is I can store some electricity in it and then it'll hold it, and then I can release it later. It's like a little battery. So being able to manipulate properties of electricity turns out to be useful later as we'll see. But just to understand this concept of current, I'm going to show you an analogy which make this simpler since this the first time you're seeing this. So you can think of electricity is flowing water. So here what I have is I have a pipe in a little pump, and this pipe is in a circular pattern. So what I'm going to do is I'm going to take that pipe and fill it up with water. In then, I have my little pump there and I'm going to turn on the pump, I'm going to make it spin. As that pump spins, it is going to make water move around this rectangle, so the water is going to go around, so that's good. But what would happen if I took out a piece of this pipe, and replace it with a smaller pipe? What would happen to the flow of the water? I'll turn on the pump again. So if you think about it, what's going to happen is the water is going to come out with the same force from the pump where it's going to hit this constriction and the constriction is going to reduce the flow rate. So the water is going to come out slower after the constriction. So there's a lot of analogies between this diagram and a circuit. So if you have a circuit, we don't have pumps and circuits, say we have battery. So batteries are the sources of the force and we don't have water, and so we have electrons flowing in a circular pattern. But if you have a resistor, a resistor does something very similar to what a constriction does for water. The electrons are coming out of the battery, with a lot of force and they're hitting that resistor, and the resistor is slowing them down. It's reducing the rate at which electricity comes out, and goes through the rest of the circuit. So when we talk about these things like forces and rates and things like that. There's actually some technical terms that we use. I'll introduce those now. When we talk about water, when you think about water, we can think of water pressure. How hard the pump is pushing the water. We can talk about flow rate. How much water per unit time is moving through a pipe. We can talk about resistance. How much that constriction slows down the water flow. In circuits, we have technical terms like this too. So we talk about how hard electrons are being pushed, we don't talk about force because force isn't really the right term for that. We use the term voltage. Voltages, how hard electricity is being pushed around a circuit. We don't talk about flow rate of electrons. Instead, we talk about current. Current is how much electricity is flowing through a component or a wire per unit time, and then for resistors, we talk about resistance. So certain electrical components will slow down the rate, or the voltage of electricity and that's called resistance. So another example is for capacitors. You can think of capacitors as storing charge. So for water, maybe I have a bladder where I can turn on my pump, and the pump will push water in there. The lateral expand, some pushing water in there and it'll be stored and then later on I could turn off the pump and the water will flow backwards, water can be released. Some storing energy in this bladder. A capacitor is actually pretty similar in concept. So what I'm doing is I can push electrical charge into the capacitor. The capacitor will store and that can be released later. So the metric that we use to talk about charge storage, how much charge is stored in something is called capacitance. We'll talk about capacitance of capacitors. But other components have capacitance as well. You can even talk about entire circuits having resistance and capacitance and things like that. So at this point, you understand resistors and capacitors, and how you can manipulate electricity. How we measure different properties of electricity and things like that. But things are going to start getting a little bit more complex because there's more to circuits than just resistors and capacitors. There's a lot of different kinds of components that we use in circuits. There's thousands and thousands of different kinds of components that do different things. These components may do useful work. They may since things are actuate on their environment or they might manipulate properties of electrical flow, and they often do both of these things. So we're going to lead you through an overview of some of these components. This is going to be useful because when you sit down and build real IoT things, you want to have in your mind your toolbox, things that you can use to actually build these systems. So it's good to know about the different components, that you can use and what to look up if you need something. But before we get into that, I want to talk about communication a little bit. Because if you're going to get into this process of thinking about circuits and designs and things like that. It's important to document what you do. Because if you design something you want to write it down, so you can come back to it later and figure things out or you might want to share your design with other people or upload on a website to have it built. This leads to a really interesting question of how do you actually draw a circuit? It sort of motivation for this, let's draw a circuit. I'm going to tell you about a circuit that I have in mind that I want to tell you about. So here's what my circuit is going to do. I'm going to have a battery, and then I'm going to have some of these things here. I think I have one of these, and one of those and then, we'll put a resistor over there, and then I'll start hooking things up, maybe connect this to that, and then hook it up like this. So you can see what I'm doing here. I'm hooking things up like that. Let's do that. So let me ask you this. What does this circuit do? If I show you this circuit and you look at it, what does it do? What am I trying to do here? You'd have no clue, right? Because, what is this? What did I just draw? What are these different components? I didn't tell you what the components were. Why my hooking it up like this? There's that thing with a whole bunch of pins over the other side? What do those different pins do? So this is about kind of communication. We write something down. We need to remember what our designs are. We need to communicate them with other people. Was not just a matter of drawing a picture of the circuit, because that's not a very clear way to communicate. Ideally have some more clear way of describing, what each component is, what it does, what different properties are of the components, What resistance is that resistor there? Which pins are connected to what, and so on. So to do that, we don't draw circuits like this. Instead, we have like a shorthand that we use to draw circuits. So we have a set of symbols that we use to represent the different components. These are like little emojis for components, to make it more clear so we can see what they are. So for example, a resistor might look like this in practice, but if we're going to draw a circuit, we draw it like this. This is an internationally accepted symbol for a resistor. The motivation for it is maybe you can kind of think of the electricity is to go in and you jag it back and forth that slows it down when it goes through. A capacitor is drawn like this. The motivation for this is this is often how capacitors are implemented, you have two plates in there and you store electrical charge on the plates, and so on. There's diodes. So diodes are electrical components which are pretty neat. What they do is they make it so electricity can only go through them in one direction. Have you ever had like a toy or something where you put in your AA batteries into it and you accidentally put them in the wrong way, what happens is your toy catch on fire, when you do that? No, nothing happens, because the put diodes in there. So if somebody messes up and they put batteries and they're the wrong way, the electricity just can't go through that direction. So diodes are pretty useful for preventing electrical anomalies from happening. Is drawn like this. If you look at its symbol, electricity goes in one direction through it. You can see what direction that is from the diagram which where it'd be hard to see that if you're drawing like a little picture of a diode and so on. So there's different symbols for each of these components. You don't have to memorize these. But if you get into circuits, get into hardware designs, you might want to try to remember some of these because they're useful to know and they'll help you understand if you see a circuit, you can see what these different symbols are, or you can refer to the slide of the teaching. So if you have a circuit, you can actually draw things by drawing these components and drawing wires between them. So here I have a diagram of a simple circuit where I have a battery, some meters and a resistor in it's drawn like this. So you can clearly see the battery has so many volts, the resistor is so many Ohms and so on. So the circuit diagrams are clear ways to draw circuits. So if you want to build something, some device and you want to look up how to do it, oftentimes you'll go online and there be a circuit diagram. You're going to have to know how to read these, but you can do that now because you can just look at this sheet or look up the set of symbols and you can see how they're plugged together and you just recreate that wiring. So you can do that. So that's good if you want to look at some existing diagram and some existing circuit. But what if you want to create your own circuit? Well that's a little bit harder to deal. So you need to think about what you want to design and translate that into a circuit in a design. So it's a little bit more challenging, but you can do that too. There's a series of steps you should go through when you're trying to do that, and that can make this process easier to do. So the first thing that's good to do is, just go sit back and think about what you want to build in the first place, maybe you're building a drone. So what's that drone going to do exactly? There going to be lights on it, are there many sensors. So think about what the different components are, the different functions that you want to do and think about how that data or the electricity needs to flow between them. So think about what you want to build on what the requirements are. Then design a circuit that achieves that objective. So think about what you want do in where the information and electricity should flow and what the different pieces of it are. Then design a high level diagram of what you want to achieve. Then once you have that, then break it down into components. Think about the individual pieces of the circuit and what the critical parameters are, what you want them to do. Then once you've done that, then go ahead and choose out the specific components that you want. Here's where you start thinking about what you want those individual components to do. So you've narrowed down the problem and you figure it out, "Okay. I need an oscillator." Okay. So how fast you want that oscillator to oscillate? What voltage ranges? Should it work over? Does it need to handle getting hot or getting wet? So you can think about what desirable properties you want each of these components to have, and then you can choose out components that match those properties. So when you do this, one question is, how do you know what properties each of these components have? Well, when you buy them, you're going to buy them from a manufacturer. What the manufacturer is going to do is, they're going to have a what's called a data sheet, which is going to tell you about the properties of that component. This might be just like a web page where they describe some properties of it. But oftentimes, manufacturers produce very detailed specifications that give you all details about that component. So you might buy a little resistor for $0.10. But that little resistor will often have a PDF document that's 30 pages long that describe all these properties of it, exactly how much voltage flows through a given a input voltage, how it operates over different temperature ranges and so on. So data sheets are very useful. You find them by going on Google and type in the specific name of the component, the idea of it in the work data sheet, and then you'll be able to find it. So you want to figure out the properties that you want and choose components with those properties. Then you can also think about components that reduced the complexity of your circuit to. Maybe you have a set of components achieving one objective, but maybe there's some other component you can buy that fulfills the objective of that set of components. You can reduce complexity of your circuit. One example is ES protection. So unless you've ever like walked on carpet and move your shoes around and then touch somebody, you give them a little zap of electricity. So humans are actually pretty good capacitors, they are pretty good at storing electrical charge. That's bad for when we touch circuits, electricity can flow out of us and damage the circuit because it was going to be really high voltages. So when you build devices, oftentimes you want to protect them against electrostatic discharge like that. Some components are better at that than others. So you can choose components that if you care about this are protective against that sort of discharge. After that, you want to think about how these components fit together. So you have a circuit, you're going to choose compounds that fit together in the circuit well. You might want to think about things like documentation, there's a bunch of different circuits. Are they built by a reputable vendor? Are they going to be reliable? Things like that. Then once you have everything together, you can start building your circuit and smart to prototype before you start production. Because you can write everything down on paper, but sometimes you don't see certain issues until you start building things out, things don't fit together the way you thought. So it's important to actually build a prototype before you start producing your designs. Okay. So that's about how you figure out how to build a new circuit. Oftentimes you do download circuits from the web or look at existing circuits on the web and modify them to your uses. But you shouldn't be afraid to sit down and experiment and try and build your own circuits, you can do that as well.