CHARLES MAX_WOOD: Hey everybody and welcome to another episode of JavaScript Jabber. This week on our panel we have Steve Edwards.
STEVE_EDWARDS: Hello from sunny and beautiful Portland.
CHARLES MAX_WOOD: Amy Knight.
AIMEE_KNIGHT: Hey, hey, it's from Chile and Nashville. It's like 49 in April. What's going on?
CHARLES MAX_WOOD: I know, right? AJ O'Neill.
AJ_O’NEAL: Yo, yo, yo, coming at you live from a giant MacBook keyboard covered in stickers.
CHARLES MAX_WOOD: Dan Shapir.
DAN_SHAPPIR: Hey, coming from you from sunny Tel Aviv where it's a wonderful weather, but we can't go out because we're in lockdown.
CHARLES MAX_WOOD: I think that's worse than having it cold outside. I'm Charles Max Wood from DevChat.TV. Quick shout out, JS RemoteConf. Come check it out. We're also putting on another JavaScript related conference. It's the React Native Remote Conference and that'll be at the end of July. So if you're looking for those, sounds good. If you want another JavaScript Remote Conference in more Europe-friendly time zones, then let me know about that as well. We have a special guest this week and that's Joe Carlson. Joe, do you want to introduce yourself?
JOE_KARLSSON: My name is Joe. I'm a developer advocate at MongoDB and a longtime fan of the show. Excited to be here.
CHARLES MAX_WOOD: I was going to say MongoDB, never heard of it, but anyway.
Early in my career, I figured out which jobs were worth working at and which ones weren't, mostly by trial and error. I created a system that I use to find jobs and later contracts as a freelancer. If you're looking for a job or trying to figure out where you should go next, then check out my book, The Max Coders Guide to Finding Your Dream Developer Job. The book walks you through figuring out what you want, vetting companies that meet your criteria, meeting that company's employees, and getting them to recommend you for a job. Don't settle for whoever has listed their job on the job board. Go out and proactively find the job you'll love. Buy the book at devchat.tv slash jobbook. That's devchat.tv slash jobbook.
CHARLES MAX_WOOD: We brought Joe to talk about Iot with JavaScript. We tend to hit this topic probably once a year. I'd like to do a little bit more of it. Honestly, I want to start an IoT podcast, but that's kind of down the road. Um, do you want to give us a rundown on how to do IoT with JavaScript? Like just kind of the basics and then we can start discussing, you know, details and what we can build and stuff like that.
JOE_KARLSSON: Yeah, absolutely. If you start that podcast, you should like, let me know. Love to chat about it. Well, first of all, I think not a lot of JavaScript developers even know you can develop IoT type things with JavaScript. I think a lot of us think of like C and C plus plus or like low-level languages, and they might even be aware of the ecosystem. And I got into it just because I was like super into making like weird hardware projects, and I knew JavaScript's like, can I figure out how to do this together? But yeah, actually, the Node.js Foundation did a survey too and found that 58% of IoT developers actually self-identify as Node developers. It's like a majority of developers are already developing in Node. And of course, I think we all know like the trend towards having more devices being connected online is going up. Honestly, it might be like a little hyped. Like we see those like giant exponential curves of chips, which like maybe a little bit of hype, but like the fact of the matter is it's just going to keep getting bigger and bigger. But yeah, should I talk a little bit about like why you might want to consider JavaScript for your next IOT project? Just like in general, like what benefits do you even get?
CHARLES MAX_WOOD: Yeah, I like that. Especially since I've seen a lot of people doing it in other languages, some of it's low level stuff. Some of it's the Arduino programming system, which is kind of C-ish. Right. And then I see other people using, I mean, you can do it with all kinds of stuff, with Ruby, with Python, with C-sharp.
JOE_KARLSSON: Yeah.
CHARLES MAX_WOOD: And Microsoft actually has like a big system for IoT. I think Amazon Web Services does as well.
DAN_SHAPPIR: Microsoft has a big system for more or less everything.
JOE_KARLSSON: Yeah. Yeah, yeah, yeah. Amazon's pretty safe in that category as well these days too. I haven't played with either like Amazon or Microsoft systems, but I've seen work developed by both of them and they're amazing. They're really cool. Tell my to-do list. I'm sure like all of us here, we are to-do list is years long. Who knows if we'll ever get to it, but, uh, yeah, let's talk about JavaScript in general, like why I actually think that there's some like advantages you get that you wouldn't get with other programming languages with IOT hardware projects. And the first one is it's just super easy to update. So like for example, if you're doing a low-level project, you basically have to plug it in and you re-flash the chip with whatever, the new data or whatever. And just imagine you have a fleet of IoT devices out in your farm or your field or your house or whatever. Getting those updated would be a pain, but it's with JavaScript, if you connect to the online, you just do a Git pull and MPM install, boom, right? You've already updated your application, which I think is amazing.
DAN_SHAPPIR: So wait a minute, before you continue, so the JavaScript is running, you're downloading the JavaScript to the device itself. So there's a JavaScript engine built into that device. Which JavaScript engine, by the way?
JOE_KARLSSON: I use just Node, I'm just running Node. So yeah, we haven't talked about this yet, but I recently built a IoT, I built a bunch of devices, but my latest one is an IoT litter box I built for my cat, but, and I built it with a Raspberry Pi. I know it's-
AIMEE_KNIGHT: I wanna hear about this.
STEVE_EDWARDS: We have now descended to talking about cat poop.
AIMEE_KNIGHT: Yes.
JOE_KARLSSON: And the idea is it was supposed to be kind of like dumb, like a dumb, horrible, like an idea, but it's, I think it kind of straddles the line between just idiotic and kind of genius. At least I hope so. And kind of useful.
AJ_O’NEAL: That's a very fine line. It is.
JOE_KARLSSON: And I think that there's like some interesting stuff at that line. I like exploring that line. Sometimes we go over into this totally ridiculous territory, which I think is fun too. But it did. Basically, the project I built, it's a Raspberry Pi, and you can use a lot of different runtimes too, but it just has a Node runtime on it basically.
DAN_SHAPPIR: So it's an up-to-date version of Node that you yourself install on the device.
JOE_KARLSSON: Yes, but there's actually other things too. So there's existing JavaScript libraries. The two biggies right now are Cylon.js and Johnny5. They were watched short circuit, but they support a ton of different chips, and it actually can compile it down to like bytecode, so it can just run on the chip JavaScript runtime running all the time too. Cause there's advantages and disadvantages of having, like JavaScript's kind of a, it's a memory hog, right? It's a garbage collector, it does a bunch of stuff. It can be more resource intensive than a color-level language. But you can get around that too with these libraries these days. Yeah, so the ecosystem is actually pretty great. Like the chip support's amazing and the libraries are amazing. Hard to show code on a podcast, but I know maybe in the meeting notes or something we could like link out some of the code on here or something. But.
AJ_O’NEAL: Do we want to back up and say what IoT means or doesn't it mean?
JOE_KARLSSON: Yeah. Yeah. Yeah. Yeah. Actually, yeah. Does anyone else want to take a crack at it? I mean, I'm sure we all know here, but, uh, or am I the guest? I should probably explain that.
CHARLES MAX_WOOD: No, it's all good. I was going to say it's the last three letters in idiot.
JOE_KARLSSON: Oh, I love that. I'm going to steal that joke for my next talk. You should. You should. IoT, it's Internet of Things, and it's basically anything you put a chip in. I think these days we're seeing kind of like this explosion of putting chips in, you know, Alexa's and Google homes and ring doorbells and light bulbs, right? Like anything that connects to the internet basically is part of the internet of things.
CHARLES MAX_WOOD: Yeah, I was going to say, is there a line between, yeah, the Echo and maybe my smart thermostat in my house and some of the other home automation stuff versus, you know, some of the more hardcore. I'm going to go build a Christmas lights display that, you know, blinks at the right time kind of thing that I have to code myself.
JOE_KARLSSON: Totally. I mean, as long as it connects to the internet, I think it's good. I think the thing that people don't, we think about like the consumer goods a lot, but the other part that people don't consider a lot is like manufacturing. A lot of plants are moving towards like IoT humidity sensors and pressure sensors or whatever to like automate a massive or farms or whatever. Like we're seeing a massive resurgence of internet-connected sensors and devices.
DAN_SHAPPIR: I remember that. You know, wearables were the sort of big things and then they kind of faded away. I really expected to have node installed in my shoes, but that somehow never materialized.
JOE_KARLSSON: Not yet. Yeah, not yet. I, you know, and maybe someday it's maybe some, I think for someday it's a, I agree. It got kind of exploded. Who knows? Who knows where it's going to go? But, uh, actually at the end, I'd love to talk about kind of predictions I have for the future of IOT and particularly like JavaScript fitting into that too. I'd love to talk about that too. But yeah, yeah, it's a lot. The other thing I want to talk about too with JavaScript with being a great fit for, well, there's two more things actually with just building IoT projects is that JavaScript is natively event-driven, right? We have like callbacks, promises. And if you think about how you build an IoT device, IoT like triggers are basically real-world events. So like imagine, right? We're building a front-end application and we have some sort of event listener waiting for like a click on a button and we do some sort of function when that callback function gets invoked. IoT devices are working for the same thing. So imagine I have my IoT litter box. So I have a pressure sensor. It's basically a fancy scale, like a bathroom scale, and it's waiting for an event of a cat-sized object to enter this bathroom scale I built. But that's an event, right? It's just like wait for this thing to be triggered, and then run a function, a callback function after this happens the structure of JavaScript natively fits perfectly for how we build IoT devices.
DAN_SHAPPIR: So do you usually just use native JavaScript on top of Node to code that sort of stuff? Or do you use some libraries or God forbid frameworks? Or what about that?
JOE_KARLSSON: I don't use React for it, but I use Johnny5. Johnny5 seems to be the most used, most up to date, and I've had great support. And I have amazing chip and sensor support too. So it's like a library that sits on top of Node.
DAN_SHAPPIR: And what does it provide, for example?
JOE_KARLSSON: So it provides native sensor support, which is amazing. So I can just instantiate a new Raspberry Pi board, and then I can tell what board and how we're connecting these different sensors. So for example, with my litter box I built, I have two sensors. I have that bathroom scale. So it's measuring that cat-sized object, kind of entering the box. And the other sensor I have is a switch. So it basically tells when the door is opened, and I call it like maintenance mode. So when I open that, like that sensor being, I tell it, it's plugged into this GPIO or the general purpose input output things. That's just how we connect sensors to our IT devices. And I say like on this pin, I have this sort of switch and natively has these built-in functions open and close and it just waits for those. It basically just makes writing hardware projects ridiculously easy.
DAN_SHAPPIR: So you keep talking about that cat driven litter box.
JOE_KARLSSON: Yes.
DAN_SHAPPIR: What does it do exactly?
JOE_KARLSSON: Dan, great question.
DAN_SHAPPIR: What is this thing we're talking about?
JOE_KARLSSON: What it does is it's a litter box that passively measures my cat's weight and the number of times it goes to the bathroom and also how often it gets cleaned. And it started off as a joke. And actually, I found it out. You can buy like thousand dollar IOT litter boxes out like right now, like consumer products. But yeah, I think the biggest thing for me is just like, we can keep track of like health and weight habits over a long period of time. So I've like built like data visualization. There's also things like I can, I travel a lot for my job. So I can tell like if, you know, my, the person taking care of my cat when I travel is, you know, opening the box and cleaning it, right? So we can track health and cleaning and all this stuff over time.
STEVE_EDWARDS: So does it track the weight difference before and after pooping? So you can tell how much weight it can do.
JOE_KARLSSON: You know, you totally could. You totally could. Yeah.
STEVE_EDWARDS: Not what I call instant weight loss.
JOE_KARLSSON: It is. It's a, I haven't started tracking that, but there's nothing stopping it. There's nothing stopping from tracking that data.
AIMEE_KNIGHT: I mean, in all seriousness, that could be useful.
JOE_KARLSSON: Yeah, for real.
AIMEE_KNIGHT: Yeah. Like vets and stuff. Anyways.
JOE_KARLSSON: Totally. Exactly.
AJ_O’NEAL: So when you're dealing with microcontrollers like Arduino, I, and even the TESL, my understanding was that those are not compatible with JavaScript. So is this like transpiling into Lua or transpiling to something else that does run on those platforms? Or is there, but like what's going on? Cause you can't, or was it DuckJS is the other?
JOE_KARLSSON: Cylon, DuckJS should be a framework if it doesn't exist yet.
AJ_O’NEAL: No, no, no. DuckJS is a runtime like node, but that comes from a microcontroller. Because, I mean, you can't fit 100 megabyte thing. You can do that on a Raspberry Pi just fine, but you can't fit that on a microcontroller. So I'm looking through the Johnny 5 stuff here.
JOE_KARLSSON: Yes.
AJ_O’NEAL: And I'm like, everything looks like it's an Arduino example. I'm like, you can't run JavaScript on an Arduino.
JOE_KARLSSON: Totally. And I don't know the specifics of what goes on behind the scenes, but I do know for like depending on the board. So I'm using a Pi which has a runtime on it, so it doesn't have to compile it down. But if you do have a board like that, it does, it will compile it down to like bytecode that can run or see. I'm not exactly sure that transpilation happens, but it will convert it to the appropriate runtime for you.
AJ_O’NEAL: Okay. Yeah. Cause microcontrollers you're dealing with bytes and kilobytes, not megabytes and gigabytes.
JOE_KARLSSON: Yes, exactly. Yeah. And, and if like space is important for you or like performance and bytecode is super important. Like. That's, I mean, JavaScript, frankly, falls short in that category, right? Like it can't compete. If it's doing garbage collection, you're not going to be able to compete with space collect being that efficient and CNC plus plus might be better fit, but if it's your first like IOT project and you're not building a massive fleet of something, you're probably fine. You're fine.
AJ_O’NEAL: Well, no, I mean, like you literally can't run node on control. It's literally not possible. I'm not saying that because you can, um, so there's duck JS, I think it's called duck JS. Let me check and see if this is what it is. So it's something, it's got some weird name, or Duck Tape JS. That's what it is. Duck Tape JS.
JOE_KARLSSON: I'm going to have to look that up.
AJ_O’NEAL: And then when the, I think it was the Tessel had their Kickstarter and they talked about using node modules on the Tessel, what they actually did was they transpiled from JavaScript to Lua. Lua is almost identical to JavaScript. Like if you look at old school JavaScript, Lua...is just maybe not as well standardized. There's not like, you know, with JavaScript we have two platforms. Well, we just have one, V8. V8 is JavaScript.
JOE_KARLSSON: Right.
DAN_SHAPPIR: AJ, if I can interrupt, since you're mentioning Lua, I don't know how many of our listeners are familiar with it. Maybe you can say a few words about what Lua actually is. You know, obviously not a Lua podcast, but still.
AJ_O’NEAL: Oh yeah, so Lua was developed around the same time as JavaScript. I think it was developed Brazil, Lua means moon, and it is strikingly similar to JavaScript. It is almost the same syntax. There's a couple of things that are a little easier. There's a couple of things that are a little more strange. Metaprogramming is easier in Lua and Lua is the primary scripting languages for games. So if you're going to get into game development, Lua is what you embed in with like the C++ code that gives you dynamic nature to be able to have dynamic runtime stuff going on in a game. That's its primary use case. But it's been picked up here and there for various purposes. Like Tim Caswell, who was really big in the node community, created a port of node in Lua called Loveit, and that got picked up by like Rackspace. So Lua is one of those languages that doesn't die. And that always finds novel use cases, but is not ever at the forefront. I think in part because it's never been well standardized and every implementation is slightly different. Like JavaScript used to be before Node when there was like Rhino and Jagger Monkey. And you know, when there was like 10 different implementations that all work differently and some of them were synchronous and some of them were asynchronous, et cetera, et cetera.
DAN_SHAPPIR: When you mentioned that Lua doesn't die, it kind of reminded me of COBOL in New Jersey.
AJ_O’NEAL: I think it's a different kind of doesn't die. I think Lua is a useful language that is, like for modern applications, Lua is a useful language. I think it's like, well, Lisp doesn't die and Lisp has a similar problem where there's not like a standard runtime for Lisp. There's like the Steel Bank Lisp compiler is what a lot of people use, but it's not a standard.
DAN_SHAPPIR: So you were saying that Lua has native support in some IoT devices and that for in order to support those devices, I kind of need to transpire JavaScript into Lua, something like that.
AJ_O’NEAL: Well, the thing is, it's easy to write a Lua interpreter, like the same way that it's fairly easy to write an interpreter for old-school JavaScript, because the language was very small and therefore it didn't have a lot that you had to interpret. Lua is similarly extremely small as a language, and so writing an interpreter for Lua is not a big deal. And so it was simpler to write a Lua interpreter in C or C++ that you can easily run on the Arduino in just a few kilobytes of code. And then there was more tooling around using Lua in environments that microcontrollers are well paired with microcontrollers. And aside from duct tape, I'm not aware of something. And I don't know if duct tape, it looks like duct tape is now bigger than it used to be. But I think one of the goals was Duct Tape was to be a similarly really, really small JavaScript interpreter that could run in just kilobytes of code rather than megabytes and gigabytes. So when I think of IoT, like I know that a lot of us think about microcontrollers for like hobby projects, but when I think of IoT, I think more things like Redbox, industrial sensors, most of these things are running something that's more like a Raspberry Pi. They have microcontrollers that they interact with, but they actually have full Linux operating systems. Your Redbox is not running on an Arduino. It's running on something that's more similar to a Raspberry Pi or perhaps even more powerful than that. But it does, it's got robotics, it's got trays that move back and forth, it's got an arm that moves up and down, it's got a barcode scanner that translates as if it's a keyboard device and then it's got a SIM card in it. Raspberry Pi with a SIM card that can interact with the physical world either by sensing something or by controlling something yeah, so sensing for example temperature humidity barometric pressure controlling a Arm or a motor or a light or sound device, right?
JOE_KARLSSON: Well, you bring up a great point to AJ. I think like there's a ton of different devices too. And it personally is my total opinion, but I would recommend using a device that's running like a modified Linux thing, especially if you're first, if you're just getting started with the IOT, um, that's where I think something like a raspberry PI, it's like a $35. It's got a full Linux runtime. And if you're used to doing development in a Unix based environment, like the only thing you have to learn then is how to hook up the sensors, the GPIO. I think it kind of minimizes like the cliff to get into it.
AJ_O’NEAL: Well that's, that's kind of where I started. Like back before the raspberry PI, there was another platform called gum sticks. And when raspberry PI introduced, like Gumsticks was crazy because it used to be if you wanted a development board similar to the Raspberry Pi you'd be paying $1,200 And then the gumsticks came out and it was like two hundred and fifty dollars and that was exciting. And then the raspberry pi came out and it was thirty-five dollars and that was just mind-blowing Like how is this even possible? And and I think that the raspberry pi just like you said is the right mix of high level and low level It gives you really high level. You you have an operating system. You have linux you can interact with slash dev. I mean, you have access to everything.
JOE_KARLSSON: Access to it.
AJ_O’NEAL: Exactly.
JOE_KARLSSON: Yep.
AJ_O’NEAL: But then you still do get the GPIOs and you can do analog pins and digital pins. And it's all fairly well documented. And if you are a developer, I think that that makes a lot of sense. For some people that are not yet developers, they haven't even done programming. The Arduino can make a lot of sense because it cuts out the operating system. It cuts out the development environment. And it's just like here's the name of a pin, put this online too. Here's the name of a, of a state, sign it to the pen. It's on, it's off or whatever. But yeah, I totally agree that for people that are already developers, it feels a lot more constraining to be on something like Arduino and it's completely, you know, you don't have a lot of knowledge that you can carry over to an Arduino. I mean, other than basic programming skills, but it's, it's a completely different world. You compile your program and it runs on the controller. And there's no operating system. There's no garbage collection. There's not even a, for people that are familiar with stack and heap, there's not even a heap on most microcontrollers unless you have a special tooling that gives you a heap.
JOE_KARLSSON: Kind of percents. Yeah. And like, if you want to learn C AJOE_KARLSSON: nd C++ or like the modified Python, the Ada fruits working on for their like, great, like go for it, but if you're like me and you're like a JavaScript developer or node developer and you just like want to dip your toes in, like don't drive yourself crazy. I'm going to learn a million new things. Like this just. Build this cool thing you want to build.
DAN_SHAPPIR: So as a JavaScript developer, suppose that I do have a cool idea for some sort of an IoT device that I want to build. What would be my steps?
JOE_KARLSSON: Even if you don't have a cool idea, my first IoT thing was just getting an LED to blink, which is like the hello world of IoT devices. My first IoT project was getting a Raspberry Pi set up. The Raspberry Pi, you have to get nodes set up. So there's some little setup on there. Not too bad though. Node installed that Linux-based environment and then getting the hardware too. You can get like hardware packs on Amazon right now. That's basically what I did. I even get like a $30 just like cornucopia medley of different sensors and just kind of plugging them in and trying them out. So I think the hard part for me was understanding like the GPIO, which I think is the tricky part, like as developers, I think we're used to setting up a JavaScript project and getting it to run, but this new component to like interacting like sensors is kind of new. And I took a electrical engineering class in college, but I don't remember anything about electrical engineering. So like circuits and amps and voltages, like I had to look up all that stuff and try to figure that out with simple projects. But it starts small, I don't know, just like get something in a blank. It's probably the best way in and then you can start adding more stuff to it once you got that blanky thing going.
CHARLES MAX_WOOD: What's interesting too is that a lot of the stuff that you're going to wind up doing in IoT is just turning things on and off.
JOE_KARLSSON: Yep.
CHARLES MAX_WOOD: And so, you know, you wind up, yeah, blinking the light and then it's, okay, well, that runs on a five volt and now I have like something coming out of the wall or something, you know, right? And so then you just get a relay and a relay is literally a switch that turns on when you put the five volts through it. So instead of turning on the light, you turn on the switch and that switch goes, you know, is a switch for something that plugs into the wall or something that, you know, connects to some other voltage. And so you're right there. I mean, the next step is really simple.
JOE_KARLSSON: Yes.
CHARLES MAX_WOOD: And relays are really cheap. And so then you can kind of go up from there and go, okay, now based on, I mean, most of us, the sensors, right. And it's, okay, what do I have on the sensor and what am I going to do about it? And that's what you're programming. And a lot of the, what am I going to do about it is I'm going to turn this on or I'm going to turn
JOE_KARLSSON: or listen to something, inputs versus outputs. And I totally, that's exactly how I build IoT projects. Like I just get one little thing working, write some code for it, and then I add another one. And I do want to put a plug in here too, like that iterative development process, like you really like, so like for example, I am saving these time series data in my MongoDB databases and I can just add new sensor data as I'm adding stuff and as I'm adding and developing and kind of changing and growing these devices, which is basically how we're building anyways.
CHARLES MAX_WOOD: Well, that's another thing I just want to kind of pull together is you're talking about this data and these data series. I mean, that lends itself right into other things like AI and you know, you can, you can also, you know, set something up so that you're maybe your trigger happens through VR or something else, right over the internet or through some other system. And so, I mean, there are a lot of options you can go for with this and the time series data really does actually play nicely into, okay, now I'm turning things on and off, or I'm changing some setting on some other IoT device like my thermostat. And so I have this time series data, and then I have a machine learning that runs it. And after a while, hopefully the idea is, oh, I don't have to go toggle the stupid temperature or whatever anymore, right? It'll just figure it out on its own. And so, you know, some of the tools that are built around time series data, you know, be it in MongoDB or something else, it's just you know, it gets real interesting. But yeah, you know, you don't have to get fancy at the beginning. You can just go with, okay, I'm going to sense this thing and then I'm going to do this other thing.
JOE_KARLSSON: Oh, a hundred percent. Yeah, I totally agree. I've actually, I've, I thought about, I only have one cat, but I thought about adding a little pie camera to the front and doing machine learning to like, if I had multiple cats, like learning which cat is entering the box so I could like tag it. Uh, I haven't done this yet, but total stretch goal. Yeah, totally.
If you're a front end developer looking for remote work, then I recommend G2i a React and React Native focused hiring platform that will connect you directly with their clients that need your skill set. What makes G2I a unique hiring experience is that they spend the time marketing you to their clients of your choice. G2I is a team of engineers that technically vets you upfront. If you pass their vetting, their clients have agreed to skip their initial interview process, saving you time and energy getting your next gig. They take care of all the hard work for you so you can get focused on development. To join G2I, go to g2i.co and apply.
CHARLES MAX_WOOD: So one other thing that I'm wondering about, and I don't know if you've done anything with this, is some IoT, it's like, you know what? I'm gonna have it in my house, tell it where the WiFi is, we're good to go, right? But some IoT is, I'm gonna stick this way out here in this here field, right? And so now I have to have some kind of cell receiver thingy, right, or some other form of internet that's not convenient WiFi. Have you built anything like that?
JOE_KARLSSON: I have not. And there's actually, there's two problems with that, with those kinds of devices that you have to deal with. The first, yeah, is getting it connected. So like either using like satellite internet or like a wired connection or something like that. But actually two, the bigger problem ends up being power. Cause if you have like a remote device like that, you're basically, you're running on batteries and, or like, but it can be, it becomes hard to power it. And especially with devices that's drawing and in JavaScript it's using, that runtime is running all the time. So it can tend to be more energy intensive and can be harder for long-term powering on the field.
CHARLES MAX_WOOD: Right. If you know your power requirements, I'm assuming then that you can have it either call home when the battery's dying or you can have a sufficient battery backup given what you expect, the solar recharge or whatever. But that sounds like a little bit of guesswork to figure out how to make that work.
JOE_KARLSSON: Totally. Yeah, totally. And I haven't personally done it like all the stuff I've done are either like art projects or just stuff I've been building for my house. But, uh, yeah, I had never, I haven't done some remote stuff. I'm sure you could get some like cell data stuff to connect or something, but, uh, I have not played with that yet.
AJ_O’NEAL: So I've played with the cell stuff and on the microcontrollers typically with a microcontroller, typically you're constrained. So whichever microcontroller you're buying, whether it uses micro Python or if it uses Arduino, or if you code it in C, you get a development environment, which is based on the Arduino development environment. So even if it's Python or if it's C, they often still use the Arduino development environment as the shell, just like Eclipse is used for lots of things. In fact, maybe the Arduino environment is a version of Eclipse. And for those that don't know, Eclipse is like VS code from the 1970s. It's just a very, very terrible way to develop.
DAN_SHAPPIR: Oh, you're being too harsh. I remember it. I remember it even in the nineties. Come on. Okay. Well, even in the early two thousands, I think I've got some funny stories around the clips.
AIMEE_KNIGHT: I remember people using it in a CS lectures that I watched when I learned how to program.
AJ_O’NEAL: And every time you right click, it doesn't matter what you right click on. The menu is so long that you'd have to stack like three monitors on top of each other to see it. You always have to scroll through. That's one of the big things I,
DAN_SHAPPIR: Oh, I have to tell you a quick aside about that. So I remember actually being invited to some presentation at IBM. I think it was where they were showing these kinds of fancy plugin that they had created for clips to develop some sort of enterprise software, whatever. And this guy was going, uh, the guy was giving, uh, the, the lecture went through something like a wizard with something like 30 screens and then he gets to the last screen of that wizard flow and the finish button is disabled and he can't figure out why. So he starts backtracking through the wizard by going back, back, back, trying to figure out which data he forgot to put in to make it possible to actually click the finish button. We never actually got to see what happened after you click finish.
JOE_KARLSSON: That's like a nightmare live coding situation.
DAN_SHAPPIR: Yeah, been there, done that.
AJ_O’NEAL: So my point was that when you get a microcontroller, you're typically very, very, very constrained because even, you know, with C, you can't just take a generic C compiler, you have to have a C compiler that's specific to that microcontroller and it's often proprietary. So if they give you the Arduino tooling there is no way to command line compile that much of the time. Like you have to use the Arduino tooling because it's proprietary code that's baked in. And if they don't update it for 10 years, then you just have to use a version of MicroPython or Arduino or the C code that's 10 years old with the libraries that are packaged with it because they have special optimizations and everything. But that pain aside, typically it's very easy to interact with the SIM card because you get something that you import or use or whatever, and it's very specific, and it's already done for you. So on the one hand, you have this complexity of you don't get to choose your toolchain, and it's very rigid. But on the other hand, the tools that they provide typically do work. They just don't get updated. Once they work, they're abandoned forever and ever and ever. So I have not had a difficult time. And it's been a long time. Pretty much the SIM card bit is you just plug in the SIM card. The hard part is getting the toolchains installed and getting to the hello world is typically harder. But once you have that, if it's a microcontroller putting the SIM card in and being able to make an HTTP request or whatever, I don't think that that's the difficult part. Now, if you're working on the Raspberry Pi, then you have to have some sort of adapter that may appear as a like a serial modem or something like that. And so you're going to have to do some Linux configuration to say, use this as my internet connection. And that's going to be a little bit different than the way that you'd use like IF config or IW config or whatever with your typical Ethernet type connection, possibly. And some of it might be shimmed well enough that it feels like Ethernet, but some of it you're probably going to have to do a little bit of Googling and configuration.
CHARLES MAX_WOOD: So I'm curious, where do you see the proliferation of IoT going next?
JOE_KARLSSON: Well, I do think it's going to keep getting bigger. But I think the interesting thing, especially for like the JavaScript developers is I think we're going to continue seeing bigger and bigger optimizations with JavaScript runtimes and maybe more specialized JavaScript support. I didn't even know about duct tape. That's awesome. Like that's kind of exactly what I was thinking of, just like a, like a lightweight runtime that maybe will run better on smaller devices. I think we're going to keep seeing devices getting smaller and smaller and smaller. Like you're going to need to buy some really small chips and more and more powerful chips. And we're going to see continued support for more types of like IoT chips and for sensors. So just development in general, I think is going to get much, much easier for IoT devices and particularly for JavaScript devices too. And lastly, and I've touched on this before too, but this is true for computers, but especially for IoT, but I think batteries continue to be the bottleneck for serious developments. And I think we hear about, I read about some graphite breakthrough that's leading to longer battery life and I've never actually seen that. Who knows, right? But sustainable, massive battery growth is going to be harder and harder for, it continue to be the bottleneck, I think for IoT devices.
DAN_SHAPPIR: I'm just waiting for wireless power in our houses.
JOE_KARLSSON: You and Tesla waiting for it.
DAN_SHAPPIR: Yeah, that would be so healthy.
JOE_KARLSSON: Yeah, no, that'd be amazing. Can you imagine? No longer charging. Yeah. Who knows? I mean, that would be, that's like the dream. That'd be the dream for these kinds of devices, but who knows?
DAN_SHAPPIR: I apologize if I missed it, but did we talk about debugging? Like how do you actually, while you were coding, how did you actually debug it?
JOE_KARLSSON: Yeah, I have, I've actually, I've got some, yeah, I've got some horror stories. Debugging is so much harder for me with hardware and it's honestly, that was a separate skill I had to kind of pick up. Cause I think as developers, especially JavaScript developers, you just console log it, you check the dev tools, whatever. It points like line 68, it's, you got error here, runtime error, okay, cool, go and fix it. Hardware is different. It can be either be software or hardware problem, and then debugging hardware problems is hard. So let me give you a specific example. When I was working on this board, I hooked up a LED backwards into my chip, and it ran power the wrong way through my Raspberry Pi and it killed it. It burned out the LED and it fried my chip. And I didn't know that for all, I was just getting like garbage data back and I didn't know what was going on. It took me about it like, I had to like step away from the project, I got too frustrated. And eventually just bought a new Pi and it had, because it just, it fried the chip and there's no way to tell. Or if like things are like, hardware is not hooked up right, I blew out another like sensors was just sending me garbage data. It was hard. It was honestly took a while to learn that skill. Just like how we as developers took a while to learn how to debug software, it was a new skill for me to debug hardware. And one way I guess I do fix it, so for example, when I burned out a sensor, it was replacing each component of that chain to figure out which component was broken. So is it the wire? Is the sensor? Is the chip that it's running on? And trying it out until it works, basically.
DAN_SHAPPIR: And how do you debug the software itself?
JOE_KARLSSON: The software is easier. I didn't have much problem with the software. Because the data is basically flowing in as either an event stream or as callback data, just like we deal with Node. But hooking up and making sure I'm seeing healthy data. But it's a Node-based environment. So you're getting all of the Node-based debugging tools you would get with normal Node development. I would love to talk a little bit more too about database practices. I think it's a component that doesn't get touched on very much. If you guys are down to talk about that a little bit.
DAN_SHAPPIR: Go for it.
JOE_KARLSSON: So I think, yeah. So a lot, like a lot of IOT devices, great, don't need database, but a lot of data does, and I think that there's special considerations that you need to make with the database that you wouldn't normally consider when doing node or JavaScript development. So I think for a lot of JavaScript developers, we're used to writing very read-intensive applications. Like just like a server, right? Or like a, imagine you're building a Twitter-like clone, right? Like you do one write to the database and it gets read thousands of times by all the followers. That's a very common updates are very rare. Writes are very rare, very read heavy. IOT devices tend to be write-heavy, which is kind of unusual and it has some special considerations you should be thinking about too. Um, but so imagine me for a second, like I'm, let's say I start selling my IOT kitty litter box massively on Etsy. It sells millions and millions of things. I'm not going to, but imagine this, this new thing. And now I have thousands and thousands of IoT devices in the field concurrently writing to my database all these different events. And maybe you have a thing that's reading, I don't know, temperature data once a minute. You're going to have thousands of things writing all the time to your database and possibly concurrently. That can be an issue for a lot of databases. So you definitely want to look for databases that have, that are able to do many, many concurrent rights simultaneously. And I talked about this earlier too. I think IoT development is also different too because I think a more flexible schema is also more appropriate for, and this is generally speaking, right? All the use cases are totally different, but I gave the example to the IoT litter box and adding additional sensor data. And I save that data as a time series, which is basically like once a day, I create a brand new document and I have an array in there and I just, I'm pushing new events like cleaned maintenance, you know, bathroom events, whatever, like I can just keep adding those to that time series data once a day. And I'm doing that for data visualization. So basically I have a dashboard and I designed it based on how I'm using that data. I just want like every day, how many times is this thing happening? If I start adding additional sensor data, I can seamlessly start saving that into new data like the new time series data without having to skip a beat at all, which is really nice. So I think especially with time series data, we typically don't really care about long-term data like in the past, and sometimes you do. But if I start adding new stuff, that isn't going to be a problem. It's like a flexible schema. It tends to be an amazing use case for IoT type data long-term. And the last thing too is Event-driven. So we talked about how event-driven architectures works with JavaScript. Also, you want your database to also be driven by events that can be triggered in the field as well. And I'll just pull a plug in here too. MongoDB does all that stuff. But there are, of course, other databases you should totally check out. But it does all those really well.
DAN_SHAPPIR: Given all that talk about all the events and whatnot, I'm wondering if anybody out there thinks that the node isn't big enough and also using RxJS with this sort of thing.
JOE_KARLSSON: I think you told me, yeah, it depends much like how complicated your state is, but that it could, you could, I could see situations where that would be useful. I haven't personally done that, but like, cause usually I'm just like reading, like reading in data and just persisting at somewhere. I don't really need to do, I don't need to like manage too much other state based on events in my own application.
DAN_SHAPPIR: So you're saying that the IOT itself is mostly in it, in it off itself, it's mostly stateless. It's either getting data from external instruments and then reporting it back somewhere or maybe some sort of a simple reactive logic, something like that?
JOE_KARLSSON: It depends, it totally depends. I'm actually, I've totally forgot to mention this to the future, but like, I do think edge computing is gonna be increasing as the devices get more powerful. And I think like the Raspberry Pi, I do a little bit of calculation in edge computing on like out in the field on the device. Like let's say, like moisture data for my farm, right? Maybe I wanna do some calculations on that moisture data on the device that's embedded in the field, as opposed before you send that back to the centralized location.
AJ_O’NEAL: You just have C3PO go talk to the moisture evaporators.
JOE_KARLSSON: Oh my, yeah, that's a great, speaks millions of languages.
AJ_O’NEAL: You don't send the data to the empire. You just have C3PO go over to the binary moisture evaporators. He does the edge computing, empire doesn't even know.
JOE_KARLSSON: And that can be great too, like especially if you have a massive fleet of devices, you just, it's there, right?
DAN_SHAPPIR: Yeah, so it's kind of like running JavaScript in the browser, that's what you're saying.
JOE_KARLSSON: Yeah, that's a great analogy, absolutely. Yep, absolutely. So instead of having to go back and get the data from your server, cool, you can just compute it in the browser and boom, it's much faster experience for users.
STEVE_EDWARDS: Now, is this the same thing as what I know Cloudflare has called Cloudflare Workers, where you can actually do calculations out on the CDN, yes, compared to coming back to your central application as well?
JOE_KARLSSON: Yes, absolutely. Absolutely. And that can be helpful if you have like, if you have a global application, right. And you just want to have, I don't need to send all that data. You could just do some, do a biggest bottlenecks for applications are database, like querying speed and then B just like network, the speed of light, just getting things over the wire. And we haven't figured out how to send data faster than the speed of light yet. Apparently that's some sort of constraint or something. I don't know. But yeah, the less you can do that, the faster your application can be.
STEVE_EDWARDS: Well, that brings to light one of the great philosophical questions of all time is that if you're driving in a car going speed of light and you turn on the headlights, would they do anything?
JOE_KARLSSON: Yeah. Einstein would say no. When the time would stop. Yeah, if we could figure out how to pass the speed of light seat, then we'll be set to go, I think. That may also change things a lot for programmers. But yeah. That's really good story. Yeah, edge computing, I think is gonna keep getting bigger. I think we're gonna continue to see a rise to that too. Keeper, better, faster, more available, more distributed computing.
Are you stuck at home climbing the walls when you should be hanging out with the community at the latest conference to get canceled? Are you wondering where to hear your JavaScript heroes like Amy Knight and Douglas Crockford and Chris Heilman? After the cancellations, I decided to put on a JavaScript conference for you online. I invited my favorite folks from around the web and got them to come speak at an online event just for you. Go to jsremoteconf.com and check out our speakers and schedule. The conference is on May 14th and 15th. Come join us at an online conference that we guarantee will keep you safe and keep you informed. jsremoteconf.com.
CHARLES MAX_WOOD: All right, well, it sounds like we're kind of winding down. Anything else we want to tackle before we go to picks? I'll take that as a no. All right. Let's start with Steve. Steve, do you have some picks for us?
STEVE_EDWARDS: but I like to go for the funny. I'm going to pick probably my favorite cartoon or comic. This is one that I have, that's called Pearls Before Swine. It's written by a guy named Steven Pastis. It's really pretty unique in that as a cartoonist, he inserts himself in the comics quite a bit. For instance, probably the most common occurrence is he really will take an entire strip like a Sunday strip to build up a huge pun at the end, you know, a whole string of different things together to make up a phrase that's all built-up puns. And then the very last panel of the cartoon will be various characters at his desk threatening to beat him over the head for another really horrible pun. And so anyway, that's just a favorite of mine. It's called Pearls Before Swine.
CHARLES MAX_WOOD: Awesome. Amy, what are your picks?
AIMEE_KNIGHT: Oh my gosh, sorry. I ran to the kitchen to get food because I was getting dizzy and hungry. I do have two picks ready though. The first one is going to be because of the situation that we are in. I'm just a post in Good Housekeeping magazine on cutting your own hair. Because I am due for a haircut and I'm obviously not going to be able to go out for one. So I'm going to give it a good attempt at one of the easy examples that they have. The other one that I'm going to pick. As part of the new role that I'm in, I'm doing just a ton of leveling up in just the different cloud, I can't talk cloud platforms. Google is actually putting together a course for the company I'm working at. And as part of the course, we're doing the GCP courses in Coursera. And I've found them to be really, really, really good. They actually set you up with kind of like a fake username so that you can go into GCP and actually like, um, literally play with like App Engine and Kubernetes Engine and Compute Engine and all the different things that they have in GCP. So I find it a lot better to actually be doing that kind of stuff in a real-world environment rather than, you know, when I was learning like JavaScript or something from the very beginning and like Codecademy and some of the examples are kind of contrived and stuff, but this is really nice cause you can literally like, go into GCP and kind of like do whatever you want. So it's gonna be my pick if that's something that you're interested in learning more about. That'll be it for me.
STEVE_EDWARDS: Amy has a helpful suggestion regarding the haircuts. I have a really good razor. That would work if you're desperate and really wanting to get a haircut. And it would save you money because you wouldn't need a haircut for a long time.
AIMEE_KNIGHT: I'm not sure my boyfriend would like that very much.
CHARLES MAX_WOOD: That approach has worked for me too.
STEVE_EDWARDS: Smoother is better.
CHARLES MAX_WOOD: Just giving you a testimonial there. It works great. All right. Dan, what are your picks?
DAN_SHAPPIR: OK. So you mentioned, Chuck, at the beginning of this podcast, the online JavaScript conference or conferences that you're putting up, JavaScript Remote Conf, which I'm really happy to be speaking at. I thought I might give a shout-out to a few more physical conferences getting either canceled or becoming virtual. So there are a bunch of interesting virtual conferences going on. It actually creates really amusing situations because for example, I myself will actually be speaking on two conferences at the same day which is something that you could never do with a physical conference. So there's actually by the time this show comes out, it'll be in the past. But on the 16th and 17th of April, there's a future sync and I'll be like a featured guest or something there speaking a little bit about web performance. And also on the 16th, I'll actually be speaking at a virtual meetup that Wix, my employer is actually hosting also about web performance. So it's kind of amusing that I'll be doing both at the same time, but there are many others. There's, for example, VidCon, which is taking place at the beginning of May, May 7th. I'll be there. Oh, that's cool. Yeah. So there's a whole bunch of online conferences and seeing as we're all stuck at home, it seems like a great opportunity to kind of level up and improve your skill set and all these online conferences are just a great opportunity. So definitely want to give a shout-out to that. And that would be my pick.
CHARLES MAX_WOOD: Awesome. Yeah, there's a lot going on. It was funny because I started putting mine together and then a couple of weeks later I found out about a couple more. So yeah, definitely been interesting to see. I've had some people asking about some of the other communities out there like React or Angular. And so we may put something together for those. I'm And like I said, I've had a few people ask me to do it at a more Europe time zone-friendly time. That means I wind up staying up really, really late. But yeah, I mean, if people need it, I think it's worth it.
DAN_SHAPPIR: You're getting up really, really early.
CHARLES MAX_WOOD: Yeah, but it winds up running.
DAN_SHAPPIR: You don't go that way.
CHARLES MAX_WOOD: I've done it before. But yeah, I think it's exciting to see these kinds of opportunities come out and see where it all ends up. AJ, what are your picks?
AJ_O’NEAL: Oh boy, oh boy, do I have some picks for today. Okay. So, um, I'll start with the most on topic first, I think. So we're talking about electronics and blowing stuff up and making it not work anymore. And I would really, really, really highly recommend the book, how to diagnose and fix everything electronic. I feel like for some of you that were listening, uh, a little bit before this time last year, I started getting more into electronics. And that's one of the books I read. And I feel like it gives you a really good understanding from, you know, pretty much knowing nothing to being able to actually be able to fix things around the house. For example, if it worked for that book, I would not have been able to fix my DVD player when a capacitor blew inside and the USB on the front side of it was drawing too much power and causing it to boot up and then say, please unplug the USB device. And that was all that I could do with it. Turned out I removed a blown capacitor that was shorted a capacitor and And then it started working and I could use the USB drive again. And then I'd also recommend getting started in electronics, which is a very simple, more kind of kid-friendly book, but also good explainer. And if you're going to get into, to IOT, it's, it's really good to have a basic understanding of like a resistor, capacitor, and just voltage, some of the the basic components and concepts of electricity. So, you know, if something is broken or breaking or whatever. Also along that vein, I can't recommend this from personal experience, but this looks like a pretty good book and it's got good reviews and it has a component pack. There's Make Electronics, the book second edition, and then the Make Electronics component pack second edition so that you can go through learning basic electronics with experimentation and stuff. And that might be helpful to some people before jumping straight into IoT to just learn a little bit about how electricity and electronics works. Although I think you could definitely get one of the Arduino kits and the Arduino books and go straight into that and learn a lot and have a good time there. And let's see, nothing beyond that. Just to understand some of the differences between microcontrollers and higher-level systems like computers. There is a video on a guy who created a super Nintendo emulator with a Raspberry Pi and then had it plugged up to an original Nintendo cartridge so that he could play Super Nintendo games on a Nintendo. And it's a two-part series, one where he kind of goes through it and demonstrates it and the other one, I think, is where he goes more into the deeper details. But there are advantages to it. But there are advantages to microcontrollers, especially when it comes to timing, because they can be very, very quick at doing very, very simple tasks. And even when you have something like a Raspberry Pi from 2018 or whatever, being able to send a signal fast enough to the video bus of a Nintendo from the 1980s can be problematic because a CPU is very general and can do lots of different things and is often not real-time. And so I think that that video series of those two videos is one that's very cool to watch to kind of give you a sense of that. And then in general, I would just pick, you know, if you're looking for picking up electronic stuff, AliExpress is great. Adafruit is great. You're going to get the same stuff on both sites almost identically, except Adafruit, you're going to get much faster shipping and it's going to be a little more expensive. But AliExpress is also a great site. And then I think maybe that's all of my picks for now.
DAN_SHAPPIR: I'm still digesting the fact that you actually went and fixed a DVD player. I thought these were like, uh, disposables or something.
AJ_O’NEAL: Well, there's it's, I was actually a Blu ray player, but there's, I almost did, but the fix was super easy. I did it totally the wrong way. I'll actually link you to the video that I made of me fixing it.
DAN_SHAPPIR: That would be cool.
CHARLES MAX_WOOD: Awesome. Um, I'm going to throw out a couple of picks. The first pick is, so one of the things that I do to kind of relax and when I'm trying to go to sleep is listen to an audio book. And the problem is, is that I'll start to drift off and then I miss parts of the book. And so I like to listen to books that I've already read. So I've been listening to the Iron Druid Chronicles. And I'm sure I've picked them on the show before, but not for quite a while. And they're a fun series of books. It's this druid that found a way to live for hundreds of years or thousands of years. And...Anyway, it's been a fun, fun series. So I'm going to pick that. I think that's all I've got. We're also putting on meetups. Dan didn't mention those, but that's at devchat.tv slash meetups. I'm working on getting the one scheduled for May, but we have a couple more going in April. So anyway, you're welcome to come to those. Joe, what are your picks?
JOE_KARLSSON: I just got like two quick things here, but I've actually been working on a COVID data sets, so we have a read-only MongoDB database that we're gonna be releasing this week. So it should be out by the time this podcast comes out, but it has data we've imported in from the John Hopkins data set. And we want people to be able to use and connect it and kind of do whatever they want with the data. We're trying to make it just super easy to use whatever language you're using, but you should totally check that out. I want to talk about too, we on June 9th and 10th this year, we're doing MongoDB Live. It's a totally free two-day conference. So if you ever want to learn more about MongoDB, you should totally come and check it out. I'll be giving a bunch of talks there. And I'd love to, we'd love to have more people join in too. I agree. The virtual conference thing has been, it's totally, it's a huge game changer, but this will be the first time, first year we'll be doing that.
DAN_SHAPPIR: You mentioned that you'll be talking on JS VidCon. What are you gonna be talking about?
JOE_KARLSSON: Yeah, I think I'm going to be talking. It's a gentle introduction to serverless applications. I'm so excited to be there. It's going to be so fun this year. And there's a bunch of others I'll be speaking at too. You can follow me on Twitter at joecarlson and the number one. And for up to date, some of the stuff I'll be participating in here next couple of months.
STEVE_EDWARDS: And how do you spell your last name, Joe? It's not the typical Carlson.
JOE_KARLSSON: Yes, thank you, Steve. It's K-A-R-L-S-S-O-N and the number one. And lastly, too, I don't know if you get This is, I've been getting really into TikTok, which I think is not very popular with engineers right now, but I've been making lots of goofy software engineering videos on TikTok recently. So you should totally come check that out. This is my first and last name, Joe Carlson. Again, weird spelling. There's dozens of us on TikTok right now.
AIMEE_KNIGHT: Speaking of that, I have a pick I should have picked that I forgot about till just now. And I want to pick Joe's apartment because he posts on Instagram all his videos too. And like his apartment is like decorated just. Perfect. It's inspiring.
JOE_KARLSSON: Oh, thank you. It's a, I dabble. I dabble. It's a cute little place. It's nice to have a nice cozy place when you're working home or you're like trapped in home, which is a little nicer.
AIMEE_KNIGHT: I mean, I try to make my place look nice and your place is very inspiring.
JOE_KARLSSON: I get a lot of help from friends, but I appreciate it. Thank you very much. If you want to see my apartment, you should tell them I'll be posting about that too.
STEVE_EDWARDS: Yeah, I want to see pictures of the litter box.
JOE_KARLSSON: Oh, yes, absolutely. No, no, no. This clean ones, this clean ones. I do a blog post goes in greater detail. The letterbox you I'll post that in here too. And that's it. That's it for me.
CHARLES MAX_WOOD: All right, cool.
JOE_KARLSSON: Well, We'd love to talk more about whatever with you. This is so much fun. I love this podcast so much.
CHARLES MAX_WOOD: Good deal. All right, folks, we're going to go ahead and wrap this up until next time. Max out.
AIMEE_KNIGHT: Bye. Stay healthy.
Bandwidth for this segment is provided by Cashfly, the world's fastest CDN. Deliver your content fast with Cashfly. Visit C A C H E F L Y.com to learn more.