[MUSIC] This lecture we'll talk about components in embedded systems, the hardware components. Specifically we're gonna talk about microcontrollers. We'll start talking about microcontrollers. We'll go on in the next lecture about that, too. The microcontroller is the center of the action, so we're good to start there. That's where we'll be mostly focusing this class really working with the microcontroller. So here's a picture of a board, an Arduino. There's different versions of Arduino boards. You have one or you may have one. This one, this particular board, you can see there's a big chip in there, that black chip over there. And, like the bottom part of the board and that's actually the microcontroller itself. And there are other devices on this board, but the microcontroller is that main chip in there that's going to be executing the programs that we're gonna write. So then note that the board, the Arduino board, we'll go into great detail about the arduino board in the next course. But the Arduino board has a lot of other stuff on the board to support the microcontroller, but the microcontroller is that particular chip right there. So a microcontroller is an integrated circuit that executes a program. So this picture of a microcontroller looks a little bit different than what we saw before. That's actually the bare silicon. So we're not gonna go into depth about how these things are made. But these chips, they're made out of silicon, the semiconductor. Mostly silicon, ours are silicon. And so there's a wafer, a small chip. That's actually what the tip of a chip looks like. But that's not what you use, it's not in a usable form yet. Before you can actually connect that to anything, you have to actually wire it up. You have to package it, what's called packaging. But that is a microcontroller, and it will be packaged and then it's gonna be integrated in the middle of the system. So, the microcontroller, its job is to execute code and it's the center of the system. So, it reads inputs from other components and it controls other components. Microcontroller versus microprocessor, so that's, it's a terminology difference. Basically, the way I think about it, I don't know what the formal definition, but I know how it's commonly thought of. Microcontroller is basically smaller and weaker than the microprocessor. So when you say microprocessor, you're thinking about what you'd find in a desktop, laptop, Intel whatever, AMD whatever. A big general purpose processor, general purpose digital signal processor. That's called a microprocessor. Basically, they're more heavy-duty. They can do, they're very fast, have a lot of memory, and all this. A microcontroller is more slimmed down, OK? More like what you would find in an embedded system or in an IOT device. Because remember, these devices, they have to be designed efficiently, right? We don't want overkill. We don't want to over design the system. We don't wanna buy the highest end processor, quad core, 4 GHz, whatever the highest end is at the time. We don't wanna buy that if we don't need it, right? For the task that we're performing, maybe we're interacting with users, and these users are only so fast. So maybe you don't need a fast processor. So you want the cheapest processor that will do the job. So you will go for a microcontroller, which is slower and cheaper than whatever the high end microprocessor is. So a microcontroller, generally, think of it as a lower end microprocessor. Roughly, that's what it is. So it's slower, typical, by the way these speed numbers are completely, they change over time. But a common ratio, so a microcontroller might be 16 MHz, that's a slow one. You can go slower than that, 8 MHz, something like that, 4. All the way up to, well I have 500 megahertz. 500 megahertz is sort of a high end, actually though if you look at say, Raspberry Pi, that's going 1 GHz I think, so it's twice that. So this whole, it's a shifting scale, this range. But generally microcontrollers are going to slower than microprocessors and going to have less memory, less of everything roughly. Yeah, lets make, fewer features, so there are lots of other features and we'll talk more detail about these in the next course. Specifically we'll talk about Arduinos and Raspberry Pis and. The processors, the mircocontrollers, that are on those devices. We'll talk in detail about what features they have, but they are less than the features that you find in your standard microprocessor for a desktop or laptop. So this picture, this shows a microprocessor after the silicone has been packaged so that you see it is a black rectangle, a black square in this case, right? That black is all packaging, and that packaging is basically to keep the chip safe. Also, it cools it, so it helps propagate heat out because these things get very hot. Also, you'll notice around the perimeter of the chip, of the circuit. There are these pins, they're called pins. These little pieces of metal, essentially, that are used to wire it to the rest of the components in the system. So if you look at that picture, it's a printed circuit board, a little piece of one. Actually this is the back side of one, so we can't see all the parts on it. But there are lots of other parts that this microcontroller or microprocessor is wired to through the printed circuit board. We're not gonna actually build printed circuit boards in this class because that costs money we're not gonna spend. We're gonna do this type of thing, this wiring, manually. But in a printed circuit board, there are what are called traces, little pieces of metal that are drawn onto the printed circuit board connecting different components. So the microcontroller is at the heart of the system, it's connected to lots of different components that are in the embedded system in the IoT device. And it takes inputs from them, and it sends control data out to them. Now, microcontroller needs to be programmed, it needs to run code. And that's what it does, it executes code. So you need to write the program in some language. Now there are many languages that you can write programs in. We will be using, when it comes to Arduino we'll eventually be using C/C++. And then when it comes to Raspberry Pi we'll be using Python. But you can use different languages. But at some point, you have to write a program in a language. And then that program has to be compiled or interpreted, and we'll talk about that in another lecture. And the result though, has to get transmitted on to the memory of that microcontroller. So it has to be placed in the memory of the microcontroller. So inside that microcontroller, there is always some flash memory. Flash memory is just a non-volatile memory, a memory that stays after you power off. So there's some memory and that memory has to hold the program so that when it gets power, it starts executing the program from the start. And we'll be doing that in the course of this course and the next course and all the rest of the courses. So, the microcontroller has to be programmed. So this term programming, in terms of a microcontroller, means we write the code. So first you'll write your program on some host platform, a laptop, desktop. Which is not the program that you're gonna execute, not the chip that you're gonna execute it on, not that microcontroller. You typically write the program on a different host processor like your laptop, desktop. So you write the program there, then you process the program, compile or interpret the program, or compile it and interpretation will happen later. But you compile the program then that final version of the compiled program has to get transferred to the microcontroller. Usually it's done through a piece of hardware, an external piece of hardware. So, here we see in the middle, there's a little board. That board is connected by USB to the laptop, and the microcontroller chip on the side of the diagram, that is plugged into the board, to this slot that fits the microcontroller. You plug it into the board, then on the laptop you would type, hit program, there's a button that hits program. You program it and it'll write the data into the memory of that microcontroller. So that's one way to do it. Now that is not exactly how we're gonna do it because we're using Arduino and Raspberry Pi. We'll show that later. Basically, the way an Arduino and Raspberry Pi work, is that a lot of this programming hardware that you see in there, that is built into the Arduino board and to the Raspberry Pi board. So, we don't need a separate device to program the microcontroller. That logic is basically built right into the board. So we just take our Arduino or Raspberry Pi and plug it into USB into the laptop/desktop. And we can program it directly. Thank you. [MUSIC]