Embedded - 6: Do Robot Squirrels Dream of Electric Imps...

Episode Date: June 20, 2013

Matt Haines (@BeardedInventor) of Electric Imp joins Elecia White to discuss how to connect cats (and other things) to the Internet. Buy an Imp on Adafruit but don't forget the adapter (aka April boa...rd). Get started with programming in Squirrel and find hardware details in the developer section of Electric Imp. We also mentioned Lockitron, a commercial product that uses Electric Imp.

Transcript
Discussion (0)
Starting point is 00:00:00 Welcome to Making Embedded Systems, the show for people who love gadgets. This is Elysia White, and I'm excited to have Matt Haynes from Electric Imp this week, talking about how to connect things to the internet. And by things, I do mean gadgets. Hi Matt, welcome to the show. Did you bring me goodies? Hi Elysia, I did. So I brought along an April board and an electric imp and sort of a basic breadboard with some components on it so that we can play around and see how it works later.
Starting point is 00:00:32 So we'll actually get to connect something to the Internet. Yeah, we're going to make it so that we can turn a couple LEDs off using just like a get request from a webpage. Before we get there, I mean, Electric Imp, if I had never heard of it, if I was, say, walking around Maker Faire and wandered up and said, what do you do? What would be the 30 second elevator pitch? So Electric Imp is all about making it really easy to both build connected devices, things that are connected to the internet, and also, if you're interested, bring them to market. So it's a combination of hardware and also a software platform that it can connect to really easily so that it can talk out to other web pages, make web requests, process them and make it really easy so that you can focus on building a product instead of all of the messy
Starting point is 00:01:20 bits of connectivity. So the messy bits are not are like the 802.11 part, the module. Yeah, so it has a custom OS on it, and that takes care of all of the network stack, all of the protocol that it needs to talk to our servers. And we abstract all of that with a programming language called Squirrel so that we expose the hardware bits that you want on the device and then the connectivity bits to talk back and forth. So 802.11, I mean, just getting down at the very lowest level, we're talking about connecting to my normal Wi-Fi, right?
Starting point is 00:01:56 Yes, that's right. And it talks A, B, G, N, what? It talks B, G, and N. Okay, so the most common ones. And the security protocols, I'm not going to have to, you know, have a passwordless horror running in my house in order to make this work, right? No. So the whole idea is we have an app that you can download for Android or iPhones,
Starting point is 00:02:18 and you just enter your information on that. And it uses a protocol called BlinkUp to flash the screen to an optical receiver on the imp and that's how it transmits the SSID and the network password to get it online. So I just hold it up to my phone screen and it like magically twiddles pixels in order to download information? Exactly. So that's just sort of, you need to do that once when you hook it up to the network initially and after that it remembers it. So what do you call that? That's called BlinkUp.
Starting point is 00:02:48 What do you call the process of giving it the password? We call it provisioning in some of my clients. And I didn't know if there's another... There are lots of industry terms, but making it able to talk to my Wi-Fi or my mother-in-law's Wi-Fi or my neighbor's Wi-Fi. So I guess we kind of call that commissioning. So there's the idea of commissioning an imp, which involves giving it the information to get onto your wireless network, but then also your account information to get it online to the imp cloud so that it knows, so that you can talk to it from the IDE and so that
Starting point is 00:03:21 you can push information back and forth. Okay, so that's the second half. We're on my Wi-Fi and now there's more to it. There's talking to your cloud servers. That seems a little weird. Why can't I just talk to my internet? Right, so the whole idea behind why it talks directly to our cloud server is it makes it so that it's a somewhat more appealing solution for a lot of people who don't want to have to maintain all of their own servers, who don't want to maintain all of the bits of talking back and forth. So the idea is if you talk directly to our servers, which is how we have it set up, then we can take care of all of the security. You don't need to worry about how information is being passed back and forth.
Starting point is 00:04:00 It can all be abstracted really, really simply. So if I was making, let's say, Wi-Fi enabled sprinklers, because I always want to be able to turn my sprinklers off if it's raining. In using an electric imp, I wouldn't have to have it talk to my home server. I could then control it if I was on vacation or wherever, it would go up to your server and all of my interface would be there. Yeah. So the whole idea is basically the imp talks to our server and then from our server, it can talk to anything else. So if you wanted to, you could also hook in like a weather API and you could have it so that if it reads that it's going to be raining today or that it is raining right now, it'll turn your sprinklers off for you if they're on.
Starting point is 00:04:42 And so does that, so my home server would talk to your server and run the weather API and get the data from yours and smash it all together? Or do I run code on your server? Part of the platform for ElectroCamp is this cloud bit. So we have the programming language called Squirrel that we've implemented. And when you're writing applications for the AMP, there's two components to it. There's a component that runs on the device and a component that runs on our server. And the component that runs on the server in the cloud is able to process those API requests or whatever else to get that information. Okay. Okay. I think I'm getting it. Okay. But let's go back to the hardware because that's what I like best.
Starting point is 00:05:26 I have it here. Let's see. You brought me two pieces. Well, three pieces. One is the electric imp, which looks like an SD card, and it has an adorable little imp on it. He looks a lot like Maxwell's imp. And it looks exactly like an SD card. This was intentional, right? Yeah. So the whole idea is if it looks like an SD card and has the same pinout as an SD card,
Starting point is 00:05:52 then you can get really cheap, really easy to find SD card connectors to build into your hardware if you want the removable card solution. And then it's also just really small and really slim. So it's a nice form factor. And how many people try to put them in their cameras and ask you why they don't work? We don't have too many people who do that. But there are lots of people who ask if it's similar or the exact same thing as an iFi. Well, that's, that's actually a really good point. The iFi is a, an SD card that has wireless embedded in it. And you hook it up, you commission it, sort of, although it's a little different from your process.
Starting point is 00:06:33 And then it will automatically upload the photos from your camera as soon as you walk inside. It's kind of magical. You take all these pictures and they show up on your Flickr or wherever you've assigned it to go. But that is unrelated to your product. Yeah, that's completely unrelated. So they're both SD cards with Wi-Fi, but ours is really built or ours is a solution that's sort of making it easier to build hardware, whereas theirs is just a solution for sort of uploading
Starting point is 00:06:58 your photos really easily. Could they, I mean, this is later. Could they have used your solution to upload their photos if all the timing had been different? Potentially, um, if you actually are able to open up one of the imp cards, you'll actually find that it's pretty jam-packed in there Um, there's a there's a fair bit going on inside of the imp hardware wise So I don't know if you could have found the extra space you'd need to sort of add all of the extra storage. Oh, so it's the storage part, but the connectivity part. Yeah, they could have. Yeah, definitely. Okay. And I hear that if I, if I did open this up, although I don't want to, it's just so adorable on its own. Um, there's a Cortex M3 in here. Yep. That's right. And the Cortex M3s3s are fantastic because they're very, very low power and yet really powerful. And you said users can run their own code in here. Yep. So it's not just
Starting point is 00:07:56 a Wi-Fi module. It's a whole development platform. Even the hardware is just a whole development platform. Yeah, when lots of people pick them up, they sort of assume that it's just a Wi-Fi module for an Arduino or some other microprocessor like that. But it's actually got a 32-bit processor in it, the M3, that you can program and run code on it. So it's sort of a self-contained solution for wireless. But there aren't that many pins here. I mean, an SD card only has like eight or ten. So how many of the pins do I actually get to use? So the Imp Exposes for the card, six IO pins. So you can do digital and analog input and output. And for analog, you can do PWM.
Starting point is 00:08:36 And there's also a 12-bit DAC on board. And then it can also do all of the protocols like I2C, UART, and SPI. So it's pretty robust for the six pins. And if I wanted to, I could connect it to an Arduino and have that do other things, have more GPIO over there, just use UART or SPI or I2C to talk to each other. Yeah, people have had pretty good success with that. That seems like a pretty cool thing. And then this plugs into another board you brought me. I believe it's called the April board. Yeah. So the April is our really basic breakout development board. So it basically,
Starting point is 00:09:11 most of the components on it are just for power management. And then the one sort of extra funky bit that's on it is a little chip that provides a unique ID. And we use that unique ID when it connects to our servers so that it can identify it in our IDE so it knows where to push the code to. And looking at the board, there's a bunch of pins, maybe 10, power ground, pin 1, 2, 3, I assume those are the IO pins you talked about. Yep. And that's a header, so that would go pretty much right on my Arduino, I bet. Maybe. I've never actually tried to line it up, but it might. Well, maybe it would go into a breadboard. Arduino would go on the breadboard and we'd wire them up. And then there's a USB port.
Starting point is 00:09:54 Yeah. So the USB port is kind of misleading. It's just a really easy way to get power. It doesn't actually do anything else on this board. I've always thought that was the real purpose behind USB, to power all of my other gadgets. Power everything that sits on your board. I've always thought that was the real purpose behind USB to power all of my other gadgets. Power everything that sits on your desk. Yes. And you said the other components. There are maybe six other components and one of them is a capacitor. So this isn't a lot of electronics here. No, it's pretty bare bones in terms of what you need to get running. And if I wanted to put Imp in a product, I would remake this board, this April board that's really just a breakout board for hobbyists. Yeah, the idea is sort of we have that as a reference designer and website along with a whole bunch of other boards that you can start from as well. And it's sort of just, you know, if you want to get up and going really, really quickly, we have this development board.
Starting point is 00:10:39 If you want to build something off of it, then the components are really cheap and it's fairly easy to get going. So with this board and the input plugged in, how much, how much am I holding here? I mean, if I drop it, how much do I owe you? Um, so the, the cards cost about $25 and the boards are about 12. Okay. So this is cheap. I mean, if I do want to wifi my sprinklers, this is $45 plus whatever sensors I need for the sprinklers and the solenoid connectors. We'll get into that later. Yeah. But so the USB, back to that, you said that's just for power. How is my code going into this? So if you remember, we talked about commissioning a little while ago, which is the process of we get it online. And then part of that was also you enter your account information for Electric Imp. So once you've done that, and the imp is online, it starts talking to our servers.
Starting point is 00:11:36 And part of the thing that it sends is what your account is and that unique ID that's on the on the hardware. Once it knows that you you can log into a browser-based IDE that we have. You write your code, you click a button, and then it just wirelessly sends it to the AMP and starts running it. So I don't have to buy a compiler. I don't have to buy a JTAG unit. None of that. I just type into the web and magically it gets the code. Yeah, all of it is just over Wi-Fi. Squirrel's an interpreted language, so it doesn't need to be compiled. And it has the added bonus of when your code breaks, it can just automatically restart itself. So that's really cool, but how do I debug it? I mean, it seems like I can't actually do anything more than toggle pins. What if I put an if one loop or a while one and it just spins into infinity? So we have part of the IDE that we have online is actually a debug console.
Starting point is 00:12:33 So you can do you can write things to our console. It logs things when it runs into errors. So you still have a lot of the tools that you would have if you were actually using like a JTAG programmer or something else to to code it. But it's just all done through the browser. So I can still have printf basically? Yeah. Okay. I do a lot of debugging with printf. You can't always break into stuff. So that makes sense. And you've said squirrel a couple of times. And that makes me a little nervous. I did look it up. But what do you mean I have to learn another programming language? So you kind of have to learn a new programming language. So Squirrel is this object-oriented, event-driven programming language that Electric Imp decided to use for their module.
Starting point is 00:13:22 One of the really nice benefits that it has is the interpreter that runs on our OS is really, really tiny. So that's a really important piece to it. When you get right down to it, Squirrel is almost syntactically identical to JavaScript. And it's really, really similar to, you know, along with that C or C++. So you do need to learn a new programming language, kind of, but the switch over from whatever you're using probably won't be that bad. And when I looked at it, it looked a lot like Arduino does. I mean, it just had all of, you know, there were the special things that were installed and instantiated, but it just didn't look different. Yeah, a lot of, we have a pretty good OS team who works out of the UK, and they've done a really phenomenal job writing up lots of good APIs
Starting point is 00:14:10 to make everything really easy to do. And if you've ever used Arduino or Embed, another really popular dev board, it really looks the same. But do you know why it's called Squirrel? No. Me neither. It didn't say in the Wikipedia article. Yes. Squirrel is a weird language. As far as I know, the only people who use it is people who program the electric imp and a few people who make game scripts for a couple
Starting point is 00:14:36 different games. Yeah. They said some parts of Portal 2 were written in Squirrel. Yeah. But okay. So if we don't know why Squirrel, why Imp? So Imp actually goes back to, I don't know the exact origin story, but it has something to do with one of the first sort of connected computers in the 60s. Okay, okay, we'll go with that. Maybe we'll connect to that story online. So do check out our website, embedded.fm. And let's go back to your server and writing the other half of the software. I've written my proto sprinkler controller on the hardware and it talks to my IO as necessary. Now I go to write on the server side. I'm not a server side programmer. What happens here?
Starting point is 00:15:26 Right. So all of the code is still in Squirrel. And it's all sort of in the same window in the IDE. And this is where, since the imp is really designed at connected sort of deployed solutions, you really want to have low power consumption, obviously. So one of the benefits of having this server piece is you can offload all of the hard work. So rather than having the device process web requests or do a bunch of data crunching, you can just pass an event and some data up to our server, write some code in Squirrel again to do some processing and then send a result back or send it out to somewhere else on the web. How do you work with an iPhone or Android? You talked about the blink up and connecting, but can I connect my device? I mean, how does that work?
Starting point is 00:16:17 Sure. So basically every single imp or the agent, which is the server side code that's running for each imp, has a unique URL that you can hit. So if you're writing a mobile application or a website or anything that can talk to an HTTP endpoint, then you can talk to the AMP. How fast can they talk to the AMP? Pretty quickly. We could do a demo if you wanted later, where basically we just click a little button and it'll send a message and turn on an LED or turn it off. But we usually get response times under two or 400 milliseconds. Okay, so I would do PWM on the board, not on the website. Yeah. And if I wanted 100 hertz
Starting point is 00:16:59 processing, it would be on the board and then smaller things up to the website. Yeah. So for something like PWM, the idea would be you'd send a message from the agent to the device to say, go do some PWM and the device would do it and then maybe send a message back later on to say that it was done. Okay. That makes a lot of sense. And does the server do iPhone Android push messages? Kind of. So there are services online that sort of manage push messages. It doesn't do it natively. But again, since it can send out web requests, if you can find a service online that will push to an iPhone or an Android from a web point, then you can do that.
Starting point is 00:17:46 Okay. So Etsy makes it pretty easy to write an app to control your Imp-based gadget. Yeah. I know that Lockitron is using Imp. Are you familiar with them? Yes. So we got a Lockitron a few years ago. And what it is, is it goes onto our front door and we use our phones, our iPhones to open and close the lock. And so if we drive away from the
Starting point is 00:18:14 house and the question, which used to happen all the time, did you lock the door? Uh, I'm not sure. Did you lock the door? Now we just pull out a phone and push lock and there's no question anymore. Uh, but that's the old version and Lockatron is coming out with a new version that is imp based and is less dependent on our house having power, which is kind of nice. Um, how did you get involved with them? Um, I'm not sure if I know the exact story for this, actually. So they went through Kickstarter and they launched their initial version. And then I think one of their VCs or somebody ended up hooking up with our CEO and they sort of proposed it as a wireless solution and then ran with it.
Starting point is 00:19:04 I think it's really cool. And that's the kind of thing that if you had asked me years ago what needs to be on the Internet, I might have been one of the person that said, well, my refrigerator could tell me what I'm out of. But I don't think I ever would have thought my front door needs to be on the Internet. But it has made my life easier. One of the really cool things about working at Electric Imp is you get to see all of the really interesting things that people are connecting to the internet. So I remember you mentioned cats a while ago,
Starting point is 00:19:31 that you have some, and there was somebody who just finished an electronic door flap for their cats so that it'll send messages when their cats go inside or outside. I'd want more messages than that. I want to know what my cat's doing all the time. Well, I guess to know what my cat's doing all the time. Well, I guess I know what my cat's doing all the time.
Starting point is 00:19:49 She's hiding, but no one's sleeping. Yeah, I guess sleeping. Accelerometer and Imp, I guess we'll need both of those together to check out the cat. What else uses it? So the only other commercial product on the market right now is the Budweiser Red Light, which is a product that right now is only available in Canada. And it's for sort of hardcore or I guess any kind of hockey fan. So how it works is you buy a red light from Budweiser and they ship it to you. It has a slot for an electric amp.
Starting point is 00:20:23 You download the red light application from the App Store, and then once you blink up your red light, you select who your favorite hockey teams are. And when you're watching a game and the team scores, your red light goes off quite obnoxiously and loudly in your room and flashes a red light to let you know that your team has scored. As though you weren't already watching the game. Yeah.
Starting point is 00:20:48 Well, I guess so. And it's a great example of ambient information. Yeah, it's really good. One of the places where I think they go to quite often is to bars. But I know a few people back home in Canada who definitely have them in their living rooms. But that sounds a little complicated. You buy the red light separately and the imp separately, and then you have to deal with it all yourself. They actually ship everything all together. So they ship the imp with the red light and you just plug it in and then blink it up. And can you commission these if you don't have a smartphone? No, you need a smartphone to commission them.
Starting point is 00:21:26 Although some people, we do have a browser-based version that works somewhat reliably depending on what browser and JavaScript and everything else. All right. All right. But wow, I guess most people have access to a smartphone, even if they don't have one themselves. But that's an interesting way of solving a problem and trying not to limit your audience. Yeah, the whole idea behind doing BlinkUp is you don't need much extra hardware. You need a phone, but like you mentioned, almost everybody has a smartphone. So that's not as big of an issue. And you don't need to buy any specialized hardware that you probably don't have.
Starting point is 00:22:12 And on your website, there's a study or a case study for connecting a scale to the Internet. And I know that there are some people out there who already have them. Wythens and Fitbit both have internet enabled scales. Tell us more about the one you were looking at. So the scale that we built in the office is just sort of, it's a fairly generic purpose scale, I think. Basically, it just lets you hook up your scale and then send information to the net. And from there, you know, you could send it to a fitness service. You could use it to keep
Starting point is 00:22:46 track of how much flour you have or whatever you wanted. Oh, so this is a kitchen scale, not a body weight scale. Yeah. Oh, that's kind of cool. So I hear lately you got a pedometer. Is it internet enabled? No. So I got a Jawbone Up and I've been wearing it for a couple of weeks now. And every night I have to take it off and then plug it into my phone to see all of the data off of it. See, I have a Fitbit. I have the Fitbit One that is Bluetooth low energy to my phone or to my computer and goes up to the internet and I can check my steps online or whatever. That's cool. But that's not the right
Starting point is 00:23:26 form factor for imp. No, it's pretty slim. It's pretty small. And I think the battery in here is pretty tiny as well. Okay, so you weren't about to break that apart and rewire it to an imp? No, I've broken apart a few of my things and hooked it up to imps, but this one I don't really want to. Fair enough. What else do you want to? What else do I want to build with the imp? Yeah. So one of the ones that's been on my list for a while is a coffee machine. I really like the idea of being able to phone my coffee machine. So using a service like Twilio and then it being able to sort of tell me with a voice how old my coffee is and letting me brew new coffee if I wanted to. I seem to recall the first piece of hardware that was on the internet was a Coke machine that somebody didn't want to have to go fill up unless it was empty. Wow. So you were in good company. Yeah, cool. And it does. So it sounds like it's pretty easy to
Starting point is 00:24:32 write an app to control your gadget and because it's web based. But does it provide any other help writing an iPhone or Android gadget? Kind of. So for people who are using Electric Imp in their commercial products, we also provide the SDK for BlinkUp. So when you write your application for whatever device you're building, you can actually integrate BlinkUp right into it. Outside of that, we don't really give, you know, any extra tools or anything else for talking to it. Well, I hope someday you think about a template that's just blink light so that we all have iPhone apps ready to go when we make Imp devices. So commercial things.
Starting point is 00:25:17 You've only got two commercial things right now. Yep. But you're going to have more. There's a partnership? Yeah. So about a month or two ago, we entered into a partnership with a company called Quirky and GE. So GE is opening up a whole bunch of their old patents to Quirky. And Quirky is a company who kind of crowdsources inventions. So how it works is you can go online to the quirky website and say it would be really great if we had x invention and then the community votes on it and if lots of people like your idea then quirky will potentially build it and if quirky ends up building it then people who are
Starting point is 00:25:58 big influencers for the product so people who came up with the idea maybe somebody who named it or found some really good feature will get a cut of the profits. Well, that sounds like an interesting thing to do. I bet the IP is a little strange. But if it's an idea, you want to go that path, it might be worth looking up. Yeah, it's kind of cool because it brings together people who might not otherwise be able to act on really cool ideas. Okay. Well, let's see this dev kit. I think that's enough theory. Let's touch some hardware. Sure. So the first thing we need to do is, so we have our breadboard hooked up,
Starting point is 00:26:38 and the first thing we need to do is give it some power and then get it onto your guys's wireless network? Uh, so we had the hardware hooked up and, uh, I took it all apart. So Matt's going to spend a few minutes, uh, repairing the damage that happens wherever I go, the wanton destruction that is me. Um, but now he's got it all back together. It's a good thing. It's all pretty simple. Um, and he's got a all back together. It's a good thing it's all pretty simple. And he's got a breadboard that has a couple of LEDs on it. And the imp with the April converter board plugged into a little tiny, tiny breadboard. Solderless breadboard. And he's got his phone, which we discussed my internet password with a few minutes ago.
Starting point is 00:27:25 You didn't miss that. It just didn't happen while we were recording. And he's connected to his laptop, and you can... I need to enter it again. I see. Our password's a little too secret. But something was lit a second ago. Yeah.
Starting point is 00:27:49 So there's a status indicator in the electro camp. So if you push it in, um, it's actually not plugged into the socket right now. Okay. Now it's got that satisfying little click. Oh, inside the imp it's, there's a little red light blinking at me. Right. So it's blinking red to tell us that it can't connect to the internet right now. So I've got my electric amp app open and I've entered in the very long wireless password and we're just going to click a button that says send blink up and then hold this up to
Starting point is 00:28:15 the end of the imp. Oh, by the end of the imp, he means the skinny end. I thought it was going to be with that LED. And now it's doing some sort of really scary flashing. Don't look directly at the flashing. I'm sure it's bad for you. It's reprogramming your brain. It's reprogramming my brain. Okay, it's done now. So assuming I entered the Wi-Fi password correctly, which is questionable,
Starting point is 00:28:46 it should go through a series of different colored LED codes and then eventually start flashing green to tell us that it's online. So do you have a tricolor LED in there? Yep, it's an RGB one. Okay. Oh, and on this board, before I was holding it, I could only see the LEDs. But now that I'm holding it, there's a push button as well. I suspect when we push the button, it will go up to the internet and then light an LED for us. Look, the light's blinking green. Right.
Starting point is 00:29:13 So it's blinking green to tell us that it's online. And after a minute or two, it's actually going to stop blinking just to basically save battery life. But it's still going to be online. So it's in our, if we go to the online IDE now, we can see it here under this guy called April 2. That's what the hardware that it's plugged into is called right now. And we're going to start and make a new code module called Hello World. Okay. And you already signed in because you are often signed in. Yes. But this is just a simple account. Yeah. So if we just, it just basically has a, you know, basic login form. When you first log in, it takes you to a screen with a bunch of blocks on it. This is sort of
Starting point is 00:29:59 an old legacy view. And our fancy new stuff is this IDE where we can write code and write things for the server and the device. The little blocks looked kind of like the old Lego's Mindstorm when it was made with blocks. I remember those. Those were cool. And now it looks more like a window that you type into. Yeah. So we have three different windows here. There's one called agent. So this is where we write our server side code. There's one called device. This is where we write our code that runs on the device.
Starting point is 00:30:36 Cleverly named. Down at the bottom, there are these logs. So since I've done a whole bunch of things with this hardware before, there's some logs in here already. So you can see that I've done a bunch of basically printf type statements. There's some red errors where I wrote bad code. And then information like when the imp goes online and offline. But right now we have blank.
Starting point is 00:31:00 Yes. Blank for both agent and device. And I like the idea that you really are programming these at once and that it's two halves of a coin yeah it makes it it kind of changes how you think about writing code when you're writing both of them at the exact same time okay so what are we going to do so uh i guess the the first thing you always do with hardware is just make an led blank so i guess that will be the the first thing that we write so hardware is just make an LED blink. So I guess that will be the first thing that we write. So this is all just going to be on the device.
Starting point is 00:31:28 We don't need anything to go up to the cloud for this. But we know that it's connected, not only because it blinked green at us, but because it can't get to this code unless it can talk to the website, because you're programming into a web browser. Right. We're not going to download this through. We don't have JTAG or any of the other hardware protocols and matt's got it connected to the his usb port but it that's just power and uh the imp is connected to my wi-fi and matt's computer is connected to my Wi-Fi and they are going to talk to a server
Starting point is 00:32:06 that's miles away instead of the three inches that they are actually separated. And let's see, what have you typed here? Okay, so we have, this is just going to be sort of a basic thing to turn on the LED. So we have hardware.pin9.configure and then a constant called digital out. So that just tells us that it's a digital output pin. And then we're just going to write one to it to turn the pin on. So let's see if we can hit run and download the code. And you hit run a lot like you do in Arduino. It's just a run and poof, things happen. Right. Except rather than push it over a USB cable and then program it over serial,
Starting point is 00:32:49 it just sends it over Wi-Fi. I was hoping that as we had that discussion, I could say, and look, the light's on, but the light is not in fact on. I have this effect around hardware. I have to admit it. It's been a lifelong curse. Once I touch the hardware, it breaks.
Starting point is 00:33:08 This is great for being an embedded software engineer because if it's going to break, it's going to break for me. I've never been one of those people who give my system to somebody else and it breaks. No, no, no. It breaks for me immediately. Now we have a light.
Starting point is 00:33:24 Yay. there we go so i had i had a bit of a syntax error um and forgot forgot how to turn an led on so that's kind of embarrassing but so we just clicked a button um and we sent it some code and it turned the the led on pin 9 on and you know from here we took we blink it and then we turn the other one on, and then we can read the switch and make whichever one's on based on the switch. And this is hello world in embedded systems land. Exactly. And so you made a syntax error. How do I learn this well enough not to be a complete doofus?
Starting point is 00:34:02 How do I really get started with this? So we have a few different resources for new developers. We have a fairly extensive sort of developers wiki and it has all of the different API calls that you can make in it. It has lots of example code and it's a good place to get started. And then we also have a fairly strong forums community
Starting point is 00:34:23 where there's tons of people who are really welcoming, like to help people debug their code, debug their hardware. So those are sort of the two big resources for finding examples and getting started right now. This is super cool as a hobbyist, and I can totally see where I could go from here. But as an engineer at a company, a big company, how do I get engaged to actually do this for a larger product? How do I program 100 of these units? How do I, it seems very much one thing at a time, but if I want to do production?
Starting point is 00:34:59 Yeah, so we have a few different things that go into actual production type devices. So one of them, we basically have sort of blink all of them up initially, download the code, and then sort of bind it to the software that you want to run on it so that other developers can't really come in and sort of hijack the code. So once it's got the code on it, one of the sort of added benefits of having this network connected device going through your production line is you can track it as it goes down the line if you want well that part seems cool but i think i want to back up just a little bit um when we were offline uh we talked about cameras and you have hooked one of these up to a spy or i squared c camera uh in order to download data from the camera. Yep.
Starting point is 00:36:09 Let's say I was Kodak, so a nice big company, and I was doing those throwaway cameras. And I was willing to pay for an imp to go into my camera so that all of my throwaway cameras were Wi-Fi enabled. Okay. I would make my camera bit. I would have code that would run on the electric imp that would be able to upload all that. And I could do this as an engineer in my office.
Starting point is 00:36:32 And then when I went to go produce it, I would do what? In terms of engaging with imp or getting the hardware built? Well, let's say imp is already engaged and hardware is already built and we've already decided we're going to make billions with this plan. But the blink up. So that means in my factory I have to have phones to program all of my new cameras coming out? So one of the things that you can do in a factory is you can actually have one imp blink up another imp just sort of over the pins or Wi-Fi. So it doesn't need to actually be
Starting point is 00:37:12 a phone that's blinking them up. Oh, that's kind of cool. Okay. So you get this sort of one master factory imp, which has the code that you want to run. The programmer. The programmer, yeah. And then it basically hooks up to all of the other imps and programs them. Okay. And then all of my imps are programmed with my code. And I don't want other people to be able to come and hack these. Although Codex had good luck with that in the past. But we'll assume I don't want, I want to be able to lock it. Sure. And you said that's possible? Yes. So part of the process for the factory process is we basically, you know, kind of bind each device that you bring online to the application that you've created. And how is my code protected?
Starting point is 00:38:00 I, so let's say I want super secret code and I don't necessarily want Imp to be able to copy my super duper camera idea. Sure. So we actually don't access anybody's code unless we've been given permission by the customer or sort of all of the legal things with if it's with a court order or whatever else. Yeah. The NSA is listening right now. Yeah. Okay, but it can't encrypt it because it is interpreted. Yes, but everything that goes back and forth between the AMP and our servers is all encrypted. Can the server side be hosted by my company instead of yours?
Starting point is 00:38:41 It can't. One of the things that we've decided is that, at least for the foreseeable future, we're going to be the only people hosting the the imp cloud. And that simplifies a lot of things. It does. But it makes paranoid people paranoid. Yeah. So I mean, it really comes down to a trade off where we do a lot of the we manage all of the server maintenance, we manage all of the uptime, we manage sort of all of the difficult bits of running a server. And the downside is that we're running a server if you want to be running your own.
Starting point is 00:39:14 Okay. Um, and, and so as part of what I pay for when I buy an imp is this server side. Yeah. So as a, just sort of as a hobby developer, um, all of the services are free. If you're building a commercial device, then we charge a fee for connected devices. Oh, okay. And presumably you discount your hardware a little bit. You know, if I'm buying a thousand of them, they probably aren't 25 or 30 each. There's bulk pricing. And when you get up into many thousands, it goes down to close to $10. Okay. So, so as an engineer at a company and I don't work for Kodak, but just as an engineer at a company, um, what else would I use instead ofMP? I mean, there's the server side and the hardware side, and now we have to value those kind of separately. Yeah, so there's a lot of solutions out there right now for Internet of Things type hardware. The thing that really makes
Starting point is 00:40:22 us stand out right now is that we have sort of this end-to-end platform all the way from hardware up to the server. So there's a lot of different hardware companies out there that are doing really cool things, but they're aimed somewhat differently than this sort of full platform. You're making it easier to connect things to the internet. Yeah, that's the whole idea. And it sounds like overall, because of the server side, this is a little easier for a do-it-yourselfer than Arduino with an Arduino Wi-Fi shield. Yeah. Around the time that I started playing around with ElectricAmp, I was also playing arduino and trying to connect it to the internet and i started playing with the electric amp and it just like blew me away with how simple it was i have a wi-fi enabled christmas lights that i built with an arduino and a wi-fi shield the with the hd wireless chip and it wasn't so bad but i am kind of thinking it would be fun to try that with the Imp.
Starting point is 00:41:27 Yeah, I guess I don't really come from a hardware, nitty-gritty, really low-level programming type background, so dealing with sort of all of the things you have to do for the Wi-Fi shield turned me off a little bit. But we've actually hacked lots of different kinds of Christmas lights in our office, and it's pretty fun. And with the nitty-gritty details, do you mean having to do the serial communications or the protocol they have or the hardware pieces? All of them. Fair enough. Fair enough. up and uh and going back to being in a big company ten dollars for these chips is not too bad for a cortex m3 and a broadcom chip it's not what you could get if you were buying them on your own i said broadcom as though you all knew that broadcom was in there but if you'd torn it apart
Starting point is 00:42:18 you'd know there is a broadcom chip down there but most of the time when you're building your own sort of Wi-Fi enabled thing, you have to have an RTOS as well, a real-time operating system, in order to handle the IP stack. Yeah. Because that Wi-Fi module doesn't usually do that for you. It provides a lower level integration. Let's see, what else would you, what else do you compete with?
Starting point is 00:42:49 So one of the ones that came out really recently was SparkCore. So SparkCore is doing something fairly similar. They're a Kickstarter and they had fairly wild success. So I'm really excited to see what happens with them. As a user, I really don't mind if there's a fair amount of traffic on here. I want there to be lots of stuff to try. Yeah, absolutely. And you know, every time sort of a new platform comes out,
Starting point is 00:43:19 it just makes it so that the Internet of Things gets pushed forward a little bit more. And that's sort of what we're all about. I'm not sure about that phrase. It's like hover cars to me. The Internet of Things has been coming for so long. Yeah. I'm sick of hearing about it. When everybody's using the Internet of Things just as a buzzword right now as well.
Starting point is 00:43:43 Well, Bluetooth Low Energy, Zigbee, all of the little protocols get called the Internet, but they aren't. Yeah, it's all connected, but it's not necessarily to the internet as we know it. Wow, SparkCore did really well on Kickstarter. They got a half million dollars when they were looking only for 10K. Someday I'm going to talk to somebody about how Kickstarter works and whether or not it's really a good thing. One of the other things that I think is a big competitor is Bluetooth low energy. Apple had those nifty, nifty cars at their keynote and it just connects to your phone. There's no server, there's no cloud. You don't have to go up and there and back and the Wi-Fi connectivity is easier. Where do you see Bluetooth low energy
Starting point is 00:44:22 being better and where do you see it being worse than the Imp? So Bluetooth Low Energy is, you know, it's another one that's really, really cool. And it's going to start coming up a lot more, I think. The Imp is really designed for applications where you know there's going to be a sort of solid Wi-Fi connection and you're sort of expecting your device to probably always be there. And then where you sort of want to-Fi connection and you're sort of expecting your device to probably always be there and then where you sort of want to just talk directly to the internet. Bluetooth low energy from everything I've seen from what I understood it seems like it's going to be really really good for connecting different devices together and getting them to talk but if
Starting point is 00:45:02 I understand everything right you still sort of need some central hub if you want it to go up to the net, whether that's your phone or some kind of gateway router or something else. Yeah, yeah. It's whether or not you want it to be connected to everything or whether you want it to be connected locally. Right.
Starting point is 00:45:19 And if you go with Bluetooth Low Energy, local is easy, but getting it up to the net is a whole new set of challenges. Yeah. So Electric Imp was at Maker Faire a couple weeks ago. We were. In San Mateo. What was that like? A madhouse. A zoo? A zoo. It was incredible. I've never been to a Maker Faire before. So going to the Bay Area Maker Faire for the first time was a pretty incredible experience. We had hundreds or probably more
Starting point is 00:45:53 likely thousands of people come by our booth and talk to us. Everybody from sort of families with their kids who were just walking around the expo hall to hackers and kids who were just, you know, walking around the expo hall to, you know, hackers and makers who were really, really excited. And we saw some really good traction and it was a lot of fun. Did you see anything else in Maker Faire that was already using an imp? There was one, but I can't remember what it was, which is really awful. You think next time maybe note it down. Yeah. Well, actually somebody just came by our booth and was like, Oh, you know, there was somebody, somebody at another booth who was using the electric amp and they said they should come check us out. Oh yeah. Yeah. I'm really,
Starting point is 00:46:37 I like hearing about the applications. Yeah. And, uh, I think next year there'll be a lot more of electric amp devices at Maker Faire and other do-it-yourself sorts of fairs that are springing up. Yeah, we're starting to see more and more projects on Kickstarter and sort of more and more people taking to the idea of using the electric amp. So when we were when we are at Maker Faire, we were actually giving out T-shirts to anybody who came by with something they had built with an amp. So we had people come by who had built, you know, sprinkler control systems, a control system for a smoker. There were lots and lots of different cool applications. It sounds like you've been pretty busy. Very busy. And I hear Electric Imp is hiring? We are hiring. So we're growing very quickly and we're always looking for cool new people for sort of all of the different positions. So, you know,
Starting point is 00:47:33 software people, hardware people all across the board. So firmware and cloud software. Yeah. Very cool. How do people get in touch with you? So we have on our website, there's a button that will give you all of the job listings. All right. And that's electricimp.com. That's right. Well, I think it is time for me to connect something to the internet. And I don't think the cat will come out until you leave. So we're going to have to wrap this up before I can really get started.
Starting point is 00:48:03 Thank you so much for joining me. Thanks for having me and have fun connecting everything. That's your tagline, right? Connect everything? Yeah. Please leave comments about the show at Embedded.fm or show at MakingEmbeddedSystems.com. Or if you like the show, review it on iTunes, please. And you can reach Matt on Twitter as well, at Bearded Inventor.
Starting point is 00:48:25 Yep. Check out Electric Gimp or apply for a job there at their website. You can pick up a dev kit on SparkFun, Adafruit, or any other such amazing sites. Finally, thanks to our producer, the wizard, Chris White. As usual, if we sound good, it is due to his efforts. And if I sound like an idiot, it was all me.

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