January 23, 2023
- What is meant by Programming in the Physical World
- How do people interact
- How are we focusing today’s topic
- What is a Microcontroller
- What would you not use a microcontroller for
- How do they get programmed and what language
- How do you contain the device
- Do you need to solder
- How does this relate to Drupal
- What have you used it for in the past
- Where should I get started
Module of the Week:
Currently provides only a basic integration, for a developer to create a customized handler module to implement the specific functionality they need. An alexa_demo submodule provides a reference.
This is talking Drupal weekly chat about web design development from people that have one thing in common. We love Drupal. This is episode 383. Programming the physical world. Welcome to talking Drupal. Today we're talking about programming the physical world with Stephen Cross. Stephen is the founder of this podcast and a past host. He's also a Linux and Raspberry Pi enthusiast. Steven, welcome to the show. Thank you for joining us for the last four weeks. It's been great having you
enjoyed it thoroughly.
What's not to enjoy, right? I am John cozy Solutions Architect at EPAM. And today joining me as usual, Nic Laflin, founder of enlightened development, Nick, how are you?
Doing? Great, good afternoon.
Awesome. And now to talk about our module of the week. Let's bring in Martin Anderson-Clutz Senior Solutions Engineer at Acquia, and maintainer of a number of Drupal modules of his own, Martin, what do you have for us this week?
Thanks, John. This week, I thought we would talk about the Alexa module which allows your Drupal site to respond to Alexa skill requests. Now, it's a module that was originally created in 2016. But last year in July of 2022, and eight point x dash 1.1 version was released to give it sort of Drupal 10 readiness. The module is officially listed as having maintenance fixes only. But it seems like the maintainers have done a pretty good job of proactively releasing you're creating releases to make it work with major releases of Drupal as they have been coming out. So for nine and 10 in terms of open issues, and only has six issues open. And only one of those is a bug which actually has an RTC patch against it. A module is currently in use by 31 sites. And the current maintainer appears to be Gamberi, who also maintains a number of projects related to the chat bot API. So the way the module works is it it really provides only basic integration. And the idea is that you would create sort of a custom module to sort of implement the specific functionality that you want to expose to that Alexa skill. There is an Alexa demo sub module that you can use as reference for sort of creating that custom sub module. I think it's also worth pointing out that this module was highlighted in the Drupal con New Orleans drinks note, and also mentioned by Drees in a later blog post about cross channel user experiences. Also, if you're interested in learning more about how you can use this Alexa module with your own site, there was a recorded session at Drupal con Seattle, about using the module to integrate Drupal with Alexa. And we'll have that link in the show notes. So maybe opening this up to the group. Anyone have any thoughts about using Drupal with Alexa?
I have one thought, right this second, I'm glad that I have headphones in because I have one of those devices here. And we've said the wake word about six times. So could be interesting. But
your listeners are not gonna be happy with us. I mean, I think it's interesting. I'm glad it exists. Personally, I don't have any of those devices, any of those types of devices in my house other than my cell phone, which I have that functionality disabled. But I think it's I do think that it's helpful to have that ability to have integrations. I mean, it's also novel enough that while I've never used it, as soon as you mentioned it, I remember the Drees note and the blog post about it. You know, it's, it's I think it's also important to note that this isn't the kind of thing where you just install and it just works, right? You also do need to make the skill in the platform on the Amazon platform. Like it's not just it's not just you install this and all of a sudden your site works with with that tool, you know, there's additional work that needs to happen.
Yeah, absolutely. I mean, I think that being said, the really cool part about this integration is that all sort of the voice recognition, recognition, and then text to speech, side of things you inherit, you basically get that for free, because Amazon does all of that. So it's really still, you know, more of like, almost like exposing an API, that type of integration. So I think it's, it's a pretty interesting, you know, path potentially for making your content or your site functionality available in different ways.
So that's an interesting point. Right? So Oh, this is is providing a connection between durable and you know, Alexus skills. Service cancel. I was trying so hard not to say it, they failed.
Bingo, is that
everybody can cross that off their sheet. So the question there I guess, is it to Nick's point, right? You still have to create that skill on the Amazon side? Is this just like, formatting the API endpoints on the Drupal side to be able to communicate easier with with the the Amazon service?
So what I'm about to say, obviously, I'll use the major caveat that I haven't actually had the chance to implement with this myself, I have an idea of something that I think would be fun to expose as an Alexa skill. But it's my understanding that that, yes, you you create almost like an API endpoint that will accept a request. And then you provide sort of that, you know, almost like the controller type logic to define how it's going to format that response. I believe you can also give it the ability. So if somebody asks for something, then you can ask almost like a clarifying question to collect additional data. And then once you have all of the data that you need, you formulate the response, you provide that in text form, and then the device will actually then read that out loud to the user.
I think one of the reasons why this is well maintained, is the Georgia State. gov website, I think uses this to help maintain their integration as well. I think mostly to help with a lot of like, frequently asked questions, type stuff, and information dissemination. But I believe that this is how that's done. are one of the tools use for that?
Yeah, Martin, I'd like to congratulate you on tying this into this podcast once again, the module the week so it's about interacting with Drupal from outside of Drupal. And I would like to challenge any of our listeners to go out and create an Alexa skill that you can say, Alexa, play the latest talking to Apple podcast. And then we can figure out how to stream that to our listeners.
Great idea. Could be interesting. I
feel like I could probably do that right now just by saying those words. But maybe.
I don't know if that would work yet. No, it probably would. I think if you said, Alexa, play the latest talking to Apple podcasts on Spotify, it probably would work. Sorry, that's Alexa, cancel. Sorry, sorry. I
know in my car, I can use Google Assistant to say, play talking Drupal, and it'll spin up the Latest Episode on Spotify. So depending on on your setup, there are definitely ways to do that probably without as a special skill. But I'm sure our listeners can come up with some interesting ideas on how this could be leveraged for sure.
Well, Martin, as usual, thank you for bringing us a another amazing module, very relevant to our topic. And now on to our primary topic. Let's let's start with the easy ish question. Right, Steven? You know, what is meant by our show title today? You know, programming the physical world, what are we what are we going to be talking about?
So we all program like, as web developers, we code knowing interface with the browser which interacts with the users. What I'm talking about here is a little different in that you're interacting with physical devices. So when you code, you can interact with something that's mechanical directly. And like turning on a bulb, or reacting to a button getting touched, directly, not going through some other interface or some other environment, but you're, you're interacting with the physical thing directly. And that that's probably not super clear in that description, but it's coding something that's physical directly.
So so my question is, how do people usually interact with programming the physical world, as you mentioned, you know, as web developers may or if you just ask a layperson, if they're interacting with programming, they'll think about opening an application on their computer, or a game or opening a website or app on their phone maybe. But as you kind of hinted at, there's programming in all aspects of our lives. What are what are some examples of ways Have people might be interacting with something that somebody programmed that they may not think about.
Yeah, so let's take the example of like maybe a microwave oven, tick is a good example is that when you think of your microwave oven, it's just a device or it's an appliance that's sitting in your kitchen. And you turn it on, you push a timer, and there's a time that goes on and you open the door, it shuts off, there's a light that comes on. There's a fan that runs when it's running. All of that programming that's in there in that interaction, is what I'm talking about in the physical world. So it's, it's interacting with physical devices, and things that you can touch and see, and motors and fans, and lights, and microwaves, those kinds of things. So that's sort of what I mean by the physical world. And when you think about your microwave, you actually don't think of it as someone that programmed that, right? You like look at your microwave oven, and it just runs. But behind that microwave oven, there's code that's running, that when someone pushes the Start button, there's things that are happening, like the lights turning on the the spinner, if you have a spinner that spinning your food around that's running. And at some point, there's like a trigger that happens if someone opens the door while it's running. There's an interrupt that happens in all that stuff stops. Yeah, that's the stuff that I'm talking about.
I mean, it's interesting to think about that for a second, right? Because you raise a great point. And the microwave is an interesting, you know, an interesting example. You know, I also I also was thinking of like my washing machine, like when something goes wrong with your washing machine, you get like an error code like f1. And you're like, Okay, what does that one mean? Right. But like, you know, the, the idea of opening the door, right? In my head, like, I always thought that that was a a physical interaction, right? Door opens latch trips, well sends signal, there's something that
sends signal, something, John is the key. Yeah.
Well, well, in the case of something that's safety oriented, like a microwave, it probably is a physical switch, right? So when you put it out, connecting the connection that sends power to the transformer, most likely, but that's still part of the programming, right? Because it say, for example, it stopped, like the pieces that it does that are part of the programming most likely aren't the actual physical starting off with a transformer. It's the pause, beep and pause the countdown, right.
So I mean, there's also another part of that, right. And this is kind of where as Steven was describing it, my head was going as well is like something we we just talked about with the module the week, right is virtual assistants. Right? So like, you can tell your virtual assistant to turn a light on and it'll turn a light on. Right. So that's kind of is that kind of similar to what you're what you're thinking of Steven are?
Sure, sure. So behind behind basically, all of the things that we use today, it's hard to say all of the things, most of the things we use today, and our homes that do something are controlled by some code somewhere.
Right? So in
access to that code, and like, learning how to use that code, is something attainable in is is really accessible to people. In which is is something that I've been interested in. I mean, I've been on the show, like for a few episodes over the last few years. That's a joke. And one of the things that that I've talked about in the past being on the show is like I've been, like interested in raspberry pies. And and, you know, my day to day job is Drupal. And I love it. I love that coding. But I've learned over the last few years that there's another area of coding that you can interact with things on a more rudimentary or raw basis through this physical programming, which is very different from interacting with the entity API in Drupal. That's kind of why I wanted to talk about this a little bit today.
So that that actually reminds me and this actually came up in I think it was on Twitter, maybe recently. Our show about Home assistant, right. And in that show you talked about, and we might talk about this a little bit more on this show. But we talked about, you know, a light or thing you set up to kind of monitor your, your dryer or your your washer or something, something to that effect, right. So like, clearly, there's programming around us everywhere, right? Everything you just you just highlighted this illustrated this perfectly right? Even among microwave, like, has some sort of programming your your iron has some sort of programming, say like, Oh, if it's not being used for 10 minutes, shut it off, right? How are we focusing our topic today? You touched on this a little bit with like, how you're interested in this, but like, what do you what do you how do you specifically think we're gonna kind of focus this to talk about this topic?
Yeah, I'd like to focus around what it takes. And how accessible is coding the physical world from working with a microcontroller? And that sounds like to me, if I was like, thinking about this topic three or four years ago, that would sound like foreign to me, and, and not accessible in any way. And just strange, almost daunting, right? Yeah, daunting, daunting. And just like, no interest to me, necessarily, that seems too hard, because it seems like assembler coding, and in just doing things that are far away from the code that I do on a day to day basis, when it's actually not that at all, I think it's very close the coding concepts that are around working with a microcontroller. And checking the temperature and humidity in your basement and in making decisions about turning your humidifier on and off, are things that are accessible, and things that you can code and use the skills you have today. But it's also like a way to learn new coding skills that you don't have. Yeah, and it's not super hard to do. And the world that we live in today, there's companies out there that have created environments for us to really make this easy to learn.
So, before I move on to the kind of the next question that I have, based on that, what is a microcontroller? Can you tell our listeners what that is?
Yeah, so I think the best way to describe a microcontroller is to talk about what it isn't, in some way, right. And bring bring people into, like what they understand. So we all understand the computer on our desk. And I do think over the past 10 years, people have gotten to understand what a Raspberry Pi is, and what a single board computer is. So if you think about a Raspberry Pi, it's a single board computer, which means it's a single single board that has a CPU on it, it has all the all the electronics you need for a computer on a single board. So you can plug a keyboard into it, you can plug a mouse and a monitor into it. And there's a CPU and you install an operating system on it. That's what a raspberry pi is. So it's basically a smaller version of the computer that's either in your laptop or on your desktop. What a microcontroller is, is it those things minus access to like a computer keyboard and mouse. It has a CPU, but it's the CPU is a single purpose. There's no operating system. So a microcontroller has basically single purpose software on it, that you've written to do one particular task or a group of tasks. But it's there's no operating system. There's no external devices, you're basically you have access to connect to the outside world through pins. But it's not a general purpose computer.
And probably the most except the most accessible types of microcontrollers out there for people are Arduinos right? So Arduino is a kind of the Raspberry Pi's of the microcontroller world, I think, is that a fair comparison?
Yeah, I think that was a fair comparison. A couple of years ago. So Arduino is Arduino is known for making microcontrollers. So these little tiny single purpose system on a chip devices that you could use to program lights and temperature sensors and hands on, and all that kind of stuff. And over the past two years, two to three years, there's been that group has expanded, actually, Raspberry Pi has gotten into their business, which is why I brought them up earlier, they created a device called a Raspberry Pi Pico, which is a microcontroller. Micro microcontroller. When we think of a microcontroller, it's a it's a tiny board, like if you think of it is like maybe the size of a piece of gum. stick of gum, if anyone knows what a sticker government anymore actually, or smaller in on that. Yeah, and I met is a is a chip, which is a system on a chip and SOC, in it provides some functionality in the Raspberry Pi pico came out during COVID. And I think in 2020, it'd be 2021. And it was it was sort of Raspberry Pi's answer to the Arduino environment, which basically gives you the ability to program things. For this physical environment,
I just want to call it to one of the real advantages of microcontrollers is, aside from the ability to kind of make a single purpose use case for something is there, they're very low power. They're they because they're single purpose, they can be very quick. They're generally local only. So for example, a good a good example of a single purpose one microcontroller is like a thermostat, right? All it needs to know is, is the temperature above, usually two or three things is the temperature above this temperature. If yes, open this relay. Is the temperature below this other temperature if you have cooling, yeah, if yes, then open this other relay or vice versa, right? So just needs to know if it's too hot or too cold. And then depending on that which one to open, right? And so all it needs to do is every once in a while, say hey, what's the temperature? Okay? Is that temperature too high or too low? Right. So it doesn't use a lot of power. I mean, those these types of devices, especially if they're battery devices, their battery can last for a year, two years, three years on just a single watch battery, right? And
so low powered, and very fast to because with a single purpose. There's no operating system running. So if you think about a computer, a Raspberry Pi is an operating system running that's like sitting there running all the time and looking for interrupts and doing the actions. In a microcontroller, it doesn't necessarily work like that. There's no os involved. So any actions you do on it are direct, low powered and very, extremely fast.
Yeah, as long as you code them, right. Sure. Which is, which is always the caveat to programming. Yeah.
John, do you get what a microcontroller is? Versus a computer? Does that answer your question?
Yeah. I was actually going to try to simplify it even further. Right. So like, the way I look at it is it's like a light switch, right? There isn't. A light switch has pretty much a single a single purpose, right, turn the light on, turn the light off, based on somebody's doing something flipping the switch, it does that. Now, granted, anybody that knows electricity, or electrical systems, like knows that a light switch has wires going to it, like what it's doing, right? But like, at a very simple level, like this is doing the same thing. There's no LS on it. It's basically you're writing a hey, if you get this input, do this thing, and it's just doing it for you. Right. One other notes, I think that are one other point of clarification here on the microcontroller is microcontroller has a port that you're jacking into some way or is it it? Based on the images? It looks like? Maybe you connect it to a board in order to kind of apply your programming? Is that accurate? Depends
what it is. So
So yeah, so let's talk about microcontrollers, in terms of things that are accessible to developers and the things I'm talking about, right? So the microcontroller that you have in your microwave oven is not exactly the same kind of microcontroller that I'm talking about. Today. I'm talking about microcontrollers and development boards. So you buy a generic microcontroller, so a Raspberry Pi pico or an ES p 32. It's something that comes to you and it has a port on it, like a micro USB port or USB C port or something in it, that you can interact and install code on to this microcontroller. The idea of these development boards is it gives you as a developer an opportunity to like test this out and run your code you and design the system that you want to design that maybe you would launch into a product later on this development board, that has a lot of capability. At the end of the day, if you were actually building a microwave, you would then design a a microcontroller chip that was very specific to the microwave oven that you were installing it into. It wasn't one like these one of these development boards that you can easily install code on. So to answer your question, John, yeah, so like, there's like two microcontroller board that are probably the most useful today in terms of people trying this out. One I've already mentioned is the Raspberry Pi Pico, which is the one I would recommend people to purchase to try this stuff out on. And I can talk about more of that a little later. The other one is an ESP 32, which is another very popular one, Nick mentioned it, you know, Arduino is a place that it started. Now, these are two very competing micro chips that have lots of capabilities, including, you can go onto Wi Fi with them today. So you can interact and create a device that's an IoT device, you can interact on your local area network and do things online and things like that.
The other I think really important thing to call out is that these, these components are generally the smallest component needed, so they tend to be a lot cheaper to write. So if you're looking for, for example, a temperature and humidity sensor, right, if you're gonna buy, yeah, can eco be remote sensor, right, you're gonna pay 50 to $75 for package two of them, it's using a microcontroller inside and connecting, but if you if you get just the temperature and humidity sensor directly, you can get them for like three bucks, five bucks, right? You need to connect it to the microcontroller program at yourself. But if you're putting 100 in your house, that's going to be significantly cheaper than then than buying something off the shelf.
So to give people an idea of just price, like when I'm talking about you can buy a microcontroller and start programming it tomorrow. A Raspberry Pi pico is $5. The one that has Wi Fi and Bluetooth in it is $6. That's what we're talking about here in terms of, I can actually buy something for $5 a Pico, I can write Python C code on it, run it and have it interact with physical devices and not have a lot of outlay in terms of financial investment. Nick MIT just mentioned a, a, you know, checking the heat, in humidity or temperature and humidity. I just had a device come in the last few days that I purchased, which is a high end temperature and humidity sensor. And it was $12. Yeah, like it's that's allegedly the high end version of this. So it's kind of interesting that you can buy these little things, connect them and program them in does not allow outlay in terms of cash, in terms of understanding this technology and playing with it.
So I was gonna save this question for later. But I think I'm gonna I'm gonna ask it now, because it makes sense. Right? So supply chain issues. You know, I we've all heard like, chip manufacturing is not not exactly the easiest industry to be in right now. People are having issues getting chips. Are you seeing issues in getting microcontrollers, and getting some of these sensors?
Yeah, great question, John. Um, so anyone in the Raspberry Pi world has known that, basically Raspberry Pi's have not been available for almost two years. You cannot buy one. Or if you go to eBay, to buy one you could pay tenfold of what what it really costs. The interesting thing is, it never impacted Raspberry Pi's pico delivery. So which is which is funny is how I actually started spending more of my time, in microcontrollers over the last couple of years, is because I couldn't get any more Raspberry Pi's at a reasonable price. They were unavailable. So I bought a few more Pecos and started playing with them and then realized, oh, this was far more fascinating to me, than was the Raspberry Pi in at a hole. So, so the microcontroller pico has been available. Mostly a little bit. Maybe maybe not so much, two years ago, but totally available now. And I haven't seen and listen, this is a hobby for me. So I wouldn't say I'm the insight on availability of microcontrollers over the last two years, but I haven't seen it'd be a problem in the microcontroller world.
Well, one of the things though, too, is that their microcontrollers are an old technology, right? They've been around for ever. So one of the explanations I've seen on it is that it's older tech that a lot of the manufacturing stuff is up a lot of a lot of the harder to get stuff is because there's something unique in the manufacturing process for it. And it's hard to, it's hard to get that, or they're using those chips for something else that's just willing to pay more, for example, like maybe I don't know, specifically. But for example, the Raspberry Pi might be using a component that cars are also using, because it's higher order. And, you know, car companies are just going to pay more for that part. And I
think Well, no. Well, I looking into, like, knowing what's going on with the Raspberry Pi. So Raspberry Pi. They started 10 years ago as like a hobbyist and educational environment as the single board computers. What happened will was in the past six or seven years is that companies have learned that these computers are awesome, and started putting them into manufacturing products and stuff. So what Raspberry Pi did, as the shortage started to happen, they started to focus any product they developed in they could get through the pipeline, they were moving in through the commercial pipeline. That's what that's what was going on. So the end user couldn't get the Raspberry Pi's, but commercial vendors and manufacturers who using them in their industrial products, were able to still get them.
And the pipeline for the lower order. microcycle is huge. So they can handle the demand for consumers.
Their most important customers first, I guess, is how you'd put it. But you said old tech a little bit but the Raspberry Pi pico is good. A microcontroller, the RP 2040, which is a brand new microcontroller chip that was designed by Raspberry Pi two years ago.
Yeah, to clarify what I meant by it is like process control systems and like manufacturing and and microwaves and things have been using this type of technology for years. Not that not that they haven't improved, improve them incrementally better. There's been new things, but in general, these these types of components have been around in the US for a very long time.
So I edited our next question, right? Because we've already talked about like, the vast array of things you can use a microcontroller for, right? And I think people can be pretty creative as to like, what they what they could get one of these and use it for. So the Edit to it is like what types of things wouldn't you consider using a microcontroller for? Is there anything that comes to mind? Where you're like, oh, no, like don't don't use a microcontroller for that.
It just interesting question. I would not try to run the Drupal site on a microcontroller.
Well, right. So I mean, I think we established that right, like it's very, you know, it's kind of low, low resource intensive sort of stuff and kind of like, very strict in the, in the kind of like, take in an input get out and take in input get an output sort of thing, right.
So so when you think I don't want to control just to put in perspective, here, we're talking about a, a very small computer's CPU device that has maybe 64 to 56k of RAM, it may or may not have some flash memory, and it has circuits that interact with outside devices. So there's lots of places a microcontroller does not fit whatsoever.
So so let's say you you're interested because the show you want to get started, what what kind of languages are microcontrollers usually written in? And how do you program them? Like, how do you physically get your program onto
them? Yeah, great question. So magic, it's magic. So there's I think there's the development like learning side of the microcontroller. And then is the production under the put it in a microwave oven version of that which I'm not going to discuss but basically microcontrollers today, the two that we've talked about, in general, the PICO in the ESP 32. These are controllers that you can write micro Python for C, C Plus Plus, and assembler. Okay, are really the languages that you're using. And the reason why I recommend starting with the Pico is because it's really easy to get up and running the Raspberry Pi foundation who is really educational based like it trying to get people to understand technology and in breed our next generation or two of engineers, they've made it very easy to program a microcontroller. Basically, you've you plug this through a USB cable into your computer, you fire up, probably the most common IDE for it is called Fonny, s th o n n y Fonny. You fire up this IDE in you get up and running in five minutes. You can run you can write a micro Python program and have it running on the Pico and in under 10 minutes.
What was your first program then microcontroller?
That's a good question. I think I think one of the early things I did was when I moved away from Raspberry Pi, I started to play around with interacting with API's online. I think I showed you guys this at some point, which was I had a display on my, on my on my desk for a while, which was an LCD that was plugged into my to do list, which is to do is to use for my two dues every day. And it was displaying it was calling the API online for Todoist. And displaying my open tasks on an LCD on my on my desk. So I could constantly see the tasks that I needed to complete that day.
It does sound stressful. But it was more of a love for like figuring out how this worked and making it work. So.
So again, our next question is average the average person, right? How do they you know, could they get a microcontroller and program? It sounds like from our conversation, right? Yes, they could. So Let's enhance that question a little bit and say like, how do you think somebody would kind of get started with this, if they wanted to get into this, this, you know, sort of thing.
It's really easy. And, you know, Raspberry Pi foundation is made that easy by you basically buy a Raspberry Pi for the five bucks. And then all of the documentation that's available for you, um, Raspberry Pi, like, creates these books. That's like, you know, learning the PI Pico. It's a physical book you could buy, which I don't think is available right now it's sold out. But all of the documentation is always available online and through PDF. So you could download, you could buy pico for five bucks online. Don't go to Amazon, go to raspberry pi.org.org directly.
There's a link in the show notes. Okay, yep.
And buy Pico. Go to their website, download the book that takes you right from the very beginning. Because there's a couple of things here is one is when you starting to do this thing, do this stuff with a microcontroller, this there's a lots of things you're learning. One is the programming side. The other is the electronic side of this, right. So as you're starting to interact with other physical devices, you need to learn a little bit about basic electronics. Like what is the resistor? When I plug these things in? How do they work? five volts versus three volts. How do I make this stuff happen is these different communication protocols with a microcontroller? Eye two squared and in these things you need to learn and it's all fun to do. Really interesting. And the documentation from Raspberry Pi walks you through that stuff. So that's how I would recommend people starting. There's tons of resources out there as well, to learn this kind of admission.
So so let's say, let's see come up with a use case, like one thing that I've been thinking about dipping my toe into this for quite a while, actually, and maybe this will inspire me to actually do it. But let's say I come up with the use case, I want to get more temperature and weather sensors around my house, right? It may be outside in the shed, too. I get the components that I need, I figured out the programming, get it on the controller? How do I package it up? And so that it's like, ready, quote, like, I'm not gonna produce a product, right? But I still want it to just not be a bare board, just like, you know, taped to a wall, right? How do you package it up? Are there? Are there containers? Or figure it out?
What do you know? That's a? That's a great question. So. So Nick is saying, like, I've got these little, these little controllers. And for anyone listening here, watching here, like, here's an example of one, I've got this little board sitting, that's like, a half an inch by an inch, and I'm connecting it all these wires. How does that? How does that facilitate itself into a product? Right Is your question.
Yeah. And like I said, more specifically for personal use, right? You're not?
Exactly right. So there are lots of resources. So if you're into 3d printing, this is your like space. Because there's lots of designs out there that you can download in 3d print containers, and boxes in all kinds of things frames to put stuff in. I haven't done that. So my stuff has been way more rudimentary. So I spend time at, at Michaels in places like that and buy these, these wood frames that fit stuff in and I tape them in, and I build things myself mechanically, through these little things, I find it Michaels generally is the way I make my final products work. If you look in my basement, I do have my humidity and temperature sensor is basically these things taped to a wall, which isn't super attractive, but it works fantastically.
I'm going to keep going back in my head as we're talking to the the kind of, like getting into this right, and my previous question was like, talking about the average person, right? I'm hearing, you know, obviously, we all have some sort of coding background, right. We also, you know, there may be like some of us have a little bit of electrical background. You know, Steven just talked about, like, a 3d printer. Right. And, and having into that, like, do you I mean, do you see like, if somebody is listening to the show, and I think you answered the this and kind of a little bit in the last question where you said, like, start with the Raspberry Pi, because it kind of takes you from like, nothing to something right. Do you see that as a as a path for somebody like for VT for somebody, like say a, you know, I don't know, a librarian or somebody that's like, completely not into, you know, into the tech space or into, you know, programming like, is that a good path for them to get get started with us?
Yeah, totally is. So you don't really need any expertise to do to get to the starting point of this. You need very minimal outlay in terms of buying stuff. One of the things that people often ask is, do I need to learn how to solder things? Like I'm dealing with electronics, so no, you don't because there's this thing called a breadboard. It's a way to connect electronic devices without doing any soldering. And it's a way for you to like learn, you need to buy maybe four or five things, some wires, a breadboard, a microcontroller that has headers. So a header is like these little pins that stick out of a microcontroller, you could plug into a breadboard and then connect all your other devices. So you can you can launch into this in terms of learning and experimenting without knowing a whole lot and not being fear of like doing anything damaging or we're fear of electronics
and the investment the monetary investment is pretty low too. So even if you do you mentioned voltages or louder? If you connect five or 12 volts to something that needs three volts, you might rephrase something. But if you if you do, you're just losing like, what, two bucks? It's, yeah, it's literally
it seems it seems a lot cheaper than most hobbies.
It is. Yeah. compared to if you fry a Raspberry Pi or something, which is really hard to replace, and quite a bit more expensive.
One of the things I just want to mention on the programming side is that from our perspective coming from a Drupal side, like in Drupal eight and Drupal nine, object oriented programming, was the way Drupal went, when, when it went to eight. What are the things that it's been really interesting to me working with microcontrollers is that Python is a object oriented language as his like, obviously, C++. And if you're struggling learning of the going into programming a great way, I think, to get a grasp on that is to work in this physical world, where you know, a lot of examples you see in object oriented programming for PHP, or any languages, like you come up with these objects, and these objects are always things that you can't see in touch. They're, they're things that don't really connect to you in some way. But you can in the physical world, you can actually create an object that is a light bulb, right, or in my example that gave earlier which is a microwave, which is something that I built. So I built this using a microcontroller built this microwave oven, that is not really a microwave oven. But it created these objects for a fan and a light and a door in I could actually really get a good sense of what objects meant when I when I could actually see them and touch them and make them turn on and off. So it's an interesting way to learn the object oriented world by coding a microcontroller using object oriented programming.
I was thinking that's why Stephen was wearing a hat today because he fried all his hair off.
Well, that before we move on, actually, there is another question is. So you mentioned you're using micro Python, and you can also use C++ or C, C. And those last two are compiled languages, right? Yep. Is micro Python typically isn't as micro Python, you have to compile for micro Python to go
no, no. So you don't compile the micro Python to run on the microcontroller. But when you use assembler or c plus, plus you do compile it and then push it to the board. So it's running compiled code. So like, if you see microcontrollers that people are implementing real solutions with they're generally using C Plus Plus or assembler to get to the final product. Yeah, right. performance reasons, right? Yeah. But a good way to start is with the the micro Python gives you the sense of what it is. And I've been doing stuff in C++ to see the difference and comparing the C Plus Plus versions versus the micro, the, the Python versions to see what the difference is. So yeah, so just to just to clarify
those compiled languages, like that is something that you have to be familiar with. And you have to compile those before you put them on the chip, right. But there's no process in place to like compile those as they go.
No. So like in the C Plus Plus, or the assembler, or you compile them on your PC. And then you push the final code to the microcontroller. So it's like an additional step. So people getting in people starting with this, like Python and micro Python is a great way to start to get the feel for it, if you like, Get serious and want to like, test things out and see what the in push things in the real world because there's lots of manufacturing products that are using this pie pico this, like, it seems it's $5. It seems like who would use this, it's been used in tons of products today as like a real world solution to implement physical things. And you could learn how to code that. Those things are probably implemented in C plus plus at the end result, but people started in the micro Python side. Interesting.
So you mentioned Drupal a few seconds ago and you did say that Drupal would you wouldn't run Drupal or automate a controller. So how do microcontrollers relate to Drupal or is this just a hobby and you want to talk about it and that's why we we
know it's a great question. and it is a hobby and I love to talk about it, which is why I'm glad I had a guest host spot. Talk about this because I used to have this outlet years ago. But you guys have spent a number of episodes in the past few months talking about like interacting and interacting with Drupal outside of Drupal. Right. The last few episodes you talked about Gatsby microcontroller is Gatsby, if you think about it, in a way, right? It's basically interfacing with Drupal. Outside of Drupal. So a microcontroller that has internet access could very easily start up in interface with a Drupal API. So think about something like I have a manufacturing plant. And I want to put these LCDs into the plant that gives current statistics about what's happening in our production environment. And you run Drupal, you could very easily use a microcontroller connected to an LCD interface. And query a Drupal API to find out what the current production stats were, and display them to people.
And you can have it on the sounds like you could ever on the other side, too. So you get a microcontroller that's measuring at the production line, what's happening? And then just feeding that information back into Drupal as well as kind of responsive Yes, yeah,
works both ways. Exactly. I
wonder if anybody's doing that somebody's got to be doing that somewhere in the world with Drupal?
There's no question about it. Yeah. Here's what that
very now now I'm thinking of all the different ways I can interact with microcontrollers on my Drupal site. But so let's just talk. And we've talked a little bit about this already, Steven, but like, how have you used microcontrollers in the past? I mean, you you just told us, you know, obviously, you have humidity detection and whatnot in your basement. We talked about, you know, your washer and dryer setup, are there are there any other ways that you've used these microcontrollers, in your, in your past in your house, outside of your house, so on and so forth? No, I think
that covers it like so I'm a hobbyist at this, right. But it's super interesting to me. I've been using microcontrollers, probably the last three or four months more about learning about technology a little bit more. So for example, the Raspberry Pi pico has a CPU on it, the RP 2040 that has two cores. So I've been playing with writing code that executes against two cores instead of one. So just because of the things I'm interested in, that's something I'm playing with. It's, it doesn't give me anything at the end. But I'm learning how to code. multiple cores instead of one
is a core synonymous with a code base.
Now, so if you think of CPUs, so when you when you talk about a CPU, a single core CPU has one thread of execution code. When you have multiple cores, you can run multiple things at one time, and see how they interact. So performance and so to increase performance, is why multiple threads or multiple threads will be used, instead
of doing things linearly, you could do do this and then do come back and
Yeah, that's a great description, I think, Nick at a high level, the difference with dealing with a microcontroller is you don't have an operating system that's in between. So when you do PHP, the operating system is actually deciding making decisions about who actually executes in the CPU. And the interrupts in making things happen there. When you deal with a microcontroller, you have direct access to the CPU. So you are controlling yourself in the code, the interrupts and what happens when So those are the kinds of things John I've been playing with over the past three or four months is just just getting a better understanding of how computers work and how technology works. There's actually some projects out there for microcontrollers that people have written operating systems that run on a microcontroller. Which Oh, wow, it's super interesting, because it gives you a real interesting feel about how an operating system works.
So the performance must be terrible.
Actually, the performance is not terrible. It's like, when you're coding in a microcontroller, you're talking to the hardware directly. Right? It's not there's no layers in between. So it's, it's an interesting way to learn about how technology works, which is how I'm using it. I think it's a great way to learn more about object oriented programming, great way to learn more about how computers work in general,
how much space is on a microcontroller? So like, if you have like a program, and it's, you know, rather large, right, like, do you have run a risk of like, basically running out of space?
Yeah, sure. So it's, it's a very small amount, like, we're talking about. 256 Meg's of probably like, an, I think, in the Raspberry Pi, it's 256, Meg's of RAM that you can put something into so Oh, okay. We're talking about going back 20 years, 30 years in terms of resource resource availability?
Yeah. I think, again, like a simplistic way of looking at this in my brain was like, Oh, it's a small chip. So it's going to have like, you know, kilobytes of data. As opposed to like, be like, 256 is like, okay, that's like, you know, a good amount of space, especially when you're you're coding, you know, in something like C or Python.
So, as we wrap up the show, I think you've recommended somebody's getting started, they probably should look into the PICO or maybe the ESP 32. And you mentioned the Raspberry Pi foundation has some good articles and things, but are there other is, are there any other recommendations for people just getting ready to start any blog posts they should read, to get primed? Or like the best place to fight like you mentioned, a breadboard? Like how do you know all the different component pieces you need to get started?
Yeah, we'll put this in the show notes, I cannot recommend more just the Raspberry Pi documentation, they're getting started books, I'll put a link in the show notes is really the best place to start. Because they they take you on the journey from zero and get you there. And the investment is small. And their documentation is written for people who knows zero, which was me, you know, a couple of years ago.
And now are they a man? I'm assuming they're giving you code examples like, Hey, you're doing this. So here's the code that you would use to do that. Are they also teaching you like the Python basics, so that you can kind of get familiar with
it? Okay. Yeah, they're doing all of that. Yeah. Oh, cool.
Interesting. Well, Steven,
you could also, you could also, if you're local, you could go to nerd Summit, which is coming up in March, and I'm going to be doing a microcontroller introduction training there.
And when he says local, he means the New England area as nerd Summit is in Western Massachusetts. You can, you can definitely check that out. Is it a full day training, half day training?
It's a half day. Okay, cool. I think we only need three or four hours to get someone really up and running with a microcontroller, a breadboard, some wires and a few components. And you could like, get started with this and see if that's something you're interested for anyone out there with young children. What I mean by young, so maybe late elementary, middle school, this is really something if they're interested in to get them started and it gets them in. It gets them into electronics and engineering early. It's easy accessible. If they can see things get results quickly. A great way for them to if you want to steer them or if they're interested in that direction.
Interesting. Something to think about as I have as I have somebody that fits that criteria in my house. Steven, as always, thank you for joining us for the last four weeks. This topic has and super enlightening and we will definitely hear hear from you again.
And for our listeners if you have questions or feedback you can reach out to talk in Drupal on Twitter with the handle talking Drupal or by email was Joe at talking to people.com. You can also connect with our hosts and other listeners on the Drupal slack and the tagging Drupal channel.
You can promote your Drupal community event on talking Drupal. Learn more at talking drupal.com/td promo
and you can get the talking Drupal newsletter for show news, upcoming Drupal camps, local meetups and much more including a picture of Stephens basement, humidity, temperature and sensor at talking to.com/newsletter.
Thank you patrons for supporting talking Drupal, your support is greatly appreciated. You can learn more about becoming a patron at talking drupal.com and choosing the become a patron button in the sidebar. All right, gentlemen, we have reached the end of our show. Stephen, if folks wanted to get a hold of you to talk about microcontrollers, or anything else for that matter, how would they go about doing that?
At @stephencross with a pH.
And Nick, what about you
can find me at nicxvan pretty much everywhere.
And I'm John Picozzi. You can find me on all the major social networks at John Picozzi and you can find out more about EPAM at epa m.com.
If you've enjoyed listening, I've enjoyed talking.
Have a good one everyone. See you soon
Transcribed by https://otter.ai