Embedded - 118: Awesome and Frequently Useless

Episode Date: September 16, 2015

Morgan Allen (@captain_morgan) spoke with us about Sphero and Node.JS. This is all not-so-secretly a discussion of the BB8 robot. Correction: Despite Elecia's repeated insistence that these are steppe...rs, she's just wrong. The motors are DC which only makes sense in a consumer product. More details on this in a later episode. BB8s from Amazon (probably won't arrive until next year) More info on Elecia's teardown and talk: embedded.fm/hddg  The BB8 toy is based on Sphero (buy). They have an open SDK and a wonderful education program. Check out the clear SPRK (buy). It also has a teach-your-kids-to-program app that is pretty neat (but doesn't seem to work with BB8 yet). Morgan has been involved with NodeBots (@nodebotsSF). They use Node.js (wiki) to send Bluetooth serial commands to Spheros. Their issues list is where new meetups are posted. Johnny-Five is also a popular way to do computer based robotics with an Arduino (or other dev board) as a hardware intermediary. IPFS: Distributed file system ESPruino is a Javascript board. People's Open: Free Wireless Internet and Local Network in Oakland, California. Also in Oakland, check out Sudo Room hackerspace.

Transcript
Discussion (0)
Starting point is 00:00:00 Welcome to Embedded FM, the show for people who love building gadgets. I'm Alessia White, here with Christopher White. Our guest this week is Morgan Allen, and we're going to talk about rolly robots and Node.js. So I may actually have squeed on last week's show about getting a Star Wars BB-8 robot and then taking him apart. I may still squee about that. I looked inside and parsed some inter-processor packets and generally had a lot of fun. I gave a talk to Hackaday slash SupplyFrame's hardware developers, Didactic Galactic. Towards the end, I said I planned to write a Python script to parse that inter-processor
Starting point is 00:00:45 communication, and then to look at the BLE chip in the main processor and figure out if I can update my little robot from my computer or my own BLE app instead of the official Star Wars app. And that leads to our guest, who stood up and said something that was pretty interesting, something along the lines that someone had already done that. Hi, Morgan. Thanks for joining us. Hi, thanks for having me.
Starting point is 00:01:14 Before we get into things that have already been done on small, rolly robots, could you tell us a bit about yourself? Yeah. Hi. As I was introduced, my name is Morgan Allen. I am a longtime developer, a long history of front-end development, and primarily being a JavaScript developer. I've been doing front-end work for about 10 years, coming from even further back, coming from a database background. And coming full circle now with things like Node.js, I've gone back doing server-side and primarily maintaining JavaScript, but now exclusively doing server-side development again. And along with that, Node.js opens up a lot of possibilities
Starting point is 00:01:57 for doing communication directly with other hardware platforms, including serial communication and Bluetooth communication with devices like the Sphero. Well, the Sphero. I didn't say anything about a Sphero. Whoops. But BB-8 is based on the Sphero platform. I mean, the robot that is released as a toy
Starting point is 00:02:22 is based on the Sphero platform. The actual movie one probably was not. I've heard it was not. Yeah. But Sphero is what I'm playing with when I'm talking about my little BB-8 robot. Yeah, that's right. It's a newer and what appears to be a much more update version of the original Sphero toy from Orbotics. Close. I mean, there are some changes,
Starting point is 00:02:46 some hardware changes. Yeah, that's it. It looks significantly updated. But I was so fascinated because it requires you to orient the robot with respect to yourself. I talk about inertial sensors and how the inertial frame and your frame, or
Starting point is 00:03:02 the frame of interest, have to be in sync or the whole thing is pretty silly. And the robot, the BB-8, I have to turn him around so the blue light points towards me so that we agree on which way is forward. And this is no different than flying model airplanes or quadcopters. They have a frame which is forward to them, and it's not necessarily always going to be the same forward reference as yourself and i think this is just syncing the two of those just comes through
Starting point is 00:03:30 experience and practice whether piloting or controlling the bb8 but you do have to do something you have to agree yes that's right yes that yeah yeah that is correct and this is like where the tail light comes into play on the original. That's the blue light that I sync up with me. Yeah, exactly. Okay, so you said that I should not spend all of my time looking at BB-8's protocols. Yeah, it looked like you were about to just dive straight in and you were giving some demonstrations on what you thought different parts of it have done but the with the older devices at least uh robotics in their a their sdk documentation provide um all the information for how the headers are set up and
Starting point is 00:04:19 what what everything means they have their old ones have a fairly well-documented API. You mean the old Spheros? That's right. I've not, sadly, in checking, prepping for this, I was not able to find anything yet. No, no. And I tweeted at Sphero on Saturday and asked if their stuff would support BBA, their education stuff. Because I was totally unaware that Sphero had this huge education outreach program. Yeah, they seem to be pretty active in that. And from brief conversations I've had with their developer outreach on Twitter,
Starting point is 00:04:56 which I believe is at SpheroDev, I'm not totally sure there, they've been fairly responsive and supportive of work myself and other people have been doing. And so what kind of work have you been doing? So one of the main libraries that I wrote early on was another layer added on top of two existing libraries. One was called SphereOn, which was a simpler API built on top of their very low-level API.
Starting point is 00:05:27 And what I released was called Simple Sphero, which was an even simpler version, literally making it so anybody could start controlling the Sphero with not needing to worry about headings, not having to worry about anything about rotation, very simple commands, left, right, forward. Then very simple things like toggling the backlight, changing the color.
Starting point is 00:05:53 But the idea was to make this API as simple as possible so people, and specifically for young people interested in programming, could start using it right away. So Sphero, and you showed it to me just a few minutes ago where you have a standard Sphero and you booted up your computer and and you typed a few things and they connected to each other and then you could change its colors or drive it in different ways. And you did this from a Node.js script?
Starting point is 00:06:29 Yeah, that's right. So one of the advantages, one of the things that Node provides, because it's running, it's running as a local process. It's not bound to the browser. So it allows you to have low-level communication. You have access to a file system.
Starting point is 00:06:46 You can create an HTTP server. You can communicate over a serial port. There's a particularly important module in there. This is one of the early modules that really kicked off what the idea of NodeBots is. It's the Node Serial Port. Fairly basic, but it's a module that gives serial communication. The original Sphero didn't use BLE, so you could just have a regular serial connection.
Starting point is 00:07:12 It used a standard Bluetooth? Yeah, that's right. So then you can have a regular serial connection over it, and then that's how everything is communicated, even on the original application. So using Node Serial, Sphero, everything is communicated even on the the original application so using using node serial sphere on and even the their provided api or is able to communicate directly to it so i want to back up a little bit because we've mentioned node js on the podcast a few times and i'm basically a
Starting point is 00:07:40 complete ignoramus where that's concerned i i've used it for a couple of little things, but it seems to be coming up more and more with the Internet of Things. The Photon device. Particle.io's Photon? Yes, the Particle.io of Photon uses it or can use it. And it seems like as embedded developers, this is something that keeps creeping into our sphere of influence. Can you give us a really basic description of just what it is and why we
Starting point is 00:08:05 might be interested? Yeah. Think of us as C programmers. Yeah. Yeah. Well, good portions of it are written in C. So in a very much nutshell of it, it is V8, the same JavaScript runtime that is in Chrome. It is V8 with a very lightweight module system put on top of it called RequiredJS. And as I mentioned before, it provides these functionalities for communicating with file system for creating HTTP servers. You can also build native modules. And it's an example of which is the serial port. The serial port is written in C. And then it provides a JavaScript interface
Starting point is 00:08:49 that you can communicate with physical devices. How is it different than just JavaScript? Is it the hardware abstraction layer? No, it's more that generally JavaScript is bound to the browser. That's where people most commonly think. When people think of JavaScript, that's what they think about is bound to the browser that's where people most commonly think when people think of javascript that's what they think about running in the browser this it does has no dom it has no it has no visual representation to it it runs as a process it's got
Starting point is 00:09:17 standard in it's got standard out um but that allows bindings to things like the file system, child processes. So you're outside of the sandbox of the browser. You can write normal applications. Exactly, yeah. You can write server applications. You write local processes. And then even beyond that, there are things like Atom Shell, Electron Shell. It's been renamed to. People commonly know it as the Atom Shell, Electron Shell, it's been renamed to.
Starting point is 00:09:46 People commonly know it as the Atom Editor. This is an example of where they've actually gone back and they've taken part of Chrome and they've bound it back to it as a user interface for locally running applications. So now you have your file system access provided by Node, you have an HTTP server, then now you have this, you have a DOM again,
Starting point is 00:10:12 but you can use this to build out user interfaces for local applications. So it's unwound, all of that stuff, and then put it back together in a way that you have more freedom. Yeah, that's one example of where it's kind of come full circle to develop desktop applications. And there's other devices, too.
Starting point is 00:10:28 You mentioned Electron. The Tesla 2 that's coming out will be running Node as well. So that one runs it directly? I believe it runs directly on there, yeah. Interesting. But the advantage is you're writing in JavaScript, which is a fairly friendly language to start with. And you have a lot of people who have a lot of experience with it coming from the website who now can write normal applications.
Starting point is 00:10:52 Yeah, definitely. And I think it lends itself very well to doing this sort of development. It can be, if you take the approach, it can be very event-oriented, which works very well for the asynchronous nature of communicating with hardware. As soon as you get a serial connection, you're async by default. You have to wait for connections. So the evented nature of JavaScript lends itself really well to that. That was one of the things I noticed in my Wikipedia scan of Node.js
Starting point is 00:11:25 was that it's similar to PHP, which you hear a lot about WebDev and PHP, but PHP is blocking. And PHP is the worst language ever created. Well, and Node.js is non-blocking, so it can do parallel and callbacks and all of that
Starting point is 00:11:42 sort of thing that I think C programmers are pretty familiar with. Yeah. Okay, does that cover Node.js? Yes, thank you for the detour. No, that's great. I was going to... But when I install Simple Sphero,
Starting point is 00:11:58 it looked like it needed more than Node.js. It wanted me to install Python and Visual Studio on Windows as well as Node.js it wanted me to install python and visual studio and on windows as well as node.js um that could have been so one thing i've noticed is that some of these uh some of the sphero libraries are still using a pretty old version of serial port and they i think what it's attempting to do is build it locally. The newer versions of Serial Port, which after this weekend have wrangled up a list of people who are going to receive pull requests
Starting point is 00:12:30 to get them up to the newer version, which doesn't actually require it to be built locally anymore. And so this is all based on Bluetooth using the serial interface of Bluetooth UART. And when I play with BB-8, he uses BLE, really nice, cute BLE module. And he's got properly formed GAT characteristics.
Starting point is 00:12:57 And so it looks like he's more advanced in the terms of Bluetooth world. You haven't played much with BB-8, have you? No, I've had very little hands-on. I've had no hands-on. Your talk the other night was really my first experience into it, which I find really interesting, especially having done more recent BLE stuff, BLE work since having done my work on Sphero last year.
Starting point is 00:13:23 I'm really interested to dive in more because Node also has several good BLE modules as well. There's people doing a lot of work around Node handling BLE communication. That's pretty exciting. I was looking at a small project where I needed to connect many things and be able to monitor them over time. I went through all the normal protocols
Starting point is 00:13:44 and I thought about ZigBee. I thought about BLE, except the reason I decided not to go that direction was because I didn't want to have to write a PC program where I had to deal with different BLE. And so Node would let me write like a monitor to monitor 10 devices speaking BLE. Yeah, potentially. I haven't worked with multiple devices yet,
Starting point is 00:14:09 but there's modules out there available now that I know can do discovery and communication. Well, they would all squawk advertisements and I would just sniff those. Yeah, that stuff is available. That's pretty huge because, like you said, up to now you have to write a PC application. More commonly, you have to write a phone application.
Starting point is 00:14:29 No, four phone applications. So you have to write something for Android or for iOS, which, you know, learning curve is quite steep for both of them. Reducing the learning curve just to get your, you know, because most people are interested in making their device. They're not, oh, I don't want to build an app. I just want to make this thing and test it. And even for hobbyists, that'd be great if you could just do it from JavaScript. Even the clients I work for, I'd like to be able to say, I proved this out using this app. Here's
Starting point is 00:14:57 the code for it. Now you can go engage your app developers. It's nice to be able to provide my own proofs. So that's pretty cool. And the whole time, Sphero has not been okay with this. They've been excited partners with actually providing more information, answering questions, and having their own system. Some of the same people that were hacking on this stuff last year, there's issues on their github where people are talking about what things that we're encountering uh and linux documentation hadn't been very good um this time even just this time last year uh and some of the stuff i had documented is now still up and still highly referenced, too. And also, one of the newest issues filed is whether they're going to support the BB-8 or not.
Starting point is 00:15:54 So that's already been filed? I can stop bugging them on Twitter? I believe just a couple days ago. Oh, no, never stop bugging them. Bugging people on Twitter is how the world turns. That's how they find out how many people are interested well uh so what do we mean by they do they support uh bb8 see the sphero people have this app called sprk spark and it's from their education subsystem and they have these videos on their website about using the spark app and doing a lab view like uh drag and drop
Starting point is 00:16:29 applications modular graphical and then really quickly they go from there to text-based applications and it's all developed on a smartphone and i downloaded the app and it wouldn't even wake up my Sphero BB-8. I was very sad because I was like, I can program this to do anything. Well, anything a small rolly ball could do. Yeah, right. Well, we're going to skip over that. Utility is not critical here.
Starting point is 00:16:59 Instead, they were showing videos about how to learn programming, how to learn geometry. It was all about teamwork. I want to make swarms of them. Well, when Morgan showed that it was doing different colors and then he could control what color it was doing, I wanted to make a display out of the world's most expensive.
Starting point is 00:17:19 I can see making a couple of really neat music videos where you're in sync with the music and they're all rolling around. It'd be like an OK Go slash Sphero video. Yeah, right. I think that was one of our demos we had had when we'd done one of our Sphero hack nights. Somebody had it rolling around in a random direction. And every time it hit something, it would change color. It would change to a random color and then pick a new random direction and just take off that way again.
Starting point is 00:17:45 We talked about that nobody ever did it. It would be great to do that in a dark room with long exposure. It's something I would like to see. Oh, no, I've got to try this. Well, we can't torture our BB-8 with different colors yet. Well, get on it. The SPARC program, also the education program for Sphero, also has clear BB-8s have you seen those yeah I've just seen a couple of pictures of them I haven't uh I haven't had one in hand I don't
Starting point is 00:18:13 know if it's the same as the old one or if it's the same as the Sphero 2.0 or if it's more modern like the BB-8 it didn't look that much more modern. I mean, they had this larger BLE chip on there, or Bluetooth chip on there when I looked at it. Although they didn't give really great... Anyway, the Clear was neat because you can see how they move. It's sort of counterintuitive. Have you... I mean, you said you haven't played with the clear one very much but no but i remember when it was released in the timeline it's probably the same as a
Starting point is 00:18:50 as a sphero 2.0 2.0 but i like that they just put the clear yeah yeah it was great oh and once i found out about those i uh went out to michael's and got a $1.50 Christmas ornament. And it doesn't quite fit all of my, I mean, it isn't perfect. But once you tape it together, it rolls around and it's pretty cool to watch. Yeah. And funny thing is I found somebody else who makes an add-on board for the Sphero 2.0. And in their instructions, they tell you to cut yours open and go find one of those clear acrylic Christmas balls. They need a slightly increased stack height to get their add-on board into it.
Starting point is 00:19:36 And I bought the one that just barely fits. It's a little too small. And then I bought the next one up thinking, hmm, I bet I could do something that would allow this to work too and give me more visibility. You could take up just a little bit more space somehow. Yeah, because his head is a mast and I can probably increase the size of the mast if I was electronically. Now all of the parts are on the floor. I know this makes for great radio.
Starting point is 00:20:02 But you can see the mast could be a little longer if I can figure out how. But yes, if you are one of the people in the Bay Area who's likely to see me, you should tell me to bring me the BB-8s if you want to see it because it's pretty cute to hold it in your hand when it's clear. We did a lot of that in the post- uh little gathering well let's see what else do we
Starting point is 00:20:30 have uh nodebots you mentioned them tell me more about nodebots so nodebots nodebots isn't there's no them nodebots is is an idea the first rule of nodebots is don't talk about NodeBots. No, no, no. We talk about NodeBots all we can. So as I said, NodeBots is sort of, it's an idea. It's the idea of, as I've mentioned before, when people think JavaScript, they think the browser. They think web development. But there's so much more to that. And with Node, just the possibilities of things that you can do.
Starting point is 00:21:04 And from early on, people started talking to hardware right away um there's a really important library out there and this is sort of like what sort of kicked off node bots or what this really commonly used it's called robe uh called johnny five and it's a Fermata adapter, I guess. So you can load Fermata onto an Arduino and control the board directly from Node.js. And with that, they've had now these days, there's add-ons for all sorts of peripheral devices, anything you can, what are they called the fritz dig layouts um if you can find one of those there's probably a johnny five add-on to that that'll allow you to communicate with the device for those of you wondering which movie is that from it is from short circuit which is where no disassembly comes from as well it's just no disassemble no disassemble sorry no disassembly
Starting point is 00:22:06 is i don't know oh i guess that's what that's what you mean people say when they don't want you to take apart their stuff or something about debugging debugging okay i'll take that uh anyway yes johnny five short circuit but there's also a git uh repository called johnny five javascript robotics and iot programming yeah yeah that's the one and they're that alone a Git repository called Johnny5, JavaScript Robotics and IoT Programming? Yeah, that's the one. And that alone has just a great ecosystem of, you can talk to accelerometers, barometers, so many hardware peripherals that are very commonly used in the Arduino community, already have what are essentially drivers written for them
Starting point is 00:22:46 and makes getting started working with these really, really simple. You just load Fermata and onto any compatible Arduino and then just start. Fermata is a firmware for the Arduino that allows direct control of the board over the UART. So you have your Arduino hardware doing hardware stuff, having peripherals connected to it, and then you can communicate with it. Or you can write your logic in essentially any language you prefer. I believe there's bindings for most popular languages. And Johnny5 is one that's very specifically robotics-oriented for Node.js.
Starting point is 00:23:39 So the Arduino becomes kind of a dumb pipe to get to the hardware, and then you have a bigger computer doing the logic in Node.js or whatever. Yeah, exactly. So you can read analog input values, you can toggle IOs, all the typical stuff that you would do in Arduino processing style. But now you can do it in whatever language you want. And it isn't just Arduino.
Starting point is 00:24:03 It looks like it supports all sorts of Arduino boards, BeagleBone, the Edison spark core. I saw electric imp go by. Yeah. All right. Yeah. That's Johnny.
Starting point is 00:24:12 Johnny five now supports. Yeah. So it supports a wealth of hardware. Every darn thing. That's pretty cool. I believe Rick Waldron's status is if you send him a board, he'll make it compatible. Oh,
Starting point is 00:24:23 don't talk. I can send him everything. Don't quote me on that, but I do believe he has said that. We've got some dev kits from decades past. And we're moving, so it's really tempting to send them to somebody. The smallest pick I've ever found. Wow, that's pretty cool. I mean, it's a nice stepping stone.
Starting point is 00:24:42 I normally would just be like, why would you want this? You should just be programming on the Arduino. That's what it's there for. Adding another layer is wrong. But that's only if you're interested in learning about the Arduino. What if your real interest was making a robot that did something? Or even more, what if you are trying to put a web presence to your device? Now, Node is acting as a proxy, as I said before.
Starting point is 00:25:04 You have direct file system communication. There you go. You have a logger now. You want to stream it to a website as well. HTTP servers there. There's a number of frameworks available for doing all sorts of service providing for front-end services, for web services. So now with Johnny5 and any number of HTTP modules, all of a sudden now you've got a live logger.
Starting point is 00:25:37 You can control devices from anywhere in the world all of a sudden. That's right. You hook a little bit of a solenoid out to an Arduino. You read the Adafruit tutorial on how to make all that power situation work you hook it to your computer and it pushes the button to start the coffee whenever you leave the house that's right well no i mean whenever you're headed towards the office depending on where you're anyway depending which direction you're going all the coffee all the time for my office you know i could hit the button by but by the time I'm downstairs, nothing's happened. So I just go hit the button myself still.
Starting point is 00:26:09 There are many applications for the Internet of Things. Many of them are silly. So more on NodeBots. You actually do have meetups and stuff. What do you do with the meetups? Other than crash things into walls and make them change colors. It's generally just rotating topics we've done everything from you know spheros was one of our early um early things we've done wearables we've had you know we've had guest speakers come in with you know light up
Starting point is 00:26:37 shoes that change colors uh color change colors with dancing mark hey resemble that remark. Hey, you'll fit in well. And in fact, our next talk I had mentioned earlier is going to be about, our next meetup, sorry, will be talking about TESOL 2, which is, I believe, just about to come out. So what's that? I haven't heard of that. The TESOL is,
Starting point is 00:27:01 it's another internet of things embedded development board. But I believe this new version will be running Node.js directly on it. Okay, wow. So it'll be similar to running Node.js on the Edison, where it's directly running on there and you have direct control of the IOs. Presumably it has a lot more horsepower than Arduino. Yeah, exactly. And most of these meet Presumably it has a lot more horsepower than Arduino. Yeah, exactly. And most of these meetups are in San Francisco. That's right.
Starting point is 00:27:29 There are NodeBots all over, though. The whole world round has NodeBots now, and I believe there's even a South Bay one. Good, I'm tired of going to San Francisco. I don't know why I care about that, so we'll be moving out of this area, too. So yeah, it looks like you have a November 19th meetup. Sounds about right.
Starting point is 00:27:49 That is very close to Hackaday's having a party around that time as well. Uh-huh. Maybe it's the weekend before. And I can say Hackaday's having a party because even though I was told not to talk about it, Chris Gamble apparently talked about it on his show. So he's more in charge. So we can talk about it here too. And you don't work there, so you can say whatever you want. Well, I try to not.
Starting point is 00:28:12 I mean, they do tell me things, and I try not to share them. But yes. Could people stop telling me secrets? It's so much harder to remember. This is information I can't share. Well, except for those of you that I've signed an NDA with and who pay me. Your secrets I will keep.
Starting point is 00:28:28 Okay, so what drew you to Sphero as a NodeBots thing? I mean, I can see how you can have a whole bunch of different NodeBots with all of these. Why Sphero? I just thought it had an interesting set of functionality. One of the original projects I wanted to do, two projects I still keep pecking away at a little bit here and there. I thought it would be an interesting mapping platform. Just let it run wild and do whatever it wants.
Starting point is 00:29:03 And every time it bumps into anything, because it does have feedback sensors, so you can tell when it has hit something. So every time it hits something in dead reckoning, then you have a slam simultaneous location in mapping. So you sort of map a room by Braille. Like the Roomba does. Yeah, basically. So there's a couple demos early on some some people were trying to do that i believe the random changing directions and changing colors was about
Starting point is 00:29:33 about the most complete somebody had gotten yet and then i think another one uh something i would really love time to put more work into i would love to have capture the Sphero, where the Sphero is a flag in the game of capture the flag and bring whatever other robot you want. And the idea is to go bump into a Sphero and you've captured it and it'll follow you around. And being that it can be controlled as well, then when you've successfully captured it, at home then it can you know go back to go back to its starting position on its own so some work has been put into that uh doing work with the connect as well uh to do you know recognition of where everybody is on the field i've done a little bit of work with node and OpenCV to try to get some of the different parts necessary.
Starting point is 00:30:28 So one of these days, hopefully I'll actually have a bulk of time. Well, there's a lot of different little parts to it, and I keep trying to contribute to a couple of these different projects that'll all come together eventually. Maybe one day we'll see Capture the Sphere. I'll be in an annual together eventually. And maybe one day we'll see capture the sphere. I'll be in a, an annual, annual event of.
Starting point is 00:30:50 No, I can, I can see that. And there's also, I mean, there was all sorts of games that if you could have four or five spheros, and I know they, they do get pretty expensive.
Starting point is 00:31:05 At about $150 each, they get really expensive quickly. Luckily at NodeBots SF, we were donated a lot of them. I think we have about 10 of them. I see. But I mean, you could do capture the Sphero with the bots themselves and make them autonomous-ish. Yeah. And so they have to go, whoever captures the one that's red
Starting point is 00:31:26 becomes the one that's red. And then you have to keep... You start collecting them, yeah. There are a lot of games possible. Now that I've played with these, I always thought the Spheras were a little, oh, okay, that's cool. What do you do next?
Starting point is 00:31:41 Yeah, controlling them from the phone never really... I've done it a couple of times, but that's not really what's captured me about them. I started from hacking on them from my computer first before I ever even used the application. I used the application on my phone to get a bit of better understanding of how the controls worked.
Starting point is 00:32:03 On the BB-8 application, you mentioned the mapping thing. They have some little fakey thing that tries to do that. Have you seen that? No, I haven't. It keeps track of where it runs into stuff and it'll put a little mark there. Oh, yeah, nice. And it tries to do dead reckoning.
Starting point is 00:32:15 It's terrible at it. Oh, it is. Maybe because it's tile floor and it keeps rolling sometimes and it hits the... That's something we notice is that, yeah, the surface definitely affects its performance. No, I looked at the dead reckoning output for a little while, and it erases it and redoes it pretty often, so you can't note just how bad it is. But more importantly, it has a few, I don't know, behaviors, I guess?
Starting point is 00:32:44 It can shake its head and it can nod and those are pretty cute to look at but you can tell it to do a square and if you mark down where you start the square it's squarish it's very square ish no it has corners for sure right and that's one of the things i sort of came to really like about it and it And I don't see it as a flaw necessarily. It's just that it's the nature of the way that it works. It can't come to just a direct stop. That's difficult for it. So one of the things that I was working on, we figured out quickly that if you come to a dead stop, it's just going to, it wobbles around for a little bit. You can see that it rolls and it goes off the position of the stop. And so I attempted to do ramping instead and had pretty good results,
Starting point is 00:33:28 as long as you were going in a straight line. You could ramp up the speed, and then we ramped down the speed slightly and got a little bit better performance out of it that way. But it's just the nature of the device. It's round. Well, and the sensors are valuable, of course. these are just accelerometers and gyros they're not bad at excels and gyros but dead recommending an integration was it was never gonna be great it was always gonna be just okay yeah yeah so that's that sums up how i feel about it it's
Starting point is 00:34:03 yeah it does a really really good job with what it's working with. And I mean, I like to talk about inertial sensors. And I did the bait and switch for Hackaday. Yeah. Where I was supposed to- The talk still was very fun, though. It was supposed to be about inertial sensors and sort of a reprise of my solid talk. And yet, when I look at BB-8, he's a great way to talk about the fallibility and how things can go really well for some parts, but very badly for others.
Starting point is 00:34:38 Definitely terrain makes a big difference to the way it's constructed with wheels on the inside and round on the outside but the dead reckoning it wouldn't have mattered if they'd put they'd had to put like fiber optic gyros and really like thousands of dollars worth of sensors well i think it uses the motor sensors a little bit doesn't it does it have does it have uh feedback from the motors i don't know if it has feedback but it it's steppers from what it looks like. So at least there's relatively good control. Okay, I didn't know it was steppers. That's interesting.
Starting point is 00:35:14 It is steppers, and I'm sure it's steppers. But it also did have some feedback, which I noted mostly because when I was looking at that interprocessor communication, the handily identified RX and TX, I noted that I got different values in part of the packet when its motor was off versus when its motor was on. And those weren't the same areas where it was about moving because I was holding it the whole time. So, yeah, there's some sort of feedback. I think it's a force feedback. So I think if I jam the motors, I will see those change.
Starting point is 00:35:54 Okay. Back EMF sensor. I don't know if they have those on steppers. I don't know anything about motors. Don't email me. Dear Christopher, here's what a bypass capacitor is and here's how a stepper motor works yes don't send any of those things uh yeah so so bb8 cool let's see what else yeah uh what do you
Starting point is 00:36:17 do for your day job um i'm a no js programmer so i it's a shock yeah Yeah. So, what year is it? Basically, I'm about 15 years into professional career, almost entirely around JavaScript. I got into JavaScript early in my front-end days, basically because CSS was terrible and it needed help. Then it came to really, really like JavaScript and just continued to use it since.
Starting point is 00:36:56 And Node came along to me at a very, very important time in my career when I was using this insane, cobbled-together Java Rhino platform to do tracking. It needed to be real-time. It needed more than just a PHP server on the back end. And Node came out right about the time, or I had found Node about that time, and it was my saving grace because it got me away from Java.
Starting point is 00:37:29 And in case you don't know, Rhino is Mozilla's open source JavaScript interpreter written in Java. So have you done anything with devices on the side before coming to NodeBots? Yeah, so I've done embedded programming, professional embedded programming as well. I used to do work with, primarily my professional stuff was with PIC processors. I preferred AVR processors myself because... Everyone does. Well, just...
Starting point is 00:37:58 Everyone who's not a hardware user. Yeah, there was a GNU tool chain available. I could use GCC, I could use GDB. I didn't have to use, I didn't have to boot up a Windows VM or keep a Windows computer around to run MP Lab and use their terrible editor, and everything was just terrible. So you're kind of a unique entity,
Starting point is 00:38:18 because there aren't a lot of people who have done both sides of development. Yeah, I consistently find that. And especially pre-frontend, I did database administration. Which is another thing. I was a Linux administrator just out of high school. I did that for a number of years. And yeah, I've done professional.
Starting point is 00:38:38 I've worked with electronic engineers doing professional embedded firmwares and frontend development all the while and yeah back back to servers and back to hardware never never really left hardware it was always just more more hobby than profession okay well someone who hasn't done all those things i've kind of you know i've kept up with what happens in the web world but it's always something of a mystery to me you know I know what the acronyms are and I know what everything does basically,
Starting point is 00:39:06 but I haven't really built anything out of it since, you know, the web was a year old. I guess my question is, do you find it a different mindset required to do those things, to do embedded versus other programming? We in the embedded world tend to think that, oh, we're this little conclave over here.
Starting point is 00:39:28 And I think that the application and web people think the same thing of their enclave and never the twain shall meet. Having done both, do you think that's really true or is software software? I sort of see it as the software software because you can see radical differences between your average PHP developer and your average C developer.
Starting point is 00:39:48 Everybody has their ways that they do things. It varies from one programming language to another. So it will very obviously differ hugely between embedded development and straight software development. But at the end of the day, I see it as programming. And one of the things I've always loved, I'm self-taught. I have no formal education in programming. And one thing I love about branching out like this is I can always learn something one place,
Starting point is 00:40:24 and it'll highlight something i've done another place i believe that that'll you'll constantly gain new knowledge about all of software development the more you try out different things do you think doing embedded stuff gives you a perspective on resource constraints that normal people in the server side might not have. Yeah, very, very much so. And it's huge for people to understand these things. Your typical front-end developer doesn't necessarily think about these.
Starting point is 00:40:59 But as soon as you get into mobile development, these actually become issues. You have limited constraints on a phone. Modern phones are quite quite powerful but javascript is still bringing them to their knees well javascript interpreters are great these days v8 is a is a incredibly efficient um terrible websites are bringing them to their knees yeah well dom is still really yeah dom is usually the you know the the achilles of a lot of web development. It can tend to be memory hungry. But even those things are getting a lot better. What is DOM? I'm sorry.
Starting point is 00:41:29 The Document Object Model. That's how web pages are laid out. And it's really noted for being awful. I mean, isn't that just... Okay, yeah. Last time I did web was a year after it was born. So this is like way beyond HTML, even beyond CSS. Well, it's the document object model is after the HTML has been parsed,
Starting point is 00:41:54 the DOM is created from that parsed. So everything becomes a node in this object model. And it tends to grow very rapidly. Yeah, there's just a lot of problems with it. And it's loathed by most people who have to deal with it daily. Fair enough. Sorry, you were headed somewhere. Yeah, sorry, what was that question again?
Starting point is 00:42:18 See, now we've all lost it. I know. We were talking about doing both embedded and non-embedded. One example was the resource constraint. In mobile development, then constraints start becoming a reality in
Starting point is 00:42:35 mobile development. Despite the fact that modern phones are still good, you still have to contend with things like network issues. You have to come up with a plan to deal with these sort of things so in the reverse direction what do you think what do you think embedded people could learn from the web world oh um one okay so one thing that i find maybe it's just because i don't have the professional background, but in my day-to-day development, in front-end development, it's very common, unit testing.
Starting point is 00:43:11 Oh, great. I test everything. I'm a fanatical unit tester. I hate mystery bugs that just pop up out of nowhere, so unit testing is very important to me. That's something I don't know how to do and that's sort of embedded in the culture that in a way that it's not in the device world yeah uh yeah that's that's sort of my my observation on it and so this is something um you know i don't know how to unit test hardware i don't know if people can um so that's the that's an interesting kind of roadblock
Starting point is 00:43:46 or that's an interesting, you know, leaving my comfort zone when I start doing embedded stuff. It's like, there's always that like little voice in the back of my head. This is like, there's no coverage on this. It's like, I don't have code coverage. I don't have unit testing.
Starting point is 00:44:02 So I think maybe that's something that can be that sort of desire to have that would could be adopted by embedded development or at least, well, as I said, I'm not sure if that's a standard practice and an embedded development that I just haven't learned or if it's just not that common. It's getting more common.
Starting point is 00:44:21 A lot of people are talking about it. It's as you say, difficult with hardware getting involved, but there are ways around that. I think it's a historical, cultural thing. It's the techniques that grew up with the web industry alongside it, whereas now we have to bolt it on to things that have been done for a lot longer in the device world.
Starting point is 00:44:40 Yeah, as you said, you're aware of the lack of coverage. You get a little anxious if you have code that isn't covered. And embedded, a lot of times, is like, code coverage. Well, I can only cover like 3%. So who cares? And that's not, I think that attitude is slowly changing. But it could change a little faster. Yeah, that's something I would love to see, especially because when I'm developing in C,
Starting point is 00:45:08 I'm a moderately good C developer, but it's not my first language. I don't use it all the time. So that's something, even more reason why unit testing is very desirable for me, because I know I can make a mistake somewhere. And I want that mistake. I could easily make a mistake that I don't understand. And I would love opportunities to have those caught for me. Well, it's part of C's design to encourage you to make as many mistakes as possible. Along those lines, and along those lines of the merging of of two very different approaches to
Starting point is 00:45:47 software development there are a lot of devices like you mentioned one that's coming out that actually runs node.js natively i guess is the word but not i mean it's probably not exactly natively i mean it's not a node.js chip but that's how you program it There's been a couple of other JavaScript-based little boards, I think, in the past. Yeah, the Esprino is one that's been popular. Esprino has its own interpreter, I believe, that they put onto their hardware. As an embed guy, this kind of offends me, because I feel like you're wasting my precious resources with an interpreter or a VM or something. But on the other hand, it does allow people to transport their skills from
Starting point is 00:46:32 one area to another directly. How do you feel about this? Do you think it's just a way to get people into working on devices? Or do you think it has legs that this is actually going to become something where people actually program on these devices more commonly in higher-level languages than C? I could see this really going in either direction. The obvious benefits of it is anything that lowers the bar of entries, in my opinion, is great. People have all sorts of opinions on Arduino, but look at what we look at what benefit
Starting point is 00:47:05 arduino gave all of us like just looking at the economics of it like the so many peripheral devices have come in just the bar of entry is so low um now so i can see anytime anybody makes a new interpreter for an embedded device it just it lowers that bar of entry which i think that's great um and then there's's definite practical applications about it. Lightweight firmware updates. If you have this interpreter, then all of a sudden getting new code on the device is so much simpler. You don't need to reprogram the actual chip.
Starting point is 00:47:39 You just load a new script into the Flash. Which raises questions of how to protect that, but there's ways to do that. Yeah, exactly. Well, yes, and I definitely support these sorts of chips coming out with JavaScript and Arduino sorts of things because I find it hilarious
Starting point is 00:47:59 when they bring me such things and say, can you make this actually be low power? Which is one of those areas that, you know, this JavaScript on processor sounds like a great thing to get started. And it's a great way to get people involved, good way to prototype things. But then when you ship it, it becomes all so much more interesting. Dealing with the manufacturing of a microcontroller, dealing with the power considerations of wearables or battery-operated things.
Starting point is 00:48:29 It's not there yet. And I don't know that it ever will be. I mean, as you mentioned, the resource-constrained nature of embedded systems is sort of part of the definition. Yeah, but 20, 25 years ago, a high-powered embedded systems chip was what i mean it's a cast-off cpu from the 70s or some pics or you know a very low-end avr and now we're all talking about cortex m4s and m7s and and using these and even the m0 i think it's really powerful if the amount of power for how low power of a device that is
Starting point is 00:49:07 is pretty incredible. So in 10 years, you might have something with the power characteristics of Cortex-M, whatever, that also can do that while running. I don't know. It's interesting. I mean, there are certain advantages to this, right? Because if you're writing in C, as you said,
Starting point is 00:49:23 C leads you to mistakes quite easily, and other languages are more protective. So if we want to get to the kinds of security space we want to be in, maybe that's how we get there. I don't know. Don't email me. And more testing facilities and maybe some security built in. So having looked at a number of languages
Starting point is 00:49:45 and different levels, do you ever look at security? Yeah, well, so security has been a huge part of my job from day one. Like everything I've ever done has had some aspect of security involved in it. Just front-end development day-to-day, making sure you're protecting against
Starting point is 00:50:03 cross-site scripting errors, making sure people can't comment injection, just very basic stuff like that. That's, yeah, every day. That's, yeah, basically that's always been a concern and it's always something I've had to deal with. So what's the best language based on security concerns? What's the best language?
Starting point is 00:50:25 I think my, I think this is done. We're done here, right? You can totally refuse to answer. Remember that the correct answer is C, but you're free to. Yes, yeah. Oh, I would not even.
Starting point is 00:50:38 I mean, I do not hide the fact that I like C because I know it very well and that I like C++ because I know it pretty well. But I like C++ because I know it pretty well. But I would not count those. C is the best language.
Starting point is 00:50:49 Like a muscle car from the 60s is the best car. Yeah, there you go. Right, exactly. That's a really, really good analogy. I overheard somebody at a meetup recently talking and based on opinions, I have to go with whatever's newest. That sounds about right. So it's either rust or go is the best language right now.
Starting point is 00:51:07 I'm hearing a lot of excitement about Rust, but not a lot of traction behind it. Like I said, I like JavaScript. The reasonable amount of traction is still with Go. Well, it's because Google's pushing it instead of Mozilla. Well, and it was PayPal who actually brought it to our attention. No, I have heard people who like Go quite a bit. I've seen a couple of interesting things in the peer-to-peer area written in Go. There's a cool project called Sync Thing,
Starting point is 00:51:38 which is an open-source alternative to BitTorrent sync. That was really cool and recently it was brought to my attention a project called IPFS which is a distributed file system at Go. So there's definitely some interesting projects. Yeah, it's an interesting project because it sounds like they're trying to re-architect the web.
Starting point is 00:52:00 Yeah. Which seems ambitious. Well, yeah, there was a really nice sales pitch along with that uh but it got me into some interesting reading and there's actually some really cool um uh other existing project projects doing doing very similar work um that were brought to my attention okay so not knowing not having read the article you guys did, IPFS, the permanent web, and there's this blah, blah, blah, blah, blah. IPFS, which is a terrible acronym because there's no way I can say that more than twice. Interplanetary file system.
Starting point is 00:52:36 Could become a major new subsystem of the internet. Wow, that's quite a claim. If built right, it could complement or replace HTTP. That's a lot of conditionals. Wow. Is this on their website? This is on their GitHub site. It sounds crazy.
Starting point is 00:52:52 It is crazy. That is part of their readme, folks. Yeah. So, yeah, but there's talks and stuff. No delusions. They definitely are aiming high and aware that that aim may be towards their foot. You go all the way around eventually. Yeah, totally.
Starting point is 00:53:09 So I'm actually out of my outline, but we're not quite out of time. Do you have other things you'd like to tell us about? Well, you know, so IPFS had come to my attention through a couple other projects I work on. So I'm a member of Sudoroom Hackerspace in Oakland. And one of the big projects out of there is the People's OpenNet. We're working towards building an open community-oriented mesh network. Hopefully all wirelessly backed. 802.11 or some other protocol?
Starting point is 00:53:44 Yeah, 802.11.11 yep that's right brought to my attention that ble 4.1 starts having mesh aspects and i'm right like looking forward like zigbee style meshing right yeah well i never thought zigbee meshing was real meshing i mean they say it is but well anyway you are meshing using 802.11 so i shouldn't ask you bla questions uh so yeah that's a really cool project and that was where most of you know the ipfs and some of the alternatives that uh had come up in a meeting we had discussion discussion there last week um so that's a really cool project uh going on here in the bay, so I think people should check out. The website is peoplesopen.net and pseudoroom.org. Check out Pseudoroom, great hackerspace
Starting point is 00:54:31 in Oakland, part of the Omnicommons. Check out what they're doing. There's all sorts of really cool projects going on just in that building itself. Well, I guess I think we should get back to our afternoon. And do you have any more questions, Christopher? I did, but then I forgot it. Wait, no. Morgan, do you have any last thoughts you'd like to leave us with? Keep hacking. That's it. Keep hacking. Keep learning. I've taught myself,
Starting point is 00:55:13 well, I've learned from a lot of really great people throughout the years. I've taught myself what I think are some really awesome and frequently useless things that just keep broadening my experience. And I always really encourage people to really just keep learning new things write useless things it's fun and that's the best way to learn I would second that I thought that taking a part at bba it would be interesting but I did not realize how educational it would be yeah no it was so it's uh yeah you get information from weird places so you might as well try all the information yeah i agree my guest has been morgan allen international bit wrangler my hardware diet no hardware developers diadactic galactic wow why did that name uh that whole thing is on youtube my slides
Starting point is 00:56:07 are available and i am going to write up the details for element 14 in our linker blog so you'll probably see that real soon and i do warn you i have totally got a crush on bb8 it is almost but not quite as enormous as my crush on Chewy was in second grade. Right here. Don't tell my husband. Right here. Which reminds me, thank you to Christopher for producing and co-hosting. And of course, thank you for listening.
Starting point is 00:56:35 If you'd like to say hello, send us more robots or anything else, hit the contact link on Embedded.fm or email show at Embedded.fm. I have a final thought for you. This one from Jim Henson in his book, It's Not Easy Being Green. Here's some simple advice. Always be yourself. Never take yourself too seriously. And beware of advice from experts, pigs, and members of parliament.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.