 All right. Awesome. All right. Well, um, I'm here to talk about my smart serverless cat detection system Now's your time to leave if you don't want to hear about cat detection systems It's your last chance All right, so this is me Linda Nichols. I am at Linda Lou all over the internet get hub Twitter Twitter is the best way to reach me Gmail So I work at merging technology advisors we're a consulting firm outside of DC and It's the greatest place to work. I love my co-workers. I'm not just saying this because it's being recorded But I do actually like them a whole lot just like JavaScript and of course cats. I Also love the community and I do a lot in my community in Norfolk, Virginia So I run the Norfolk J s JavaScript user group Node bot stay Norfolk that will be at the end of July node bot stay as an international event So there may be one in your city We also love revolution conf which just happened at the beginning of June I was one of the primary organizers of that that was a really great time And I have a lot of empathy for the organizers of this conference now And I try to really be a low-maintenance speaker for that reason Also, you know penguins yay Stanley Cup had to throw that in there All right, so let's get back to cat detection systems So why did I make a cat detection system and if you have cats you will know it's because they're jerks and When you're sleeping at night, they are doing all kinds of things and you may need to know if That thing that was broken was your cat or a significant other or your child. It was probably your cat So I made a system that When a cat is detected it will text me but not just anything has to be a cat Because it's smart and serverless like I said before So This is the cat detection system Which you can't really see that well from here And I don't really want to pop it open because that's really tempting fade on the demo that I want to do later But there is a Raspberry Pi inside of here And a camera. I've got a picture of this coming up, too This little globe here is a PIR sensor if you're not familiar But basically this is the motion detector and then the camera. There's a little hole right here that For the camera. So basically it detects motion immediately takes a picture And inside there's some lead wires for a power source I mean I've been using like these little cool things I get free at tech conferences This is great. So I don't plug anything into the wall. I just use these things And these batteries are getting bigger and a lot cheaper. So yeah, this is what the inside looks like So you can trust me that it's in here and I'm using a Pi, but I've also done something similar with a tessel since I'm using Node.js But really any internet connected device you can do something similar And so since the Pi in here is just like a little computer I'm running Node.js on the Pi. I'm running and then I have Johnny 5 and the Watson IoT SDK Running on Node. I'm gonna get to Johnny 5 in a second But the IoT SDK is what allows the Pi to send messages to the IoT platform So yeah, there's Johnny 5 But also this is Johnny 5. So So Johnny 5 actually running on Node allows My Pi to be able to access my PIR sensor in my camera. So with that I'm using the Raspberry Pi IO to be able to to access those two really doesn't have anything to do with Reaching the IoT platform. It's just to access the other hardware that's in here As anyone in here used Johnny 5 familiar with Johnny 5 Yeah, it's it's very cool if you're looking to do anything in Node Robotics Look at their their documentation. They also have some of the best documentation of maybe any Node module in a great community Okay, so what's IoT platform? So this is it. So you have to read that whole message to understand what it is or not So yeah, it's a pub sub system for devices this device publishes data other devices subscribe to that data and The devices never have to talk directly to one another So and when I say devices I have a little asterisk there because a device doesn't have to be this Pi a device can also be My computer. It's anything that can really push data up to this IoT platform And like I said here, too, I mean it can support billions of devices. So I could have cat detectors All over the world. They're all connected to IoT platform It's totally cool with that. It does not affect performance at all It's extremely powerful and each one of those devices is sending trillions of messages So, yeah, that's a lot. It's a lot of cat detections and it's a lot of cats doing bad things So the device when the the Pi connects to IoT platform It's sending those devices in this MQTT format. This is super lightweight message Q format And it's very very fast and it's very very secure Also, once it gets up once the data gets up to the IoT platform, there's a Rules engine that can then decide where it wants to route those messages that you sent. So really My Raspberry Pi itself is not it does not have very much code on it at all The code that's on there just says hey something was detected Upload that photo and send this data out to IoT. It doesn't do anything smart. It doesn't do anything serverless. It's just being a robot So this is a terrible terrible diagram, so don't try to read this But this was sort of the best diagram I could find us to kind of show what it does with My device being on top MQTT being on the right the platform is in the middle and I'm kind of showing that once it gets into this device gateway And I have my rules firing that basically these detections can go anywhere. I can go to OpenWISC Anywhere inside of Bluemix once I'm there or I can even Do a web hook and just put in a URL to some sort of API have somewhere else. So it's really powerful for Using you know if you're already on IBM Bluemix then this is a great way to tie an IoT device to an existing application So Yeah, I thought this was serverless And I just talked about a bunch of servers But that's because serverless is like a made-up marketing term So I'm going to use it again here so So the serverless part of my project is OpenWISC and It's the serverless cloud platform, but basically it allows you to write functions You store them in the cloud and then you're able to access them with events And so maybe that event is an API gateway Maybe you want to hit API maybe that event is you've as a database record Maybe it's a file upload, but it's many many events happening within Bluemix Can trigger these OpenWISC functions and they're very very tiny and and really I Don't have to worry about any of the DevOps to create them I just put my function in OpenWISC and then I roll out and I'm okay. I don't have to know anything about containers I don't have to know anything about like what it takes to host an application because it's just this tiny piece of code And I don't really want to bother with all that And so it's very cheap too, and so if you're making something like a cat detector I'm not this this cat detector is not being marketed Okay, so I kind of just looking for something super inexpensive from making these fun projects So I haven't paid anything for this yet, and I've been testing this a Whole lot because I'm demoing it in front of all of you people And I've paid nothing so it's great also like I mentioned before IoT platform is supporting these billions of cat detectors all over the world because of course everyone is seeing this project and like Right now and they're all making one and hitting IoT platform But and they can hit the same OpenWISC function and it doesn't matter because super scalable I'm not worrying about the DevOps Someone else who works at IBM who is awesome is like worrying about making sure that this function continues to work Also, I use Node.js I'm using Node.js in this project, but I don't have to I could use basically anything for this code that I'm storing in OpenWISC So OpenWISC is calling a few APIs for me, and it's doing like a little bit of work But if I want to use Node or Swift I can just use it right out of the box just as it exists and in Bluemix if I want to use something like Cobalt I just I write my cobalt code that does the things I want to do and then I wrap it in a docker container And then I upload it and for right now too. That's really powerful because you know There's other of course serverless offerings out there like Lambda. Lambda is great too But I can't make my own container and upload it I have to depend on what already exists and if you work for a company that's not okay with black magic Then you're gonna need something that's open source and that you have a little bit of control over And yeah, you can actually run cobalt and OpenWISC it exists. Someone has done it. Yeah, right? Okay, so this is kind of what this is not my code for the the cat detector My code is out there, but I'm just I'm showing though. This is a real module called cat names if you want a random name for your cat But this is how small an OpenWISC handler can be and I can create an API gateway within OpenWISC and I don't have to like I don't have to make an express server I don't have to make a happy server. I don't have to install Node I have no like I know this is node 6 because I told OpenWISC. I want to run a node 6 and that's that's kind of it So yeah, feel free to copy this and run it All right, so All right, so there's no server Well, there is a server, but we're saying there's not a server because marketing. It's okay. It's cool So this is what makes it smart My cat detector is smarter than Ken Jennings. We know that because we we saw it on have it on Jeopardy So I'm using Watson vision recognition APIs It's they're very easy to use you can use them straight out of the box Which is what I'm doing because I'm saying cat or no cat But I can't actually train my own module my own models if I want to I could train it to know only my cats And then I know which one of my cats is being the biggest jerk in the middle of the night But for now we're okay with cat or no cat because we're saying cat or significant other Who like who spilled the water on the on the counter? It was probably a cat All right, so this is what it looks like I I take the the motion detector Fires off it takes a photo of the cat It's uploaded Watson then analyzes this image And this is what you get back Which is which is Jason and we and it goes through like this one says it's a 83% chance This is a domestic cat and and it's correct It's it's the cat and a feline and a mammal and says what color it is Out of the box you can get some really weird Things back depending on the picture you upload because Watson is really good at determining the context of things So I may take a picture of my cat and there's a little tiny tree in the background and I'll see like forest on here So that's pretty cool, too, but the way it's working and now binary cat or no cat um So so basically as a summary I have a device the device sends messages to the IOT platform The IOT platform says I have received a device received a message. I know that That has detected something But it does nothing to determine what that thing is it sends it You know and then it sends it over to open whisk and then open whisk then calls Watson and then it also calls Twilio to send me a text, but only if it's a cat Okay, so this is all of my code Like every little project like this that I do I Published on the internet which I think is a good idea so far. No one has really proven me wrong. This is a bad idea So the yeah, the top one is the actual code that I put on the Raspberry Pi And then the bottom is my open whisk actions for calling Twilio and calling the the Watson API's I have to give a shout out to James Thomas from IBM Who has helped me out with like a lot of questions and in weird errors and things that I've had in the process of porting this over so Thanks to him All right, and now it's the demo time Um So I'm gonna go ahead and plug this cat detector in I'm going to need help from someone in the audience So who would like to be a cat or no cat? Yeah, okay, I see a cat or no cat over there Awesome I'm gonna connect my phone to here and and I'm gonna really hope that my mom Doesn't text me for the next few minutes This is dangerous That is extremely small all right, so this is what the IOT platform looks like if you haven't seen it before It's it has these cards that you can set up that will give you some little a little bit of information about Your devices so I can see the last message that I sent in I can see some information Here about my actual device like what I called it the ID But we're gonna worry about open-wisk right now because this is gonna have my logs You can see sort of my logs where I was kind of testing this before He's the font on this one. Have you a brave soul and connect my phone to the internet to be recorded? There's my phone. That's my cat He's the cutest cat in the whole world Almost forgot my password So I've just got like a npm shortcut here for the cat detector But the fact I could SSH into it is a good is a good sign for the demo gods All right, I need my cat or no cat Like you have to okay there it goes all right, so it's detected like no cat so it's detected a motion and It is has taken a photo and it's publishing an event, but I'm not getting any text yet So there's no cat you're gonna get to be a cat actually to she used to be two cats So for demo reasons, maybe like try to put it about like a foot away from the camera and just kind of be still but yet Move it occasionally Wait, hold on and then I have to reboot and then it's gonna take a minute Does anyone have any questions while this is rebooting sorry cat um I have five Just cats have I tried what's that? No, I have not detected a line, you know, I mean you laugh, but I do have a zoo near my house so Yeah, I mean I don't have to be like super close to detect it really maybe so I think that would kind of Freak out the line keepers a little bit Yeah, I mean well, so yeah, I mean you say that I mean Watson duck can detect emotions But I think for just people right now I Mean I love cats and I tend to agree with you Normally this is pretty pretty instant. It's still booting up, but because it's running on a hot spot It takes a second to connect to the IOT platform All right, so it is now connected to Watson and Okay, now you can now you can be be a cat. Yeah, just sort of like maybe move it slowly back and forth And maybe yeah, I'm hoping this time. Maybe we triggered it Up a little bit So when I first was testing this out I tried I had this stuffed cat that looked a lot like a cat And I would like kind of dance it in front, but Watson is actually too smart It was like toy and so but these kittens will usually kind of will kind of trigger it um Maybe try lifting it up a little bit and try to go a little closer Let's try to see if that does it All right demo gods come on That would have been really cool if I was like oh you have to meow too and I was like just kidding my camera Oh, yes, yes, awesome. Just a turn for Deville. All right. Thank you and thank you to our cat. All right, so We'd actually detected it twice. Okay, so Let's go over here. Yeah, my my camera overheated just this has worked. So yay All right, so let's see what Our cat looked like All right, so that was a picture it took of like blurry cats So we'll come over here to where we're monitoring our open-wisp function and This cat this one at 405 should be our cat. Yes cat true. All right, so here Let me pump this up so we can actually see it All right So we can kind of see here from these cats that it classified them as a kitty cat 71% so we know this was definitely a cat But unfortunately you can see the flaw in the system is that my significant other could be holding a photo of a cat in front Of his face knock something off the counter Maybe it was a rabbit But but overall it did what it was supposed to do. It's smart and That's really all I have But I've got some time for questions. I think I'm here first Yeah, go ahead. Oh Yeah, whoever you get it to first. It's fine Mention your 5k. It's what's the accuracy of a correct cat here in the detection system. I'm so do the correct name I just I'm not doing any percentage right now Basically if cat exists in this list of of 10 items then I say that's good like it doesn't have to be a certain percentage And I mean but I but really if I'm only choosing 10 items. It really doesn't get below 50% What part of the system is doing the upload to s3? It's on the pie Yeah, yeah, and actually I have a version of this that's going to object storage But it was like I was having some issue with it. So for demo reasons. I just kept us three Any other questions? Okay. Thank you so much