June 16th, 2023 × #javascript#iot#hardware
Supper Club × JavaScript on Hardware, Micro Controllers, ESP32 with Nick Hehr
Nick Hehr discusses running JavaScript on microcontrollers with ESP32 and Raspberry Pi Pico using the Excess engine, challenges around tooling and standards, and how he builds projects with it.
- Intro to Syntax Supper Club podcast
- Guest Nick Hehr talks JavaScript on microcontrollers
- Guest is a web developer who got into microcontrollers as a hobby
- Overview of running JavaScript on devices vs Linux computers
- Guest's first microcontroller project was running a Node server on a device
- Guest started maintaining open source microcontroller projects
- Challenges of running latest Node.js on constrained devices
- Overview of Raspberry Pi Pico microcontroller
- Where to buy microcontroller boards
- Different versions of ESP32 boards
- Excess JavaScript engine targets 99% of JS spec
- Excess adds web-like APIs like web workers
- Excess provides custom APIs instead of browser APIs
- Standard for JS on embedded - ECMA-419
- Networking APIs being added to standard
- Tool to simplify getting started with Excess
- Overview of Arduino boards and platform
- Library to simplify hardware APIs
- Fetch API implemented for microcontrollers
- CLI tool to setup Excess environment
- Challenges around getting started as a beginner
Intro to Syntax Supper Club podcast
Guest 1
Welcome to Syntax, the podcast with the tastiest web development treats Out there, we've got a show for you today, another show on electronics. This one's a little bit more, in-depth. I'm pretty excited about it.
Guest 1
We've got Nick Hair on who is going to talk to us about writing JavaScript on microcontrollers.
Guest Nick Hehr talks JavaScript on microcontrollers
Guest 1
And What I'm hoping this turns into is a total geek out of all the kinda cool stuff that that you can get into.
Guest 2
Welcome, Nick. Thanks so much for coming on. Thanks for the invite. I really appreciate it. You know, took a shot in the dark, reached out on Twitter, and I'm glad it worked out.
Guest 1
Yeah. It it's awesome because, like, I've been dipping my toes Into more of the microcontroller side of things the last 4 or 5 months.
Guest 1
Initially, this whole thing behind me, I initially thought I'm gonna deck that out in LEDs.
Guest 1
And that project didn't end up working just because of how bright they were and whatnot.
Guest 1
I I went with the floodlight route, but that got me into these little ESP 30 twos, Which are incredibly cheap and super powerful. And then I realized, like, I posted on Twitter and people are telling me about all the projects. So, like, I've always been, like, pretty electronics Involved, but I've never, like, gone super heavy into the, like, microcontroller route. And this has just been so much fun for me over the last couple of months. I'm I'm excited to talk Somebody actually knows what they're doing.
Guest 1
Somewhat. Yeah. Yeah. I've I've had quite a history in it, but, still have not been a professionally. So this has all been, You know, a hobby and and a deep interest for sure. I I that's kind of the perfect spot for this podcast because, like, we're all developers. We're all tinkerers. I assume, like, we'll start there. Are you a web developer? Give us your your back backstory of who you are and what you do. Yeah. So,
Guest is a web developer who got into microcontrollers as a hobby
Guest 2
like I said, my name is Nick Hair. I'm a staff engineer at a company called Betterment, in New York, and, I am a staff engineer on the front end platform team. So I worked in front end my, almost entire career, you know, dabbled in, you know, quote, unquote, full stack in order to make my job, useful and be able to, like, connect up data to the front end and do a bunch of that type of stuff.
Guest 2
I originally started out in sort of design, as a self taught, kind of web designer and then eventually getting into web development to kind of be able to build out the stuff I was designing for myself, and then has, you know, cascaded from there into general interests and deep dives into various, topics and and subject areas. You know, I've dabbled in Systems programming through Rust because it was so friendly that way, and I've traveled, obviously, in a lot of IoT and and devices and stuff through mostly through communities. Communities is what really is what got me into a lot of these sort of topics that I've really kind of hung on to.
Guest 2
So, you know, one thing that's always kind of been Part of my career has been JavaScript Yeah. In a lot of ways because I've been able to do so much with it.
Guest 2
Actually, when I was interviewing for with Betterment, they asked me, like, if you could choose, like, 1 language, 1 tool, or something to pick, what would you pick? I said, you know, JavaScript because I can take it most places, I can do a lot with it, and it's kind of, you know, helped me out a lot, throughout my career.
Guest 1
It's unreal. Like, we were talking about a couple shows ago how you can now, Like bundle a node application into a single executable, and now there's all these different, like, server side run times that have their own JavaScript implementation. Obviously, there's browsers. And and one kind of cool thing which we dipped into lightly here and there is that You can now run JavaScript on microcontrollers. Is that true? Mhmm. Yeah. Yeah. So that's
Guest 2
It's actually kind of wild how long it's been possible. It just has not been as, maybe, accessible or easy to implement, and get started with for a long time. So, one of these implementations so, actually, my my original sort of Start of using JavaScript to control devices with with the Pebble smartwatch, if you all remember that. So I backed up the original Kickstarter for that, and backed almost every single Kickstarter they had and started to tinker with the, You know, cloud IEE that they had and started building up my own applications for, the Pebble, Starting with a little bit of c combined with some JavaScript that would run on the, like, phone app. That's how they started implementing. And then they started doing the actual like, They called it rockyjs, as an as an API built on top of the engine called JerryScript from Samsung, which was allowing them to run actual like a subdued, JavaScript engine on the Pebble itself.
Overview of running JavaScript on devices vs Linux computers
Guest 2
And so that was sort of the early one of the earlier, like, I don't know. Clues that you can actually do this on device, which I think Espirito also uses Jerry's script under the hood, if I remember correctly.
Guest 2
And then the one I use most today is called Excess, and it's from a company called Model.
Guest 2
It's maintained by a company called Model today.
Guest 2
It's been around for many years, since, let's see, XS 3, was before 2010.
Guest 2
So, like, it just was not open source for a long time. It was just part of this company, this group that we're building it for, you know, device makers and for manufacturers and then were able to eventually, join a company called Marvell, and create the Konoma, and that became, like, the 1st open source implementation of XS and then the sort of devices they had on top of it. And now Excess runs on ESP 32, ESP 8266, the Pico, Pico w, and more devices.
Guest 3
When you first started wanting to pick this stuff up, what was your initial, like, goal for something you wanted to create, or what was the 1st project that you ended up diving into? So
Guest's first microcontroller project was running a Node server on a device
Guest 2
for running on devices specifically like, the the Pebble stuff was really fun. It was something where I can interact with. Got me into web scraping to be able to get sort of, like, APIs to drive stuff that would show show up on my wrist, which is really fun. I actually used their, when they first came out with their voice to text API through Dragon, they I created, like, a little, assistant on my wrist that would, you know, create reminders for me, and then have that show up in the app or the little, like, kind of widgets that they had available to that.
Guest 2
That was a lot of fun.
Guest 2
And but the 1st sort of on device idea I had, was with a group called Tessell and the Tessell two, dev board, that was one of the first times I was able one of my big ideas at one point was, like, I wanted to be able to see if you could run, you know, A little Node. Js server so close, like, on a device and be able to interact with it and have it work sort of, like, quote, unquote offline, and then be able to sync back up. And this is when I was working a lot with offline first sort of practices with a group called Hoodie.
Guest 2
It's my first foray to Open source as well, and I wanted to see if I could run, like, the Hoodie app server on, on a device. And this is before I knew anything about what the idea of, like, Edge computing was or anything like that.
Guest 2
And I was like, how like, what's out there that could do it? And when I was searching for it, I found out about the Tesla and the Tesla 2, they actually ran Node. Js on a basically, OpenWRT, the, like, Linux OS, very specifically for routers. Like, the router OS? Yeah. So they were running that on a device.
Guest 2
I actually have a couple here. One second. Yeah. I would love to see that. So this is the Tesla 2.
Guest 2
And so I have many of these now because I eventually became a maintainer of the project, Along with the original group. And the Tesla 2 ran a, MIPS, architecture chip with OpenWRT on it, And it also had a SAM d 21 record controller that it communicated with over onboard sockets.
Guest 2
And through that, they were able to get, you know, running full Node. Js, you know, they had some patches. We have to make it run on the on that architecture.
Guest 2
But you're running Node. Js on the board, and it was communicating in, you know, real time sockets to the actual microcontroller doing the efficient sort of hardware updates. And so, you know, for the most part, all you had to do is interact with the Node. Js API.
Guest started maintaining open source microcontroller projects
Guest 2
It even ran Johnny 5 natively on there, versus sort of the way that Johnny 5 was typically done where you had, like, a host computer and over, like, USB or some other sort of, like, serial format, you would communicate with, like, an Arduino, And you would use basically the Formata Formata protocol to go back and forth.
Guest 1
Oh, okay.
Guest 2
So but running natively on here meant you could just, you know, Deploy libraries and do a bunch of stuff to deploy it onto a device.
Guest 2
Use NPM and all that type of stuff, and then run it.
Guest 2
And then now you could just run a node server, and then you can interact with it with, like any other sort of website you wanted to, and then, you know, control devices.
Guest 2
And so that my original idea was, like, I wanna be able to see What I could do to make that, like, offline first, IoT is kind of this idea I've been trying to play around with for a while. And then when I found tesl 2, through the through, like, jQuery Summit years ago, in New York and met the group there and started to tinker with that. Met Rick Waldron in there as well who is a maintainer of that project for a while, and that's when I first started getting into, like, okay. I wanna run, you know, a little web server that controls some lights, Like, you're talking about Wes. Like Yeah.
Guest 2
Like, how hard could that be? And it's like turns out it's like it's accessible, but you really have to figure out some of these little pain points for going coming from a web developer and then trying to condense it down onto a device.
Guest 2
And so from there, that's really what I've been trying to refine for years years years. Like, how quickly could I, You know, through a workshop.
Guest 2
Get people up and running with some sort of runtime, push code over to a device, and have it just control a light. Like, the the hello world of hardware happens to be usually, like it's usually called, like, hello, blinky Yeah. Where it's like, let's just blink a light. Let's just make it, like, pulse, make it do something, make it control. Yeah. And then from there, you can expand, expand, expand.
Guest 1
And it's it's amazing how far it's come. Wow. So that's that's kind of like the 2 camps, I guess that these a lot of these microcontrollers run into. On one hand, you essentially have a very small Linux computer. That's what Tesla Raspberry Pi are. Right? Yep. And then on the other hand, you have things that cannot run Node. Js because of
Guest 2
What? You could tell me. Memory limitations, things like that? Yeah. Architecture, memory limitations, like one of the things that was our downfall for Tesla, actually, Actually, it was the fact that we're using, like, a nonstandard architecture for most Node. Js, like, targets.
Guest 2
So a lot of the native, compilation that would happen. Usually, like, even ARM at that point was not super popular. It was like, alright. Let's just make it work on x86, and and that'd be fine. And then ARM started getting popular mostly because of Raspberry Pi, and people were gonna run on there. But MIPS and MPSL sort of targets, those were we could never get past node 10. And if you remember, like, node 10 to node 12 migration was pretty massive on the native API standard, which something we couldn't overcome as an open source project.
Guest 2
So it became hard for us to continue, like, shipping, like, the latest, APIs and latest sort of run times over there because it also grew and grew and grew.
Challenges of running latest Node.js on constrained devices
Guest 2
Like, v eight and the whole Node. Js runtime is pretty big when trying to shove it onto, like, a constrained device.
Guest 1
So memory and storage limits, those sort of things come into play. So are are most people that are doing this type of thing now, they are Going for something like the the ESP 32,
Guest 2
it's one of the most popular devices. You'll find it in so many, like, IoT Things you buy from, like, Amazon or anywhere, like, they happen to use the ESP 32, and Espressif has done a great job in kind of making that, like, the bog standard sort of target.
Guest 2
And, you know, ESP 8266 is still a great board. You just get a lot more headroom and API access on the ESP32.
Guest 2
But the Pico and Pico W are becoming pretty popular as well, because people like, you know, the the Raspberry Pi ecosystem, and it's also becoming pretty tiny and pretty Easy to embed in things. It's not necessarily as popular yet, I think, because, you know, the Raspberry Pi foundation foundation needs to find way to, like, ramp up manufacturing and make that, you know, super accessible for manufacturers to embed.
Guest 2
That's where Espressif has done, you know, an awesome job.
Guest 1
So the Pico is I'm just looking at it right now, is is from Raspberry Pi, but it's it's not a Linux machine. Right? It's just Pure microcontroller, their own silicon that they've developed and stuff.
Overview of Raspberry Pi Pico microcontroller
Guest 1
Okay. Oh, man. I'm just looking at them right now. They're couple bucks, 4, 5, $6 To be able to to grab 1 of them, that's depends on where you're getting it. So, like, the 1st time I got one, I just Amazoned it $15. Right. And then I was like, alright. Well, I I fried 1 somehow, which I'm I don't know. Have you ever fried 1 before?
Guest 2
Yeah. Definitely. When you especially when you're working with lights because lights draw a lot of power depending on what you're doing. That's where people when working with stuff like NeoPixels or something like the, addressable LEDs these Yeah. Get into a lot of trouble because they try to run the main power off the board, and it just fries it because it pulls way too much current, Oh, yeah. To to power all those LEDs, and then yeah. That's luckily, they're they're fairly cheap.
Guest 1
Yeah. Yeah. I I was saying that I bought, I think 5 or 6 of them, and it worked out to be 450 from AliExpress.
Guest 1
Where do you usually normally Buy this type of stuff. I know that people have said, like, yeah, AliExpress is awesome. But then I also follow other creators who are like, The AliExpress, like, versions of everything is cheap, but Mhmm. They don't give you they're not as good as as, like, you're gonna get something from SparkFun. Yeah. That's hit or miss. So, yeah, I've I'm I'm favorable to, like, Adafruit and SparkFun.
Guest 2
SparkFun, pass partially because They were the partner with Tesla and Johnny 5 for, like, the Johnny 5 adventures kit back in the day. Mhmm. And so working with them, I'm always pretty favorable, to them, and they have pretty good deals most of the time. But, also, Micro Center is nearby where I live. So I'm in I'm in New York, so I can go to Micro Center, Occasionally, I pick up some hobby stuff there.
Where to buy microcontroller boards
Guest 2
Sometimes that's the only way you can get, like, a Raspberry Pi if you show up in person, when those were in stock for a while. Yeah.
Guest 2
But, yeah, that's that's usually what we go to.
Guest 2
Sometimes I go on Amazon, but, yeah, like you said, it's a hit or miss. Usually, you can get a lot more different Form factors from places like Adafruit and Sparkfun.
Guest 2
Like, they make the I think one of the most recent ones that are really awesome are, like, q t Dash p y, cutiepie, boards, on Adafruit.
Guest 2
They're mostly targeting like, Adafruit's been going really hard on micropython, which is like the sort of embedded Python, dev environment and and engine, or, like, compilation target.
Guest 2
And, so they've been doing a lot of blogs and tutorials, and I I really wanna try to match that a little bit with, like, XS and some of the tutorials there, because you can do a lot of the same stuff,
Guest 1
just with JavaScript instead of Python. Wow. I'm just looking at this QTP whiteboard. It's like the size of, like, a thumb.
Guest 1
Mhmm. Unbelievable.
Guest 2
And, like, how come it's so much smaller? I guess there's there's less pin outs. There's not as many, like, yeah, Pinouts and and sort of maybe not as much memory because you can kind of, depending on, like, what type of ESP 32 you can get, which has these, like, Dash Monikers against them sometimes.
Guest 2
They're not all the same, which is why you gotta be a little careful sometimes, in terms of, like, how much flash they have, how much RAM they have.
Different versions of ESP32 boards
Guest 2
It can either make it, like, a super tiny, super embeddable, or even more powerful.
Guest 2
Some of the newer ESP 32 Sort of boards are starting to target, like, matter and that like IoT Mhmm. And having a a built in, like, thread and matter radios on them as well.
Guest 2
So that's where you can depend on how much power and how much processing you need to to operate that. What what kind of things are people building with these Thanks. Because I see all these little boards. They they'll they look cool and fun, but I, like, have no idea what people are actually making with them. I mean, It's the possibilities are almost endless. So, I mean, even looking at, like, the Adafruit blog, you can see people building things like oh, so one of my favorite projects in the sort of excess ecosystem is this little robot called Stack Chan.
Guest 2
This guy in Japan who is using, moddable and access in that ecosystem.
Guest 2
And it's Pretty incredible what he's been able to do with he's using a
Guest 3
dev kit called M5 Stack. Oh, a little super kawaii robot.
Guest 2
Yeah. It's super cute, and he has some really awesome stuff with it.
Guest 2
Just lately, he was sharing. He had connected it to, Chat GPT, API and some text to speech stuff to make it speak back to you if you ask questions. Oh.
Guest 2
And, it's and it's all written in JavaScript, and he's got a couple like, thing that model does really interesting with XS is that they have bindings to, like, the c APIs needed to interact with, like, the the native operating system or or the APIs for, like, The different dev boards they're targeting.
Excess JavaScript engine targets 99% of JS spec
Guest 2
Mhmm. So it's mostly JavaScript until you have to, like, maybe drop down into c. But for the most part, like, I've never had to do that on my personal projects.
Guest 1
Mostly, it's up to the implementers for the different, like, Targeting dev boards that they will go and do that. Oh, yeah. That was my next question is, like, what what does the JavaScript look like? Because I'm assuming it's Similar to the limitations you have when you are deploying to, like, an Edge platform where you have JavaScript, the spec, Which is you gotta sink away. You got functions. You can do all that stuff. But, like like, what there's no there's obviously no DOM, and there's maybe I don't know if there's a file system. What do the APIs look like?
Guest 2
So that's where, XS is very unique in the fact that they target, like, 99% of the modern spec. They just shipped 2023, Ecma 2023, matching Okay. And even some new experimental features that are pretty nice for embedded, like, I think The process or the memory management or, manual I think it's manual manual memory management, like, new API That's being proposed right now. It's in, like, stage 3 or something that they've started to experimentally push to excess.
Guest 2
And so that allows for a bit more control over, you know, these memory extreme environments.
Guest 2
So they're targeting 99% of it. They Call out like, the things that they don't allow on device are things like calling function to string won't necessarily work If you because they don't store functions as, like, their native implementation necessarily, so you can't get, like, the that on on device, at least.
Guest 2
And a few other things that I haven't hit into limitations. So you can use a single weight. You can use, atomics.
Guest 2
You can use, like even they've added a few sort of, like, web ish things on there for you to use.
Excess adds web-like APIs like web workers
Guest 2
So, like, web workers or workers, actually, a lot of you do multicore processing on devices that have multiple cores. So, like, not only are you using, like, async, you know, communication with a worker, but also on a different thread or a different core entirely. Threaded.
Guest 2
And the the implications are interesting in terms of, like, what they can do to optimize for the devices, where, like, actual, like, const variable Will only be read only and be stored as read only memory.
Guest 2
So the and even freezing an object allows you optimize even further in that engine on the device because, again, it's gonna be read only, and they know that at compile time.
Guest 2
And then they only shove it into read only memory. It can never be, or Flash, I think. I think they stored in Flash, so that we can't ever modify it, really.
Guest 1
Yeah.
Guest 1
I mean, I imagine, like, Weak maps and weak sets would also be helpful in there because they are cleaned up
Guest 2
automatically. Right? If there's no reference to them, they'll Will it be garbage collected? Yeah. So it it has, like, these new sort of something you don't ever have to think about too often when building out a typical sort of, like, JavaScript application or websites, but when you start to push into these, like, edge environments or and you can kind of consider this in an edge environment except it actually supports Full JavaScript. But like you said, it's not supporting all of, you know, say, web APIs.
Excess provides custom APIs instead of browser APIs
Guest 2
Yeah. So they do have some custom, Implementation for interacting for, like, the console. Right? It's not necessarily like console log is a web sort of thing that we've also adapted into, like Node. Js and and other environments.
Guest 2
Instead, they have, like, a thing called trace because it's all about, like, the stat trace for them in terms of the debugger. And so they have, like, a, like, graphical debugger app that they ship along with their environment that called XS Bug.
Guest 2
And so when you start up and run it on your device, it actually has a, you know, socket connection through USB or whatever in order to do the stack tracing from the device and then show up, like, your your logs and and memory management, everything all in that that graphical interface.
Guest 1
And so that's super helpful. What about, like like, fetch and MQTT
Guest 2
and all is there a is there a network? Like, I know that they have Wi Fi, a lot of them. So can you just Make a fetch request? So that's really interesting, you bring that up. So one thing that the Excess crew are involved in, something that I'm involved in as well, is a standard for JavaScript on embedded devices called ECMA 419.
Guest 2
And the technical committee is t c 53.
Standard for JS on embedded - ECMA-419
Guest 2
And so this has been around since 2017, I believe. Let me see. When did we start? And I got involved as an invited expert for, Tesla to kind of get that, involved, and start to provide, like, my experience working with, like, you know, web on devices and things like that. And a lot of What I've done since then has been trying to get networking APIs standardized for these sort of target environments of and for JavaScript.
Guest 2
And so, this 1st draft or the first, edition came out 2 years ago, They're about to publish the 2nd edition, which includes a lot more of the networking, like starting up a web server, Doing MQTT, and we haven't yet got necessarily into, like, the file system type of stuff, but Model Mole has created an SDK on top of excess to provide those sort of utilities.
Guest 2
So they have, like, a tiny FS or implementation for working with, like, a tiny file system, on Flash and and and, in those environments because, again, it's not an operating system necessarily, so it's sort of a tiny implementation of those things. But, yeah, you have networking. You have Bluetooth, MQTT sort of you can run a server MQTT server on there or as a client.
Guest 2
And one thing that, I've been sort of kind of proud to push forward is server sent events, as a concept in these environments, not only as, like, the be able to send service and events from the devices to, like, a web client that you're serving, But, also, you can have a server sent, like, a event source client on the device too. So you can receive server sent events from some sort of remote access.
Networking APIs being added to standard
Guest 2
So things like, again, ChatTBT can do server sent events to basically stream, you know, responses or whatever back, But you're just submitting one time to them and then getting that stream of data back.
Guest 1
That's wild because so a couple years ago, I did controlling a drone with JavaScript.
Guest 1
And essentially what happens is you press the buttons in the browser, you send that data to a Node. Js process, and then the Node. Js process will send it over some Socket. You know, UDP socket. And there always had to be that men in the middle to be able to relay it. But you're but you're saying with server sent events, you could It's a browser API. You could send it from the browser to the hardware.
Guest 1
Yeah. That's wild. Nice.
Guest 1
It blew my mind that you could also update these things Via web serial,
Guest 2
by just plugging it in via USB. That's wild. Yeah. I wish that became more of a standard to make it easier for people to just get started on, like, sort of a web experience because that is where a lot of people get hung up on like, they're saying the smaller devices, sometimes the harder that they get the tooling, set up in the way that you're you're used to for a lot of these environments. Like, it's not necessarily, like, MPX create whatever or MPX init. Like, it's not always that simple, but, that's something I've also been trying to work on and make that easier.
Tool to simplify getting started with Excess
Guest 1
Where where does Arduino
Guest 2
sit in all of this? Arduino so it's interesting when we talk about Arduino because there are Arduino, like, branded boards, and then there's the Arduino sort of runtime targets.
Guest 2
So, like, the ESP 32 can like, you can write Arduino code and push to those devices, it's not necessarily an Arduino branded device, like an Arduino Uno or any of those types of things. So Arduino is that, like, I don't wanna call it DSL necessarily because it is a programming language on top of, you know, like, c plus plus, because you can take c plus plus packages and work with Arduino with them, then Arduino creates, like, a little bit of a nicer, syntax on top of that to make it easier to interact with devices.
Overview of Arduino boards and platform
Guest 2
So, Like, that is you can push code directly onto devices, with Arduino, and you can use their ID and a bunch of their tooling to to do that. And I think that's great. It it made it super accessible for a lot of people early on who wanted to get into like, not necessarily have to know c plus plus or any sort of, like, lower level languages, or, like, system languages and said they could just say, like, alright. I have an LED. I have these great, like, APIs and packages, and then start to work with my hardware.
Guest 2
And that's kind of like what Johnny Five tried to do with JavaScript as well. They tried to create, like, an equal sort of, like, API to target all these different dev boards in all these different environments.
Guest 2
And, Donovan Buck, who is a a maintainer of Johnny Five, has also been creating a similar sort of library for excess.
Library to simplify hardware APIs
Guest 2
So it's called j five e, so, like, Johnny 5 embedded.
Guest 2
And so he has been working on making it so you can kind of have that familiar sort of I call it jQuery like because that's a lot of the folks who came from jQuery worked on Johnny 5 and and created that sort of smooth, ergonomic API and trying to make that also targeting. Like, you can just do, like, led.pulseorled.toggleorwhatever.
Guest 2
It's those nice simple things where, like, the APIs we're creating for ACMA 409 are very much, based off of, like, the extensible web manifesto manifesto, a little bit like web components kind of targets. Like, web components are are right, but they're not the smoothest thing to get up and running and Start working with, when compared to other sort of component systems, but you can build on top of the memory make really nice APIs on top of them. So that's what, Donovan's been doing with J5e and using Echo 4 99 as the base and then creating some nicer APIs to layer. Oh, yeah. And so when you're mentioning, fetch, Wes, Fetch is now completely full stacked to the metal, as I like to think to it. Like, someone created a Fetch implementation on top of ECMA 4/1/9 APIs.
Guest 2
And so now you can just use, like, some of the examples. You have a global fetch. So you can just say, like, fetch Whatever. And then that can work on an s p 32. It can work on an s p 8266. It could work on, you know, Raspberry Pi, like, all these different environments now, The browser, edge run times, all that type of stuff. And so now we've been keeping an eye on those things from, like, the winter CG and and seeing, like, alright. Where does that Apply to what we're building in ECMA 4/19 and those standards, and where can that be implemented on top of these sort of, like, base layers that we have.
Fetch API implemented for microcontrollers
Guest 1
That's cool. I'm just looking at the library for J5e right now. And, like, if if anyone listened to the 1st episode we did, we were just talking about, like, What Gpio is and how amps work and whatnot. And one of the things we did talk about was Gpio, which is all the different input outputs On these things, and one of the example they have is, const led equals await new led fourteen. I'm assuming 14 is the gpio pin Mhmm. And then led dot blink, you know, like, just like a nice, super nice, API for being able to work with common things, LEDs, servos, motors. I'm I'm assuming sensors.
Guest 2
Yeah. And you you get top level weight. It's showing right there. Like you can just start to use a weight at the top level. There's no sort of, like, caveats in that way. Oh, that's great. And that's one of the the so Excess Dev is this, CLI that I've been working on to make it easy to get up and running with these this tooling, and Well, one of our templates is j five e. So it'll just, like, bootstrap a new project with j five e, and then allow you to start working at that API.
Guest 1
Oh, cool. So That that's your project that you are just basic it's kinda like NPX get up and running?
Guest 2
Yeah. So it'll Get your dev environment running as well as allow you to start bootstrapping some new projects.
CLI tool to setup Excess environment
Guest 2
So originally started as a way to just automate the setup because setup itself can be kind of a slog, like pulling down a bunch of Git repos, compiling things, getting all the different tooling from the various, like, sort of manufacturer areas. So, like, Espressif has its own tooling even for ESP h two six six versus DSP 32. You know, Raspberry Pi has their own thing for the Pico.
Guest 2
And so and even just getting the model SDK up and running can be, some work. So with excess dev, the way I wanted to, like, Have it done. It's just exs dev setup, and it just gets the SDK set up for you. And then if you wanna set up for a particular device, it's exs dev setup dash dash device, like, And then you name what device you want. So ESP 8266, ESP 32, all that. You can get a list of devices that you can target as well. And then from there, You can then just run any of their examples that they have available too just to get, you know, something running on the device to see if, hey. It's all working, including just, like, hello, world. So, like, when you first set up a device, and, like, the the tooling, it'll prompt you to say, like, hey. Do you wanna run the hello world just to make sure everything's running correctly? And so Making it as smooth and simple as possible for folks who are used to that sort of like, oh, I just run a command and things are ready to go, and I can start, You know, developing, and I'll have to, like, you know, spend an hour downloading those things, reading through these, and seeing all the caveats that are related. And so this will work on Windows and Linux and and Mac.
Guest 3
Windows is still kind of a beta thing. We're still testing on a lot of the stuff there because it's not as easy as to automate stuff On that end. Yeah. I think the big thing for me is considering I I do less of this stuff than Wes does, and and it is very fascinating to me. But I I look at a lot of these sites, and I I get really overwhelmed really quickly with what to learn and where to where to go and and how to pick up even, like, intro level projects.
Guest 3
And and then my son wants to start doing some of this stuff. He he's really young, so I would love to pick up some of these, like, just little small projects to to start working on. But, Like, where do you even go to find a increasingly, you know, basic to more advanced level projects?
Challenges around getting started as a beginner
Guest 2
That's what's really missing right now, I think, given like, Johnny Five, again, still has a bunch of great Tutorials and and ecosystem around that, so I think Johnny Five is probably the most friendly way to get started if you don't actually want need to run it on device right away. Like, if you're just trying to, like, make stuff blank, do a couple, like, dev projects, Johnny Five is great. I think they have a lot of great resources there, and you can run them on a lot of different devices.
Guest 2
And then, you know, you just have to have it connected via, like, Some sort of, serial connection, which can be Wi Fi, Bluetooth, or a wire, like a USB wire.
Guest 2
That was actually something that we did, at JSConf US 2019, 2018. We did a workshop where, Over Bluetooth, you would use Johnny Five to control. We made boats. It was called Node Boats.
Guest 2
And so we had remote control remote controlled boats, that you are communicating with over Bluetooth from, like, a laptop over to, your actual device and everything. And people actually had hooked up their switch controllers and stuff. That was really fun. That's still a great way to start doing that type of stuff. I built remote control robots that way, like or cars and stuff.
Guest 2
Getting, like, excess sort of tutorials going there, is the next leap, I guess. And that's what I've been trying to also work on as the educational side in terms of, like, one thing that we do at Tesla was had this whole, like, guide like, t like, our our starting guide had, like, going from getting stuff set up to blinking a light, working with Wi Fi, working with sensors.
Guest 2
And that's where I'm still trying to apply some of those lessons I've learned to, you know, just the educational side. And like I said before, trying to apply, like, what are the people doing with MicroPython or these other sort of, like, you know, even TinyGo, some of those, other areas that have a lot of people behind it? And how do I build up the community? So it takes folks getting interested in trying to figure out, like, what don't I know yet and how we can start to build up more of that knowledge.
Guest 2
And since we're working on a standard, that's something I wanted to try to explore in terms of, like, getting it into, like, Maybe the the new, like, moddable web docs because they they don't just target, like, web APIs anymore. They also show some stuff around, like, you know, here's how to work with a node server, and here's how to work with a server in, like, full stack frameworks. Could we do that also for devices? Mhmm. The hardest part right there is experimentation and getting people, like, to use it right away. And that's the hardest part with any hardware projects is waiting for the stuff to arrive And start using it because you have that you have that idea, and you're like, alright. I'm gonna go order this hardware and then wait for however long depending on where you're ordering it from to for Deriv, and Maybe I still have that interest when it comes back.
Guest 2
And so one thing that's interesting for, XSS, it actually has a WASM target, so WebAssembly, and it allows you to then run the sort of simulator in the browser.
Guest 2
So I've been trying to see how can we host that in some way so we could then, like, Write a little bit of basic code and then see it appear in their browser for that and then be able to hopefully then upload it to their device once it arrives. Actually, they experiment a little bit. Oh, that's a great idea. So, like, hopefully, getting that sort of, like, just learning curve to to smooth out a little bit more. And then once it gets onto a device, it can go, you know, all different ways depending on what their, like, network is like, what their, like, Operating system they're using or even what device they bought, which makes it super hard to debug as a, open source maintainer. But I think, It can be super fruitful when you see people have these great ideas, and you're like, I would never thought to apply that, but, you know, I'm glad you have the access to do so. Bugging, I guess, is is probably a very thing when that's
Guest 1
literally could be anything. Could be Yeah. Yeah. Some, like, weird hardware thing that pops up. That's one one thing I was gonna ask you, and you just answered it, was is there some sort of emulator for this type of stuff? Because I'm trying to work on a, WLED, which is Another thing you can just flash to one of these microcontrollers.
Guest 1
And, like, I don't wanna I don't wanna say you're not supposed to use the LEDs when they're coiled up. Yeah. Like, here I am just, like, laying them across my office, and, like, it's it's already like, I should show you my my desk right now. It's just covered in, Like, electronic stuff, and it's it's it's very messy. Yeah. It's frustrating that you and I was like, I would love to just debug this thing If I had, like, a visual
Guest 2
strip of LEDs in the browser and that could code towards that, that's kinda cool that you're already thinking of that There's something being worked on. Yeah. And the the hardest part is though is the actual peripheral side of things. Like because you can emulate a bunch, but doesn't mean it's always going to work necessarily