Few seats left for our Advanced Backstage Plugin Development workshop on December 7th. Secure your seat today!
In this episode, we talk about IoT: what’s coming, why we’re intrigued, and how we’ve already started it incorporating it in our office. In the next episodes to come, we will be having guests on the show to take a deeper dive into this technology. If you have any suggestions or know people we should reach out to, please get in touch!
CHARLES: Hello, everybody and welcome to The Frontside Podcast, Episode #77. My name is Charles Lowell, a developer here at The Frontside and your podcast host-in-training. Today, I have with me two other developers here at The Frontside. This is going to be a Frontside-only podcast and we're going to be introducing a topic that hopefully we're going to be podcasting a lot about in the coming weeks and months just because it's something that's kind of grabbed the interest of the office and seems like it's something that needs to be talked about.
Hello Joe and hello Elrick.
JOE: Hello, Charles.
ELRICK: Hey, what's going on?
CHARLES: Everything, really. Today we're going to be talking about the Internet of Things and we'll be talking a little bit about how we came to be interested in this topic and why we think this topic is important. Let's talk about why this topic is important. I think that this is a very important topic because IoT is only becoming more and more prevalent. It's emerging from the status of being this niche or boutique or very esoteric technology that's only worked on by a very small group of people to becoming very, very open and available and accessible so that anybody can buy a Raspberry Pi or an ODROID or Arduino and slap some Linux on there and connect it over the internet to a bunch of different things and the space of creative possibilities is just exploding.
For me, it's very similar to where we were in the early 80s. You know, I see these IoT devices as being the hobbyist's computers, the Z80, Apple IIe, the Commodore 64 and that the people who are hacking on those things 30 years ago are going to be the people who are now leading the tech space today. I think another big and relevant analogy is web technologies. There was this inflection point where web technologies became very open, accessible, available and the people who were in it ended up being able to ride that wave for 10 years to where we are now.
In both of those examples, we had the hardware and the PC revolution where the computation was distributed across a bunch of these different devices. Then over that time, we saw a migration over to the cloud and these web technologies where everything was centralized. Now, I actually think that there's a pendulum swinging back where we're actually going to see more and more computation distributed amongst physical devices, except this time, it's not going to be manifest as a PC. It's going to be manifest as these networks of devices that are just all around us.
I really do think that we are on one of those watershed moments where these distributed networks of tiny devices are going to be the big next platform that when you invest in it now, this is something that's going to yield dividends for the next 20 years. I think it's an important topic but I don't think we had a well-crafted thought about it but we just kind of stumbled into the space.
I was thinking we could start a little bit by talking about how we got into this and how it captured our imagination. If you rewind the clock to the stone age of 2015, I think it was the end of 2015 and it was Christmas break, that's often a time when people go and they hack on individual projects and Brandon, his project that for whatever reason, he decided to take on was he was really into Hue Bulbs at the time. We had Hue Bulbs around the office and we wired up some demos to control them from a website. He decided he wanted to take those Hue Bulbs and make them so they were accessible from our Slack.
He built a server in Elixir because he also wanted to learn Elixir because if you're having fun in hacking around, it might as well pick up as many new things as you can. He built an API in Elixir that talk directly to the Hue Bulbs and the Slack integration that talk to the Elixir API and we actually are able to control all of our lights purely from Slack. We could turn them all on, we could turn them all off. That was great but then as we began to use it, we were wishing that we had control over our lights from our phones. We wish we had control over them through the website. I think, Elrick, isn't that was your first contact with the Frontside, wasn't it?
ELRICK: Yes. That was my first contact with the Frontside. I was working on the lights app. I initially started working on just the user interface and bringing some different animations and working on the actual experience and the user story on that side about controlling the lights and what particular things you needed to do in trying to craft a UI around that. That's what I initially started.
CHARLES: That was really fun.
ELRICK: Yeah, that was really fun. That just started progressing more and more. As you said as we started to think about how could we access these lights from different places, using different devices and then that's how we stumbled into the Internet of Things.
CHARLES: And it turns out, there's actually a lot of tech in the form of platforms out there that have been developed to help with this, although I would say that the water are still pretty murky as to kind of the best set of patterns to follow.
JOE: That's hard to find information, especially with regard to design patterns. Since we've been working on this light thing, there's been so many times I've Googled and looking for prior art and found none or next to none. It's very much the Wild West.
ELRICK: Yeah, because it's like going from a point where you're controlling one piece of data per se, like you have one sensor that does one thing. Now, it's starting to grow until you can have one sensor that can do multiple things and send it across different types of data and then how do you structure that data, how you capture it, how do you hold that state somewhere and it's one to one source of truth. It's just going to be the Wild West of how do you manage this, how do you structure it. It is definitely growing and changing constantly.
CHARLES: I think one thing that is difficult is it feels very much like they're aligned in terms of silos. For example, the Hue has the Hue Bridge, which is capable of talking to the light bulbs and then they also have an API which is under development by which you can connect publicly to servers hosted by Philips to talk to the hues inside your office but if you want to integrate your Hue API like we did with Slack or with your iPhone or maybe some other device that you're trying to control, it becomes a little bit more difficult.
You have all these vendors like Nest, MyQ and there's a whole bunch of lines like doorbells and smart this and that and everything and they're very good at talking. They have an ecosystem, this large vertical ecosystem, assigned with each one but actually getting cross cutting communication is a problem that I think is something that we've had to deal with and it's very, very difficult where we want to start having these devices talking to each other.
ELRICK: Yeah, that area right there is ripe for innovation. I don't know the names off the top of my head but I know that there are people trying to make a smart hub per se. You can think of it like Jarvis from Iron Man. You buy that thing, you put it down in your house, you tell it all the devices you have and that takes care of all the communication between everything. There's definitely an area there that someone can step in and say, "You know what? I figured it out and here's your Jarvis Box."
JOE: We're starting to see stuff like that with Alexa and Google has something similar. That's a little scary to me. I think that the one thing that needs to be made clear is when you're talking about these silos, it's a very good point because we think they're decentralized. We think these things are decentralized but in a way, they're not yet. We don't have peer-to-peer communication necessarily like Hue. They're going to public API but you're going through their ecosystem. You're passing through their lens, so to speak. We think Slack has distributed teams but there's a centralized server where those messages passed through so how do we break from that into full decentralization?
CHARLES: Right, I know that's –
ELRICK: The Jarvis Box. You could probably have a server at your house that keeps all your data there and then it spits out what it needs to spit out to the IoT server somewhere if they're doing some collection. When you leave your house, to say, "I need that information to come back to my cell phone now." Maybe in the future, you'll be able to control that, either from your house or just send out the pieces of data that you need and the centralized stuff, you can just keep at your house.
CHARLES: The whole question of ownership is one that I feel is something that we have not addressed head on. Everybody is just rushing forward with how do I implement this, how do I get it done and it definitely is worth taking a step back and understanding who owns the things that I'm working with and that I'm inviting into my home. I think that smartphones provide a great example of how it can work really well for the consumer.
I think certainly, in their inception I think this is mostly true if you have an iPhone. Most Android devices, you actually own that piece of hardware and the things that you install on it are very much controlled by you. I think that Apple especially, gets a big shout out for making sure and putting in those safeguards so that anyone who's participating in the ecosystem has to first acknowledge that the data is going to be owned by the user. I think that's maybe a little bit less true than it was back in 2009 or whatever but I think that there's definitely a lot of thought that went into that upfront, that I worry isn't going into with Alexa.
Is Amazon protecting? Is there an understanding that if you're participating in that ecosystem that ultimately, the thing is owned by me? I feel the same way about a lot of these AI and robots where it may participate in the conversation but who is it really serving? Is it serving you or is it a proxy to serve somebody else like a Google or an Apple or an Amazon?
JOE: I may just be a pessimist but I think it's safe to say that it's almost always the latter when money is involve.
ELRICK: They had some situations arise where the powers that maybe we're trying to get the actual recordings and different things as Alexa is always on. Let me turn mine off because she's going to say, "Oh, did you ask me for something?" I have one sitting right here in front of me. They have been in situations where people had said, "Because that's constantly recording and that recording is going somewhere," and then if situations have arisen, they said, "We want that recording," and then Amazon is like, "No. We're not going to give you that recording because that is private information."
They're trying to find a way to get around that and what laws and things are going to come out of this area that we're in right now, it's still unforeseen. But I think that companies that are in this space, know that the future of their company rests on them protecting that data and user data because if you don't, then people will sidestep and go elsewhere.
CHARLES: Right. In so far, they hold that as a value. In so far, people are conscious of those concerns. If that's something that people are willing to pay money for, then you've got a market driving force pushing you in that direction. But if people don't care, they don't think and they're just like, "Whatever. It's cool," that's not going to be something that a business is going to roll into their product because ultimately, if people care, then it'll affect their bottom line. If they don't but it won't and they're going to act in their own best interest.
CHARLES: I do worry that there needs to be a social awareness of what kind of powers these devices actually will end up having over our lives and hopefully, those will guide it but you're absolutely right.
ELRICK: True. I view all of this IoT stuff and data is not too far off of what people do on Instagram per se like you have your pictures, you can either post crazy pictures or you can post casual pictures. How you use the power that these IoT devices are giving you is essentially falls into your hands like what am I going to send across this thing. I think that hopefully, the power falls into the user's hands and they empower people with these devices and not make them feel like a prisoner in their own home or car because this IoT things are popping up in vehicles now.
If you step into your car, you start talking and your car is listening. If they go from it like the same way we approach our applications and such and say, we're going to empower the user, I think if these IoT companies take that approach and learn from the mistakes that were made in software by not empowering users, then after a couple years they're like, "Oh, my goodness. We need to empower the user." When Steve Jobs was preaching about this in the 80s and everybody thought he was crazy. Don’t fall into our mistakes. Empower the users and I think that this technology in this space would just keep flourishing if they do that.
CHARLES: Absolutely but it is going to take a generation of engineers to make sure they're always pushing in that direction, a generation of users who don't just wait for companies to hand power to them but demand it.
ELRICK: Demand it, yes.
CHARLES: Yeah, demand it and a generation of business owners who are going to listen and think about the long game and realize that that's the path to long term health and viability.
ELRICK: Yep, even outside of the whole privacy thing where it's like there's too much data being sent out. People are building just cool stuff with IoT that doesn't really send that much data outside of normally that we do. Even on our phone, people use GPS all the time and that is sending data about all your locations, where you are, what restaurant you're at, what bus stop you're at, what bus you're on, what plane you're on and people are building a lot of cool things, just even using that.
I saw the other day that someone had a bicycle, it has GPS and lights and gyroscopes and all kinds of stuff in that bicycle. When you're riding, the lights will go off and say, "It's time for you to take a right." It will blink in a certain sequence or take a left. It register your speed and it all comes back to your phone so it's not too outside of the norm of what we do on a regular day. There's people building things just in that sweet spot per se with these IoT devices that are building some pretty cool stuff.
JOE: It's a very good point because Slack doesn't have to be centralized. It can be peer-to-peer. Hue doesn't have to be centralized outside of having a bridge on your local network. We don't really need to be phoning home for all of this stuff and if we move towards like a true decentralization, we don't need trust at that point. A company has our best interests at heart if we think about it as your trust ideal to remove the need for involving third party in the first place.
CHARLES: Yeah, so what would that look like? I'm going to fast forward a little bit because we were a little bit further along on our journey and we've been experimenting with Amazon IoT services and we've been maintaining our own APIs to control our Hues directly. While they're still going through the bridge, it's not incorporating any other ecosystem but we are still routing all of this stuff through this low level Amazon infrastructure. There's a class of problems that that solves which it does help to have those primitives to be able to access your IoT devices through a firewall, to have them and be able to, at least have a known way to update themselves and distribute software to them.
There’s these fundamental infrastructural problems but at the same time, Amazon doesn't have any access to that data that's moving through their land, so to speak. What they're essentially doing is leasing you a railroad but they don't have new visibility into what's contained inside the cars.
JOE: Do you know that?
CHARLES: I actually don't know that because of course, it's through the Terms of Service.
ELRICK: Who reads EULAs? They're too long.
JOE: I think it's more often than not, people are going to use convenience over privacy.
CHARLES: That's true so it is in keeping with what I understand of other Amazon services, which do have those guarantees. I don't know in particular for the Amazon IoT. But let's talk about that a little bit. Let's talk about a little bit about our setup and why we went to using Amazon IoT services and what it provides for us.
ELRICK: We decided to use the Amazon IoT platform as a means to allow us to one control the bulbs from anywhere, to get access to them and then also to be able to distribute that change to anything we want. Coming through IoT or coming through their platform, when a change happens, you don't necessarily just have to send it to our one set of bulbs. You can send it to anything you want. You can send it to a phone, to another application somewhere, to a database. It gives you the ability and the flexibility to distribute that change or that state change anywhere.
CHARLES: Which is I guess getting at the heart of it is actually managing this distributed state beast of a problem and really, the AWS IoT just helps you get your foot in the door. There are still a lot of cans of worms that are involved once you get there but for the first point that you have said, I want to unpack that a little bit because it's a problem very familiar to us but might not be to the listeners, you've got the set of devices and they come up, they connect to your Wi-Fi and that's fantastic and they can talk to other things on your Wi-Fi, on your local network and can discover services there. But what if you want to control them from outside like I want to send a message from Slack and have it affect the lights in our office. You've got to move through some public cloud to do that because Slack servers are not on our local area network.
What you can do then is have essentially one thing that the IoT services provides is your device comes online and it immediately calls home to a generic location and opens up, what is in practice a web socket. You can program in whatever language you want but that's probably the analogy that's most familiar to everyone. It basically connects a web socket that then you can send messages to it in real time so any time I want to connect to that, I can do it and I don't need Hue's API. I don't need Slack's API. I can just talk to one API which is the low level Amazon -- AWS IoT API -- and I can send real time messages to my devices. That's a huge problem solved right there. But it's hard to maintain that infrastructure yourself. We could write our own AWS IoT but then we'd probably host it on AWS anyway.
JOE: The real world is not a JSON Blob. That becomes a problem. In college, I took a course where we programmed robots for the majority of it and what you quickly find out is that you can't count on revolutions of a wheel or what have you. The world is imperfect. Keeping a state is one thing but keeping state reflected back and keeping state up to date is where the challenge has been for us.
CHARLES: That is right because you've got this highly distributed systems. That's kind of a second class of problems that it attempts to solve for you. You got these highly distributed set of devices but even if the connections are 99.9% reliable, sometimes they're highly latent. You can't control the latency on the connection and sometimes, it fails altogether, which can affect one, how do I even read state from these things. Is the button pressed? Is the button not pressed? Is the light on? Is it off? Is the wheel spinning like you said? Or is it off?
These are things that you need to know and then you need to react to those changes like, "We're spinning at 90 RPM. I want to bump it up to 10. How do I get my system to converge on that desired state based on my current state?" It's hard because you don't know all of the demons of distributed state management are in full like they have ripped off their masks and they're roaming about.
ELRICK: Yep. I saw them introduced something the other day but I haven't had time to dive too deep into it. It was something called Greengrass that it will continue to gather and allow you to utilize your devices locally and it will keep all that data and then it will do the diffing, let's say when you connect back online until what your old state was and what the new state is and then go about updating everything.
JOE: That could be very useful.
ELRICK: Yeah. It just got implemented probably three weeks ago or something like that. It's inside of the IoT platform. I just clicked in and they said, "We have a new feature now called Greengrass," but I haven't got time to dive too deep into it but like you were saying, state management is something that's extremely difficult, especially across a distributed systems. They know it's a problem and it seem to be addressing that problem and trying to make it simpler for people and give you these tools to say, "Here are some stuff that you can leverage," and a lot of that is great.
CHARLES: I think that's an excellent point and I think that it's also worth mentioning too that there's two sets of state that you have to manage. There's the runtime state, which controls the flow of data as your system operates. Then there's the static state of just what is the code that's going to run on this device. Let's say, my robot or my button that's got V1 of the software, that all it does when I push it, it rings a bell. That's V1. I want to add this awesome feature to this button that when I push it, it rings a bell and it also pops open a Topo Chico from the refrigerator or something like that.
The question is how do I get that software from my laptop with that Topo Chico enhancement all the way to my button, which is what essentially amounts to being across the internet inside this private network. In the current state or when you're first starting out hacking, let's say this is based on a Raspberry Pi, I just burn a new Raspberry Pi image with my new software with V2. I walked over and I stick it into the Raspberry Pi and that doesn't really cut it. That does a great job but now, I want to turn this into a business and I want to have 20,000 of these things installed or let's think big like every home in America gets one. Every home in the planet, I want two billion of these type of devices. What happens when I come out with V3?
ELRICK: Then you can either go the route of hiring --
CHARLES: Hiring a favor.
ELRICK: -- Technical folks to go out, to update all your Topo Chico poppers or have your users struggle to do it or what we did, implement Resin. Let Resin update your Topo Chico poppers around the world.
CHARLES: Right. There are a lot of problems in terms of static state management, runtime state management, peer-to-peer communication and problems of resiliency and robustness. I'm hoping that we can discuss these over the coming weeks and months because each one is a topic in of itself.
ELRICK: And offline management too.
CHARLES: And offline management too, there you go. There's another one. There's a lot to explore, a lot that's unknown and there might be people who have answers to all of these and there might be papers on them but they're buried in weird corners of the internet. I'm hoping that we can fill the podcast with a couple of guests to come in and talk about these different things.
ELRICK: Yeah, that would be fantastic.
CHARLES: Yeah, I'm really looking forward to it.
ELRICK: I started playing around with Watson IoT. It is an IoT service that allows you to leverage the natural language processing and computing from Watson. It's pretty awesome.
CHARLES: Wow, that is really cool.
ELRICK: That's another space of IoT that we can explore and hopefully, we can explore over the next few podcasts.
CHARLES: Yeah, awesome you all. Well, I think that's about it for this episode. Thank you, Joe.
JOE: Thank you, Charles.
CHARLES: Thank you, Elrick.
ELRICK: Thank you, Charles. It was fantastic.
CHARLES: And I look forward to hacking on the lights with you guys. That is always one of my favorite things to hack on. I don't get to do it enough but I think we're going to try and have a big throw down on state management on Friday, right?
ELRICK: Oh, yeah.
CHARLES: It is going to be exciting. It's going to be super nerdy and we'll let you all know what the outcome of that is. See you all next week. As always, please don't hesitate to get in touch with us. You can get us on Twitter at @Frontside or send an email to Contact@Frontside.io. We always love to hear from our listeners. Take care!