James: 00:08 Frank, it is the very last podcast of 2019 we made it another year. Frank: 00:15 Oh geez. It's a tax season already. Am I supposed to be doing tax? Oh God, I hate the end of the year. I always feel like I'm forgetting something. Like I feel like I'm skipping emails. It's my CPA emailing me is the insurance dudes emailing me. Oh I hate the end of the year. But congratulations. Yes, we've made it just they are. James: 00:33 So to go is a big year. I mean I got married this year. That happened. Frank: 00:37 Woo. Woo. Does the clock tell you you've been married this year? Is the clock dead by. James: 00:43 clock is sitting literally in front of me right now because the battery Def four months, five appoint two days. Boom. Frank: 00:51 Congratulations. Four months. It's a long time. Wow. That's a pretty big event. What else happened in 2019 I don't mean to roll over your marriage that quickly. Sorry. What else though? Frank: 01:02 James, what else is that? It, is that all he got for 2019? James: 01:04 Um, I think, I think that might be, I mean I'm really looking forward to 2020 to be honest with you. Okay. But yeah, I mean we hit some major milestones in the pod. I'm not, this isn't going to be a recap of of the whole thing, but this episode one 82 which is way pretty spectacular. Frank: 01:24 I thought we were going to do a clip show. He told me you were going to edit together a very complex three hour long clip show. I mean, no. Are we doing a star Wars holiday special then? James: 01:33 No, no, no. We're not doing that. No, we're not doing any of that. What we actually have in store is not a stat show, not a 2019 recap. What we're doing today is something Frank has no idea what we're talking about by the way. James: 01:45 Cause when we, when we go into podcasts sometimes I'm just like, I've got a topic go and that's what's happening this week, Frank. It is IOT one Oh one. Frank: 01:58 what? Okay. I feel like we've talked about IOT. Can we call it one Oh two now I'm being [inaudible], James: 02:05 but this is going to be even more specific on the IOT. This is going to be IOT programming one Oh one all right. Frank: 02:15 All right. I can do this. I can roll. I think I remember the basics. Not supposed to forget the basics. So yeah, let's do it. So can we hook it up to Alexa? Is that covered in the one-on-one class? Can you give me the full syllabus? James: 02:29 What I want to specifically talk about what we can do at home as developers with hardware. So I don't want to talk about the consumer level stuff, which we've talked about in depth before. James: 02:42 I want to talk about the the boards that we can buy, how you get started in what it actually means. Like what are they? And here's the setup, Frank. I decided that last week I was going to do a little holiday hacking. You know my holiday hacks. I've been looking forward to hearing how all that went. So let's hear it. So I don't want to go too in depth, but here's the starting point that led to this conversation today is I busted up in my meadow board, which is a from wilderness labs that runs.net and I started playing around with stuff and I wanted to blink some led. So I blinked to led on the board, which is, yeah, I did it. And I go, okay, I'm going to, you know, put my breadboard over here and I'm going to start to put stuff together. And someone said, it doesn't look like your header pins are connected. James: 03:31 And I go, what are header pins? And then I said, I'm just going to, I'm just going to take the wires and the grounds. I'll say, you'll put them in the holes and, and nothing worked. Frank. Um, someone said I needed to do something called soldering. Um, Oh apparently I've heard of that one. Put, put the, put the, you know, put the, you know, the ground wire into the hole and put it into the hole in the breadboard and that should should work. And then someone said, someone was asking me like, what are these boards? And I'm like, you, I'm the worst person to ask about these boards. Right? I don't know what I had a pin is, I don't know. I don't have, I don't even have a soldering gun. Um, I don't know. I don't know anything between a ground and a not ground. James: 04:14 And like there's like, I'm looking at all the things in this pro hat kid that I have and I needed, I dunno some, Oh, I'm going to look it up. This hack stir, I mean, let me go to the wilderness labs getting started and like, literally I was getting started and let me see what I needed here. Assemble. Hello meadow. So there was, Oh geez, I'm the worst at doing this really quick. Let me find, there's literally a thing that's like, I need, um, another wire and it has a little thing with a bunch of like colors on it, like a reactor re receptor, a re probably a resistor. Resistor. There we go. Right? Then again, I'm like, and then someone's like, so I'm putting this stuff together, and someone was like, what is this thing? Is this a raspberry PI competitor? Like is it this thing? James: 05:04 Like what? Oh, what a CPU is it running? I was like, I don't know. And then someone's like, it's like, so all of a sudden I'm like, okay, I'm in this world where I'm actually building and blinking lights, but I didn't really fundamentally realize like what the difference between like a raspberry PI is and an Ardwino or net Duino and what a microcontroller was. And that's the, this is the one-on-one stuff that I actually need broken down. Does this make sense where I'm coming from now, man, I am going to give you an electrical engineering degree or your degree in one FFL this is so going to happen. I love it. We're doing this man where you are. So going here, but I think it's, it's anytime you want to make things sound easy and I'm always doing this, I'm like, yeah, IOT. It just go get this thing you, you write your C sharp codes, it's easy. You'll be running right Frank: 05:58 away. And what I actually mean is, yeah, you'll be blinking led right away. But we've just opened the door. Actually that's a bad analogy. We just fell down a rabbit hole, a very, very deep rabbit hole, one in which people get degrees to learn all this stuff and learn how it works and get comfortable with it. But the good news is, um, it's all learnable. I do think it is actually easy, but it is a lot of concepts, a lot of capitalized nouns to learn proper nouns, to learn, uh, differentiations cause people love to compare and contrast. So all these questions people are asking, you are pretty irrelevant. Like what, what microprocessor you using, who cares? It's 20, 19. Who cares? Um, whichever one works, what the answer is always there. Um, but yeah, we can definitely go over all this stuff and I can do my best to answer whatever questions came up during it all. Frank: 06:56 Perfect. Well, let's start at the very, very start. What is the difference between a microprocessor and something that's not micro? None of microplastics or sorry. Uh, a, what did I just say? It was micro controllers. Hopefully the word you're going for. Yeah. What is the difference between a microcontroller and not a microcontroller? Well, oddly enough, we should start with a microprocessor cause that is actually a great place to start. So your microprocessor is your CPU, your central processing unit. It's what we're all really programming. But as we all know, programming is pretty boring without data or places to put data or things to do with data or LEDs to plink. And so microprocessors are your computing device. They're your programming, their device, but they're kind of boring because they're their own world. There's no way to interact with the outside world. And so you start adding peripherals to it. Frank: 07:58 But these are peripherals that are still on the die. It's still in the Silicon, it's still technically on the chip, but it's there additions to the chip and we call these microcontrollers and that just means we're adding stuff to them. So what kind of stuff do you add? You add timers because timers are just useful to not have to do like loops in your code but to have hardware kicking off a timer for you. You might have a memory manager, something to interface with a whole bucket of Ram. You might have a hard drive controller or these days you would use um, an SD card and uh, what are they called? Even secure digital I guess. So you have, might have an SD card, uh, peripheral, but these are all on the chip and that's why we call them microcontrollers cause it's a microprocessor plus a bunch of stuff. Frank: 08:46 Now just to add a tiny bit of confusion to all that, today we have something even more advanced called a system on a chip. And that's the same concept of a microcontroller. We're starting with a microprocessor and throwing more stuff on it. But a system on a chip just includes so much stuff that it's basically a motherboard from an old PC all on this one single chip. So it's just varying degrees of what's included in the Silicon. I see, I see. Gotcha. Now for my understanding here, the metal board, which is Butch is my holiday Hayak that is a microcontroller, but a raspberry PI is not a microcontroller. Yeah. Um, so a raspberry PI would be a system on a chip, which is essentially the same technology used in iPhones and Android devices. This is all commoditized mobile hardware, uh, being commoditized and therefore cheap. And therefore we're finding new applications for them. Frank: 09:48 The IOT revolution would never have happened without the mobile revolution first because it created these amazing, even more advanced than a microcontroller chips system on chips that include why fi and Bluetooth and all that junk, all that internet junk. Um, the difference though, and this is an important difference, is power. So nothing is free. So the more you add to chips, the more power they take. And so if you are building a battery powered device, when you are an embedded engineer, that's what we call the old IOT people. We call ourselves embedded engineers. You are always trying to find the slowest, dumbest, cheapest microcontroller that satisfies your requirements. Because power is what's important. If I want this to run on two AA batteries, I just, I need a slow chip. It's as simple as that. I can't be running wifi. It's going to kill the batteries. Frank: 10:47 And so you're always playing this game of power. Unless you plug it into the wall, then it doesn't matter. Got it. This makes sense. So the, the, the chip that you put inside the heart, the, the counterpart that is the, it starts with an E writes a 32, there's a 32 or something in there, uh, an SB 32 that, are you talking about that shit? I think so. Is that what you put inside this thing? Anniversary. Heart. Uh, inside the heart is the E S P 32. Got it. I was rich. Yes you were right. Which is, I would technically call it a microcontroller, but gosh, it's really leaning into the system on a chip world. And so it's a, I don't even know which one I would call it cause it's finding a weird in between area where it doesn't require as much power as a traditional SLC, but at the same time as offering a lot of interesting specifically radio features that microcontrollers traditionally haven't had. It's a great little chip. I love that chip. The meadow board in fact includes one on the metal board is a CPU, a microcontroller plus an additional chip, which is the SP in order to do its wifi communications. So the metal board has both worlds. James: 12:06 Oh I see. Got it. Now, regardless if it's a microcontroller or a system on a chip there they have the same concepts I'm pretty sure in place, which is that there's a bunch of different analog and digital and now little holes. There are little holes levels. There are little holes, technical term, technical term. They, I mean they literally are little tiny holes that have um, you know, little copper things on it and they make, they make connections and the connections send something to that chip that it's on or off I guess. Um, but regardless, I'm assuming you're plugging in these analog and digital in and outs and all these grounds the same regardless of it's a Ardwino or a raspberry pie or a meadow or a or a SB 32, right or no? Frank: 13:01 Yeah. Yup. You got it. Um, one of the great things about living in 2019 is that we're a mostly digital world and so devices that you would think are analog, let's say, um, a temperature sensor, you can even buy digital temperature sensors and communicate with them digitally. And in that case, digital is nice because you just don't have to think very hard. In order to use it, you have basically two voltages to think about, uh, the most important one being ground. You've probably heard of ground. I've heard electrical engineers say it. James: 13:37 Yes. If you ground something that that's, I don't necessarily know exactly how it works, but that's the thing that makes sure you don't get electrocuted. That's an interesting perspective. I like that. Uh, technically the word is shocked. Electrocuted means you died. But yeah, that's the thing that makes sure you're not shocked or right. Yeah. If it's not grounded, then the, then I believe that it is. Here's my analysis of grounded. Is that the ground? If something shorts then it goes through the ground and, and like and like it like absorbs the shock LS. If it's not grounded, you absorb the shock. I think you should be a professor. You should just open Ochoco engineering with here's how not to get shocked grounds people. Correct. Yeah, you're right. You're right. Ish. Um, what's to an extent, and you just said, um, Frank: 14:33 let me try to give my answer, but the truth is I think my answer is going to sound so terrible that we'll probably just go back two years. So voltage is not an absolute value. You can't say, you can't ever say that something is five volts. That's a meaningless term. All of that you can is that something is five volts higher than something else or it's three volts higher than something else. 12 volts higher than something else and therefore you need us something else to compare it to. And that's ground. It is nothing more than a symbolic designation. We give to a voltage and a system. And that's just to declare we need a measurement reference point and we call that ground. Now people have conflated that with lots of things. Um, ground becomes a return path in a circuit. Therefore a lot of current goes through it. Frank: 15:27 Therefore you need big hunks of metal so that you don't accidentally melt things and therefore you, that has translated into this concept of earth ground where you stake a pole into the ground and make sure that we can dump all of our energy into the poor earth. You know, it has a lot of meanings beyond that. But the most important thing, especially when you're working with small electronics like this, is to just know that voltages by themselves are meaningless. They need to be compared to things and so we compare to a thing called ground and therefore to make all of our electronics be able to communicate with each other and work with each other, we have to make sure that we put all the grounds together at that means electrically physically couple them together so that we make sure that they are all at the same exact voltage. Frank: 16:14 That's ground. That's our reference point for the circuit. Got it. Okay. That makes us, I am very used to, so I grew up on a farm and we would, we had an electrical fence and I believe you ground electrical fence or something like that. I believe that you do. And I'm very used to a big metal chunk, big metal rod that's in the ground and then it is against it. I'm very used to that concept. Yeah. I mean let's start at the very high level. These things are called circuits and what's a circuit? It's a circle. So we need to make a loop of something. So if we have something traveling along it, we have to make sure it can get back to where it started. And so we need a designated starting and stopping point and we call that ground often too. And so you probably use the earth and just because it's fun stuck a pole into it. Frank: 17:05 And when you call that starting and stopping point ground, I don't, I, you can make so much more out of it, but I like to keep it at that general high level because I don't like to um, give it any mystical meaning. It's really nothing more than that. It's a starting stopping point. It's a connection point and a loop or it's a reference for other voltages. It's all those things. I guess it is important grounding people. It is very important. Um, okay. So, okay, but um, but let's move on from ground because there's another voltage that's important and that is your circuit is going to be a five volt circuit or a 3.3 volt circuit. We call that TTL circuits. Five volts are TTL circuits and they're kind of the old fashioned, we had just transistors. We needed a voltage for all transistors to work with. Frank: 17:53 Five volts seemed like a good enough number. So we did it. Um, it's kind of meaningless. It's just historical. Later on we moved on to better a technology for transistors called CMOs technology. And that ran at 3.3 volts. And so modern circuits, we generally run at 3.3 volts. The only reason this comes up is some boards talk five olds and some boards talk 3.3 volts. Uh, generally speaking, don't mix the two things happen. But oddly enough, uh, some CMOs technology is good enough. It can actually handle five volts. But it's something to definitely look, look out for if you're picking up board or if you've already picked a board, find out what your board does and when you're buying sensors and other things, just keep that in mind that you are a, this voltage system, three volts or five or whatever. I see. James: 18:47 And on the meadow board I was specifically connecting our ground from the board to the breadboard and we can describe the breadboard and a little bit, cause I actually want to step back a little bit into how this thing works, but to get off the grounding and the voltage on there, there was a a three, three, 3.3 V and a five V and I connected the 3.3 and the ground which are very close together. I'm on one board. When I started to try to blink an led. But I think the, before I even got to that concept, I wasn't connecting any wires. I was just controlling things on the board because every little IOT, anything has a little indicator light and you always got to blink that thing. But I want to understand one thing in the micro controller versus system on a chip is I was taking file new and deploying the code. Now between a system on a chip and a microcontroller, how are they executing the thing? You know what I mean? Like there's a deliverable but underlying technology, how does that work? Cause they have to be fundamentally different. I assume Frank: 20:02 oddly enough, there's similar. Um, but there is one, a big distinction that we'll make. Um, and that actually lies with the operating system on a microcontroller generally because there is smaller and generally because you only ever did one task on them, you know, like your code was pretty simple and that I mentioned memory controllers, but yet, uh, they usually didn't have a lot of memory access. Uh, people didn't really use operating systems. No need for them. We don't need no dos. We don't need no Linux not needed. Um, of course you end up needing a few features from operating systems. So you develop these like tiny micro systems. There's literally one called micro O S that a lot of people use and that in fact is the operating system that your metal board is running. Now your metal board is special because that can run C sharp code and for that it needs the dotnet run time. Frank: 21:05 And I believe it's using mono. My knowledge could be off here, but it has a very minimal tiny operating system, a micro OS plus the mano runtime in order to execute your code. So that, that part makes sense. Probably. Hopefully that makes sense to me. And you have talked about the micro OS in the past on a pod. I'm pretty sure we looked it up. Yup. Yup. It's, it's just a little, little OSTP small. That's, that's the whole point. Now system on a chips tend to be bigger and using a lot of power anyway so people can get away with running, say Linux on them. And so if you are doing a raspberry PI, which is a system on a chip, you'll probably just end up running Linux on it. Uh, there's versions of windows that can also run it. Windows 10 runs beautifully on a system on a chip, so you can actually run a full fledge desktop operating system on those. Frank: 21:59 The problem is you're using a one amp occurrence. You're, you're just using a lot of power to run those operating systems. Whereas the microcontrollers, uh, just a lot less power always comes back to power. Got it. So when we're thinking microcontrollers usually for most intents and purposes, it is a lower power consumption, more plugable architecture. Even though this is manager usually is pluggable as well, but they are normally not bound to being the go to. They're usually not the GoTo for the lowest power consumption type of thing that you're trying to work on. Especially when you're talking about real manufacturing. When I'm an actual supplier, actually trying to create a device, I am cutting every penny along the, uh, whatever, you know, the purchase order chain of everything. And so I'm going to use the slowest, cheapest chip I can get out there. And so while system on chips are delightful to work on, cause it's like you're in Linux and you can use, you know, vs code if you want to even, uh, it's a great development experience. Frank: 23:10 You would never sell a device actually using one of those chips. It's just stupid. It's too expensive. It's wasting way too much power. So you would develop on it and ship on a much simpler chip or you would maybe charge $2,000 for the device. You know, you're not going to make a low cost device running a system on a chip. Got it. Does that makes sense? That makes sense. All right, so the next thing that I did here and now that we have the basics out of the way, this is a really good understanding of me because I didn't quite understand the question and be like, Oh, is this a competitor to this or is it this? I'm like, James: 23:46 I mean I don't really know anything about the other boards cause I didn't really know. And like there's, here's a chart on the website, but you know, I, you know, I had a lot of people on the chat. Anybody that was in the chat was super amazing and really helps out. Um, cause I didn't know what I was doing. So. All right, so you get this board, I got this board, plug it in. Frank: 24:08 Let me interrupt you real quick. Uh, is your, is this video? Uh, can I, can I see it after the fact? Is it still up? You'll give links to it. James: 24:16 Good. Yeah, put links it, I'll export it to my YouTube so I'll make sure it's, it's there in the YouTube in the morning too. I'll put it in, I'll put it in the show notes too so you can see it. Um, right. So I get this thing and I go through the code right. And I start to blink a light, right? So I have a digital output port right on the, on the board there's a red led and a blue led in a green led one. Frank: 24:45 Yeah. Except an led is still kind of an analog device and you have to eat and manage the amount of current going through it. And that's probably why you had to use a resistor. What resistor does is limits the amount of current that can travel through a path and current, you know, electricity is broken into two things, voltage and current. One is potential energy, the other one is kind of a kinetic energy. Uh, it doesn't really, um, it matters so much that you have to go to college for four years to learn about it. But when you're just doing, um, digital stuff, general, you don't have to worry too much about it. It's only when you're dealing with motors and other crazy analog things, which unfortunately LEDs fall under. So you usually end up having a throw a resistor in there to decrease the current. James: 25:35 Yeah, cause I, I first, okay. So I first started the, I first started doing it, um, with just on the board and I, and I blinked the light, I fouled the tutorial and then it got to this point where you're saying, which is I wanted to have a physical led. So I just, I linked, uh, send the link to the hacks dry yo wanting to hear. So I needed my board. I needed a generic led, I needed a breadboard, I need a jumper wires and I needed a resistor two 20 ohm. That's what I said and I need and trying to find what the resistor two 20 amen when you don't know what a resistor two 20 ohm is, is very complicated by the way. Frank: 26:13 Sorry James. So let me interrupt right now. Okay. Uh, on all resistors is a color coding that some people learn. I consider them geniuses or idiots. I don't know which one I consider. Um, it's one or the other geniuses. Let's go with geniuses because I have been doing electronics my whole life and I cannot keep that color code straight in my head. I learn it, then I forget it, then I learn it and then I forget it. Um, I, I know some general rules, like if I see Brown, it's usually what I want. You learn terrible little shortcuts like that. Um, but don't worry. Um, it's a little bit of a hazing process. Unfortunately in the electronics world of discovering resistors, you know, other electronic components have their values printed on them and things called numerals and digits of a method that humans can use to read numbers. But resistors unfortunately use the color code because, you know, they hate us. Frank: 27:15 That makes sense. That makes sense. Uh, um, yeah, so I, I probably picked out the wrong one. The chat said that it was the crack one, but, so I started, so I started putting OMS. Okay. And sorry, I just want to interrupt you one more time. If you're out there doing this led thing, um, the resistor, you're not going to hurt anything most likely. So it's very safe to try out different resistor values and all you're going to end up changing is the brightness of the led because you're allowing more or less current through the device. That's all it is. And so you're pretty safe to actually just pull round and see which one. Okay. Yeah. Okay. Okay. That, that, that's fascinating. Yeah. Just don't avoid the one ohm resistor but never touched that one anyway. And you'll, you'll be fine. Okay. Yeah, I told everyone on the stream too. Frank: 28:07 I said I just need to have Frank over here and we need to restrain him side by side so he can show me how to do. So I set up this board and I sent you a link so you can see the assemble the circuit. It's very easy. It's taken home, put it from D O on the digital output one and put it into the breadboard. But the led in there and it should just kind of work and of course mine didn't work. Um, but that I believe is because I didn't have this header board thing on here and I just started to like loop the cords and cables. Like why, uh, can you, can you, can you explain there's holes and then I got a solder stuff and why don't, what, how does a circuit happen? Frame. Yeah. Frank: 28:53 I'm sorry. Work on behalf of all electrical engineers on, sorry. This is are bad, are bad. Um, okay. Um, you discovered, uh, electrical engineers one fatal flaw. We like to make everything configurable cause who knows what you want to deal with that. So why should I force you into any one decision? I'm gonna make that port configurable. And what I mean by configurable is I'm going to leave it blank and let you figure out what to do with it. And yeah, it's, it's tricky. Um, so you had a board with, it's just going to have holes and you're going to see a bit of copper around them. And I guess you were just kinda like, I don't even know what you're doing, but I can guess like just kind of bending the wire or Intuit or something. This is exactly, I did, that's exactly Speaker 3: 29:42 what I did. Oh, that must have been frustrating. You're correct. Was it a single Frank: 29:55 conductor wire? Um, or uh, geez. Um, my words are missing, but uh, you know, lots of little wires or a single thick wire James: 30:04 that's a single thick, a single small, tiny wire. It's very thin. Speaker 3: 30:09 Yeah. Frank: 30:09 Very good. Very good. Okay. Ah, so what, what could you do? Um, if you have a soldering, if you have a soldering iron, that's a terrible way to start. You don't have a soldering iron, do your Janes? No, I do not. No. No. So what should happen is you should order one of these boards with headers pre soldered on. Speaker 3: 30:33 Okay. Frank: 30:34 All right. Lots of options here. Lots of options. Number one, go buy a soldering iron. They're $10. It's a life skill. You should have this life skill. Who knows if like the SA zombie invasion happens and you're going to be the last person left and you have to solder two wires together to make electricity happen again, to save a neighborhood from the zombie invasion, it's an important life skill. You should just learn how to solder. But instead we actually have a lot of, uh, cables called jumper cables and they come in many different forms. Alligator and banana and antelope and pomegranate. And some of those are true, some of those are false and they have tricky little ways of connecting into those empty little holes. Uh, so you can get fancy little connectors to connect into those little holes. So let's say you don't have a soldering iron, you don't have headers, you don't have the fancy clips. Um, I would recommend, um, yeah, you're kinda, you're kind of stuck. What did you end up doing? James: 31:41 Uh, so what I ended up attempting to do, uh, because one to put the header board on because it comes with those nice little jumper thingies and I didn't have any alligators either. That was the next thing. Um, because my, the reason why this didn't work right is because when you sought her, the header on, which gives them, it's like a nice little racket to, to makes the connections to the copper for you. So the solder, make sure the connections all happen and the, it's a CLO, it closes the circuit, right? It makes the circuit happen. And um, so what I did is I just attempted to make all the little wires go in and I looped them around and my analysis would be that the circuit was loose and it wasn't that it wasn't going to happen. So I gave up, basically, I said, you know what? James: 32:31 I feel like there's nothing I can do, right? I don't have any of the things that I actually need. And it's actually a shame that the headers, and in fact, I wasn't the only one. There was about four people on the stream that said, I got my board and I had to put it away. And I haven't opened it yet because I need a soldering iron to put the header on. Then the header wasn't there. So I need to tell Brian, Hey Brian, why don't you have an option to put the header on? Um, but regardless, I should have a soldering iron. You're right. And I don't know, I've already store it, but I should. So I gave up on it, but um, am I correct it in the analysis of that's why it didn't work? Frank: 33:09 Most likely? Yes. It's uh, even if you think you're making that connection, well, they're notoriously fickle. And so I'll, I'll even do this where I can assure myself I'm pinching it with my little finger and my index finger and I'm holding it against gravity. I'm sure I'm making contact and then I use a test device and I'm not actually making contact. It's harder to hold a connection than you think. And so I can almost guarantee that's why when wouldn't had been working unless you got like some kind of software error or something like that. But, uh, if you had that internal led blinking, the one that's already on the board, then for sure, I can imagine it was just a, a poor physical connection. And this is a, this is an issue throughout the, uh, hobbyist IOT world. We don't have standard connectors at all anywhere. Frank: 34:03 There's no such thing as like a USB connector. We use USB, but almost always just a PSAP power from a computer to come or communicate with a computer. We don't have any good interconnects or anything like that. Now you can imagine there are standard interconnects all over the place. But the problem is there's 10,000 standards and everyone uses a different standard. So there are no standards. Basically. Every board manufacturer has their same preferred this or that. Uh, this is another obstacle that definitely keeps people out of this world. And yeah. That, that's unfortunate that you ran into that. Um, yeah. Yeah. James: 34:44 But I think that once, so tomorrow when I come over and bring my meadow board with the headers that came with it and you solder it because you have this, I'm going to have to bring my soldering iron to the office. Okay, got it. Yeah, correct. Bring that and some solder. So the last thing I really want you to do, cause I think this is where I wanted to get to in this one Oh one which was the very, very basics and then get to the point where you're no longer just blinking the board. You're connecting it to the breadboard. I want you to actually explain, cause I, I don't, I D I plugged all the things in and it didn't work, but had it worked, I wouldn't know why it worked. Right. And I'll link to the specific, you know, thing on here, the hacks are IO, which is like a really cool website. There's a beautiful diagram of here's the board and here is this. Now you kind of explained the resistor in this, but there's a few things of how it could work. There's like a digital output, but there's this a pulse wave modulation PWM, I believe that's what it is. Perhaps. Yeah. Ports. How, how do, what is a breadboard and how does, how does it, how does it do things to turn on the light? James: 35:59 You know what I mean? Frank: 36:00 Yeah, yeah. Great question. What is the pride board? Is a breadboard. And how does, how does the thing go from the board to the other board and make the thing do the thing? And is there, or is there not bread involved? Because I mean, why call it a pride for it? Is there active yeast? Is it a no-bake? I don't know. Right. Okay. Breadboard is, um, a little device that we use to build temporary circuits to play around with circuits. It's a quick way when we don't feel like soldering things or we want to experiment around, it's a device we use to create connections between different components. That's its fundamental job. Create connections between different components. How does it manifest itself as a big white hunk of plastic with a billion little holes? Very confusing. Um, there is a thought to the madness designed to them what it was, that phrase, whatever. Frank: 37:02 Um, the most important thing is to realize that some of those holes are connected to each other and some aren't. And when you first learn a breadboard, you learn which holes are connected to each other. I don't know if it's going to make good podcasting material for me to discuss it, but in general it works, uh, very simply in that rows are connected to each other and Oh God, I hope I just said that wrong. Let me take that back. This, I'm not going to do this because I'm going to mess it all up on a podcast, but it's broken up into rows and columns and they're either connected or not connected. That's the fundamental thing. And so you can use those rows and columns to your advantage when building a temporary circuit. They're quite useful. I use them constantly because um, yeah, you just don't feel like soldering. It's mostly laziness. James: 37:56 Got it. Okay. So let me get one thing really out of the way or so I had an a generic led and a generic led has two prongs. There's a longer prong and a shorter prong and the longer prong you put into the breadboard and that's the one you connect to the resistor. So, and the other one you connect to a ground. So how, how does the thing, how does the computer, the microcontroller tell the thing to turn on the led? I hope we, we Frank: 38:29 do this all night. I'm having so much fun. We're going night. That's 10 hour podcast. Okay. Um, in circuits you generally have polarity, a direction that you want current to travel. I keep talking in terms of current, but um, you might think instead in terms of voltage. So you would think one side, you want to be a higher voltage than the other side. On a car battery you have a plus and a minus. That's polarity. One of those is a higher voltage than the other. I'll let you guess which one plus. Got it. Nailed it. Frank: 39:11 Um, in general we call those anode and cathode because we like to compete with doctors to see who, whom, who knows more Latin. And of course it's engineers. Um, so anode would be your positive cathode would be your negative. I tell you those, just to show off that I have a degree. So an led is a, is an oriented device. Uh, it can, it'll only activate in the way that you want to to activate when current is flowing through it in the correct direction. So in this case, it'd be from the plus to the minus from the anode to the cathode. And so when you put the cathode connected to ground, that was just you guaranteeing that that's going to be the low side, thus guaranteeing that the current will flow from the high side to the low side, the direction that you want. Yeah. Frank: 39:59 Okay. Yep. And if you, the funny thing about a led is it actually is a diode. It's a light emitting diode. It doesn't allow current in the other direction. So it's actually a rather safe device. And so you can mess up its direction without breaking it. That's what's really nice about them. And so if you ever have an led that's not working, just pluck it out and turn it around, see if it's work works the other way. Oh, interesting. Okay. So I was, so I connected, so I connected a digital output and I said, I have, um, connect. Please code. This was the code. It was like create a new led, but it was basically like, Hey device board, I'm going to get access to pin [inaudible] which is where the resistor is, which is what you're saying is sending something. Yup. Power outage, let's call it voltage for the moment. Frank: 40:50 Yeah. And voltage. Yup. In yeah, to the high side of the led cause that's going to be the high side into the high side and, and, and when that comes in it, it makes a circuit happen and then it sends the, the, the voltage to the, to the led and then stops on the other side. So to see the circuit in your mind, um, unfortunately everyone's going to have to go to this website and look at this thing. But you would see the, there's a metal board on here with the little chip S T M 32 F seven. That's the microprocessor and the microcontroller, sorry, that is going to, when you say digital port, uh, turn on, you say true or false usually for setting apart on off. True false. That will either tie that port to ground. That would be your zero, your false value, or it will tie it to a voltage source at three volts. Frank: 41:48 I think in this case, so 3.3 volts. So when you say true, when you say yes, turn that port on, that microcontroller generates three volts at D zero one so now you can follow along with your finger. That voltage goes from D zero one through the resistor. It drops a little bit because that's what resistors do. Then it enters the led on the long and outside. That's the high side of the led travels through the led, through the diode, through the PN junction, down through the cathode or the led through a little wire you have tied to ground. That ground goes back to ground on the board. That ground on the board is connected to ground on the microcontroller. That ground is connected to the voltage generator connected to D zero one it's a circuit, it's a complete loop. It's a completed a circuit. And then when you say off, it's not actually sending none. Frank: 42:47 Is it then sending the ground control level or is it actually sending nothing to us? So that is a very good point because in general it's going to put a to ground. So if you say zero, it's going to tie to ground. It's not loose, it's tied to ground. It's a, it's a definite voltage. You can compare it against other voltages that said, you can in fact put the part into this is called a tri-state port. You can put it into this open impedance where it will, um, it won't be driving any voltage on that port. In fact, most of these digital ports can be converted from output ports to input ports. And that's something you might do if you have an input port. You don't want to generate a voltage there. Instead you want to accept a voltage. And so these ports can take on those two different roles. Frank: 43:41 And even within those two different roles, there's even more fancy things you can do with pull up resistors and pull down resistors. It's really kind of wild. But going back to basics, uh, true and false, put three volts on it and put ground on it. Got it. Okay. Yeah. Right. So it makes sense. And then you mentioned just one more thing that P w M and yes, this is just a very convenient piece of hardware and all it's doing is turning that por on off, on, off, on, off, and it's just trying to save you some code because you're a programmer. You can write a four loop that turns the port on sleep for a millisecond, turn the port off, sleep for a millisecond, turn the port on. You can write that loop. No problem. Yup. But maybe you don't feel like writing that loop or maybe you're trying to do something that is so high frequency that the speed of the programming language is actually starting to get in your way. Frank: 44:41 You hope. Hopefully you're never in that situation. But you know sometimes with digital communications you get into that. Usually it's communications when you run into these kinds of things and so you use a piece of hardware called a P. w. M, it's called pulse with modulation. The pulse just means it's square, wave the width, and then you can modulate the width, meaning you can change the width so you can change how long it's on versus how long it's off. We sometimes call that duty cycle. Now why is that all interesting? Because if you think about what we said with the led, I said that you can control the brightness of the led by changing that resistor. Well, you may want to change that out. The brightness of the led without physically changing or resist or you want to do it with code, and the way you do that is actually tricky. Frank: 45:35 You don't ever dim the led. You just turn it on and off at different rates so you just have it on for a shorter amount of time or whatever, longer amount of time. Then it's offered a shorter amount of time, then it's off. And that'll give you a dimming ability to go from zero brightness to as bright as it can get always on. So it's just a tricky way to do dimming of an led and other things like motor control and yeah, led some motor control. That's what you're gonna use a form mostly. So when your country increasing your decrease in the brightness as it's, it's still sending the 3.3 volts. It's not sending like less lesson. It's just a human perception thing. If you have a high speed camera, you'll see it's actually turning on and off. But we live with this all day. Every day. Frank: 46:22 All your light bulbs in your house are flickering at 60 Hertz. It's just our brains are too slow to register it. Our eyes are too slow to register it. So as long as the flicker that led at over a hundred Hertz, no one's going to perceive it. You would need a high speed camera in order to detect it. That's the world. The world is an illusion. It's just a bunch of electrical engineers playing tricks on you. Never forget that is this why when sometimes you take your phone out and you point it the camera at like a television or a L Erika desktop display. You see the lines like move through it 100%. That's called temporal aliasing. And you can actually study that by studying the interference of the two frequencies. You're measuring frequency and the frequency that, I mean your, your, your recording frequency and the frequency that you're measuring, those two can interfere with each other. They can be resonant with each other. There's all sorts of fun things you can get with a aliasing. A lot of times you'll see this on a TV. It's a, the Moray effect is an example of this kind of frequency, temporal aliasing, James: 47:30 all sorts of fun things. Yeah. So the world's a lie. Never forget. And I just want to remind everyone that I gave Frank the ultimate holiday gift, the gift of electrical engineering for the podcast this week. Thank you James. Uh, when you said you had a podcast idea, that's so happy because honestly I've been in vacation mode. I'm really good at vacation. I'm good at forgetting everything. And so I was so happy. Uh, this was so much fun to do. Crash course electrical engineering. Yeah. I, I honestly want to thank you because some people may be listening to this and seeing like, wow, James, like you sound like an idiot asking these questions, but I don't, I don't think so because I think I knew an answer or I had known about some of these things. Um, just through how I learned about electricity in school and learn about, you know, grounding but not in, in the, in a tiny little board that I just tried to program. James: 48:29 Like I didn't, when you put it all the things together and understanding circuits and understanding the controller and understanding the ohms and the resistors and the breadboard, you kind of need to know a little bit about all of this to understand like, why did I put this cable to this cable and why did that thing work? So I want to thank you, Frank for actually taking a step back to explain these probably kind of ridiculously easy questions, but it sounded like a lot of fun to you. Questions? Oh, it is. It is. It's always a challenge. Like, can you explain something? Uh, I, I have this great failure rate with my dad where I like to explain esoteric mathematical concepts to them. And yet I fail at my explanation pretty much every time. And so I do like to measure myself on how well I can explain something. James: 49:16 So I hope I did an okay job. I, I personally really enjoyed this because man, I can talk about circuits all day long, so I'm glad that you're getting into it so we can just chat about it. Yeah, it was, it was fun and I think that it'll be even more fun now that I know why it worked and more importantly why it didn't work. I think that's also very, very important. So thank you Frank so much. Uh, while we have a lot more to talk about, I'm in the new year, so I'm excited for a brand new year. We'll be back next week, 2020. Frank, it's happening. A brand new year, brand new podcast, and my brand new podcast is the same old podcast that you know and love. Uh, so that's going to do it for this year. Speaker 4: 49:59 Until next time. I'm James Matsa. Magnum, and I'm Frank [inaudible]. Thanks for listening.