 Okay, so let's start with the game. Since this is going to have audience in direction, I'm sorry if it can't make the camera move. What are some of your favorite microcontrollers and microprocessors? So who wants to go first? Shut up. Arbino Raspberry Pi. Arbino Raspberry Pi? Okay, so Arbino is a microcontroller. Raspberry Pi I would say is a microprocessor, but we'll get to the details. What are your most favorite ones? Come on. 851. Anybody else? Come on guys, I'm sure everybody knows and loves some microcontrollers. Motorola HC-11. HC-11, okay. Beaglebone. Woohoo! SDM32. Amix makes our desktop controller. Anything, which one do you want? Latte and Panda. MSP430s. Anybody else? If you love some microcontrollers and microprocessors, chat it out. Z80. Z80 is nice. 8086. Very cool. There is a bunch and you will also be able to get people's age based on which one they really like. Usually. But my whole talk happened because this happened. For people who don't know, Jeff Atwood is a guy who created Stack Overflow, so it's pretty massive and pretty well-known and popular in the software world. And he said that why would people ever want to use Adrinos if you can buy a Raspberry Pi for $3? So I said I see a $3 and I raise you a $9 chip because $3 is too expensive for a microcontroller. And somebody came up and said, well, you can buy a Raspberry Pi 0 for $5. I don't know where you can buy a Raspberry Pi. Anybody here has a Raspberry Pi 0? Two people. Everybody else, steal the one from them. You don't have it. But that's the problem. Nobody knows when these Raspberry Pi 0s are ever going to be available. But anyway, this talk is going to be about Arduino versus Raspberry Pi 0. Not really. But let's talk about the facts. Let's take the Arduino and the Raspberry Pi as examples of microprocessors and microcontrollers. Where Arduino is a microcontroller and Raspberry Pi is a microprocessor. Of course, there are different ones with different specs and everything. But let's take these two examples and look at what the differences are and where the differences come in. Let's replace every single microcontroller with a $3 Raspberry Pi as Jeff Atwood said. This is from the data sheet of an Arduino. It's an 8-bit microcontroller. It runs about 20 MIPS at 20 MHz. It has a bunch of Flash, RAM, and Epo. Standard 8-bit microcontroller. I think special. I think fancy. Just very good work cards. Interesting things here. It has a temperature range of minus 40 to 85. It has an active mode of 0.2 milliamps and some powered-on modes, which are even lower. Raspberry Pi, on the other hand, I couldn't get a good data sheet. Unfortunately, they don't provide data sheets for the BCM 283567 chips unless it's 90 years or something. So this is the best I could get. So it's a much more powerful processor. One point to be given is 64-bit for the latest one. And 800 milliamps of current draw-in. It's normal usage. So what's the difference? One of the main differences between the two is how they deal with processing. Arduino is inherently a single-process computer. It can generally... For most companies, it runs one task and only one task. So if you write the app, let's say you're running an app for an Arduino, you run an Arduino library, and that entire thing runs straight on your 80 Mega 328 processor. That's it. There's nothing in the middle. Straight-up code running on that 80 Mega. If you're running stuff on a Raspberry Pi, though, you have an app, maybe use a library, like, you know, Lib-C or whatever. It runs on Linux, usually. That usually uses some kernel drivers that then causes some GPI pins to flip on and off, and then you give your blinking. But at the same time, you could have multiple other apps running as well. So the model of microprocessors usually, again, I'm talking about most common use cases. Of course, you can always make your in a Raspberry Pi run in other ways. And we'll get to that. Do you generally always have multiple apps and multiple things running on a Raspberry Pi? Was that love, Jeff? I would explain specifically that everything will run Linux. Yes, yes, yes. And specifically about Linux. So the reason you can do this on a Raspberry Pi, the reason this is really fast and effective in a Raspberry Pi is something called an MLU, a memory management unit. These are, most microprocessors have these, and these let you switch tasks very efficiently. And this then brings us to the concept of real-timers. So you ask, what is real-timers? And unfortunately, this is the best explanation I got. I'm not going to wait for you to read this. You can go check out the link to this in the description at the bottom. But I'll give you an example of what it does. How many of you here have used NeoPixels? All right. Very common, nice entities from InterFood or from Aliexpress. And if you look at the datasheet, to drive them, they require this very, very, very particular timing again. If you look at top left, you will see it's 0.35 microseconds pulse for high, and the tolerance is 115 nanoseconds. If you don't get this timing right, you don't get the color you want. So driving these entities is extremely time-critical. If you don't get your pulse widths perfectly right, you get their own color. And on an Arduino, the way it manages, this is from the InterFood NeoPixels library, is a lot of hacks. It's 100 and a 70 code, with extremely critical timing. So they have stuff like relative jumps, which they know exactly how long each jump instruction is going to take. And they use that to time the distance between different pulses. You need to do these kind of things and this kind of critical timing to be able to do something very, very specific that the NeoPixels needs. And this is real time. If accidentally something comes in the middle and pauses for half a millisecond, your timing is totally gone and you can't drive the NeoPixels at all. So to be able to do this is what real time talks about. So then let's talk about Linux. How does Linux does things? So what if I told you Linux is in real time? This happened to me in school months, a long time ago. Professor told me that Linux was in real time and my mind was broken. The thing that happens in Linux is the kernel preempts you. So if you're running a program, it's happily going around and making, you know, a GPI going up and down in the process. It can happily stop your process completely and says, oh no, it's time for the GCP stack to run because you're getting a new packet or it's time for the top to run because you're getting a new packet or you're getting some other input from a keyboard. And it stops your process, runs the other process and then brings your process back. Well, that's really fast, but if your tolerance is 100 nanoseconds, that's not fast enough. The kernel is going to take longer than that. And that is exactly why this is not real-time. But then actually, that's not technically fully correct. Linux has a variant of a real-time Linux. You have to come by your own kernel though. But you can make it run real-time where you can get a kernel to not preempt you or in some cases even preempt the kernel itself. You can read up more about it on the preempt underscore rt. That's the name of the patch. Also there are other ways you can go around these kind of real-time requirements. For example, there's this NeoPixel Raspberry Pi library which is hacked all the way down. They actually do things like map the entire memory and manually pitch through it and write hierarchy to hardware registers and use PWMs and DMAs through the user space. Ugly. Ugly. But really fun to read code. Why do you need real-time processing if you're doing any kind of order patrol, feedback loops? If you're doing any kind of signal processing? If you have thousands of bytes of data coming in you only need to process it and feed it forward within a specific amount of time. For example, stuff like microphones. Or if you're doing any kind of user interfaces, musical instruments, you need very critical real-time requirements. But you don't run Linux. So sort of going away from AdWords thing, you can do things like free-or-cost which lets you do real-time operations on microcontrollers, microprocessors. It's a full operating system or a pretty good operating system and it's real-time. There's also something called UCLinux which is Linux for microcontrollers. So there are a lot of options. And like I said earlier, you can always go bare metal. So you can always take a Raspberry Pi and write SMB code or C code without any Linux on it. And it's a very nice course by University of Cambridge if you ever want to pick that up. I know a bunch of people including Paul Schiff like this. It's a pretty really fun. No, this is bare metal. Another difference between the two is power consumption. So if you're using something like an Arduino, if you're just drawing 0.2mA you could power your point cell by powering a Raspberry Pi after a point cell. So again, some things you really cannot do with something like a Raspberry Pi is super low-powerful because inherently it grows a lot of power. Then again in the manufacturing this is where stuff gets really interesting. Price for IC is very different. Raspberry Pi costs about so the AT Mega chip costs about $5.59. You can't find how much the BCM chip costs that's on a Raspberry Pi but if you look at the similar chip from FreeSkill IMX it costs about quite a lot of the chip. Power Deletes is another one. If you want to power the same chip as what is used in Arduino you just give it a 3.3V BCC and a grounding color a day. If you want to power a similar chip like the IMX6 it needs its count. 1.35V, 3.15V, 1.1V, 1.2V, 2.5V, 0.16V, 3.16V, 1.5V, 1.8V, and 1.2V of all different currents. You generally need a separate power management IC to provide all these different routes for the chip. In fact, the data sheet for this chip recommends that power management IC for you. Pins. Pins are also very important. The AT Mega is what we need. PQFB package. All the big microprocessors are generally VJs and VJs are horrible. You can ask Chan if you want to know how VJs has been having fun making things that look like this recently. And actually this has multiple problems. This is multiple problems. The more pins you have the more number of layers you have to go which means your PCBs are going to be more extensive. And the more number of pins you have means the more your SMB house is going to charge you because it really charges you poor pin. So if you have a Raspberry Pi kind of a microprocessor with a 100 or 500 pins, you know, just to make blinkies, you're going to pay out of your nose for just SMB manufacturing. So this is massive differences. But then, the last point I want to leave everybody with is the lights are blurring. There's a lot of fun stuff you can get these days, like devices that have both Cortex-A9 full flash microprocessor done in Linux and Cortex-M4 which is a microcontroller and they are in the same package. So you can use them together. Another example of this is the Vigubon. Vigubon has something called the PRU the programmable real-time unit and it's basically a tiny little 32-bit microcontroller that does a lot of that you can use, that you can program. Or you can get some really, really beefy microcontrollers and just, you know, blast your way through things. At the end of the day, I want to say choose your poison. There's a lot of pros and cons. There is no one solution, but whatever you need for your project is what you should choose not just a $20 restaurant.