HomeBot is Alive! Building a Wi-Fi-enabled, Cloud-based, Tweeting, and SMS-ing Arduino Water Leak Detector - A Basic DIY Project Story
2:57PM Jul 28, 2020
First, on planet
2020. We're having a fantastic week, we're going to create in a moment Jason Jarvis is going to tell us all about his experience with a cyber physical type of problem. I want to first mention though. Thank you to everyone that donated to the Electronic Frontier Foundation, e FF, we have achieved our goal of $10,000 donation and blown past that and are continuing on towards even higher calls. Thanks everyone who donated, and let's keep those donations coming. Electronic Frontier Foundation is on our side here at hope, and of course 2600 magazine, have a bunch of talks in the program as well so there's ever a reason to help to support the Electronic Frontier Foundation. Let's turn to our next talk. This is home bot is alive. And this is relevant to anybody that has a water heater that enjoys hot water. It's also relevant to people that are trying to deal with home maintenance activities or anything else that might involve a little bit of a computational approach to to to likes physical systems, Jason garbus is a basically as a software industry person, and will hear in this upcoming presentation, more about how those skills were applied to a home problem that so many of us have had. Let's check out that presentation.
Hello, and welcome to homebuyer is alive, part of hope 2020. In this session, I'm going to be talking about building a Wi Fi enabled cloud based tweeting and SMS theme Arduino water leak detector. Despite the very long title and the fact that it sounds like an all singing all dancing type of extravaganza. I want to stress that this really is a very basic. Do it yourself project story. I'm definitely a beginner at the electronic side of things. And I won't want to encourage everyone despite your age, your experience level to take on a project like this I think it's entirely doable and we're going to walk through this and break it down and I think you'll see that it's probably something that you'll be able to do as well. I'm Jason garbus you see my Twitter handle there, a little bit about me. I spent my career in the software industry for remarkably over 30 years in a number of technical roles starting as a software engineer for a while moving into technical consulting and then been running and doing product management for software vendors for about the last 20 years, mostly focused on middleware and software development tools for the first part of my career, and about the last 10 years I've really switched over and focused on identity management and network security. Today these days I'm really focused on zero trust I lead product management for a zero trust network security company called ashgate. And I also have a volunteer role where I'm co chair, the software defined perimeter Working Group at the Cloud Security Alliance. My background I studied computer science as an undergrad that's certainly not a prerequisite for having a career or doing things like this. I also have an MBA, which has given me some really interesting business centric perspective, and I really enjoyed that program. I am a CISSP. I'm also a published author. In fact, I'm working on another book right now, which is one of the reasons I'm so busy. So let's talk about why I put together home bot. It all started with. I had a water heater leak at my house and I want to give a public service announcement, which is, if you ever fill up a glass of water from your sink, and it comes out a little bit rusty looking, and it's not from the neighborhood. Don't hesitate, go have your water heater checked out and probably replaced. If you do what I did, which is to say, I'm busy. I'm going on vacation, I'll look at this in three or four weeks, then you're setting yourself up to have a water leaks. Water Heater leak like we did. Now fortunately this wasn't too bad. And we were able to address it with a dehumidifier and some fans and everything was good of course we had to purchase a new water heater and get that installed. Part of the installation process was this thing called a flood stopper. and I'll explain what that is in a minute and that was interesting. Not great certainly better than nothing, and I'll explain in a moment how that works. And that was really the catalyst for me wanting to, to build something so flood stopper is this electro electronic and electromechanical components that has a water sensor you can see part of it on the bottom of the flyer here. And when that senses water the alarm goes off and it also electronically closes the valve you can see it in the upper right here into the water heater and most interestingly, this has a normally open output contact you can see here. Well that was really the catalyst for me thinking Hmm, I could do something really interesting, by taking that and building a some sort of home automation system around it, which is of course what I did. We also had a related not related and unrelated sump pump issue where our sump pump flap got twisted and the sump pump rose up too high, our basement didn't get flooded, but it did get musty and a little bit of moisture rose up through the through the concrete floor and I wanted to address that too. And ultimately, this was a fun technical project. We have something that is interesting, challenging, and not really related to my day job it wasn't welcome change of pace. So one of the first things, of course, to decide is, well, what platform do I build this on, and I did a little research and look of course at, do I consider something like Raspberry Pi, do I build it on Arduino or something else entirely. And what I did was I went through and I said okay well. Raspberry Pi's, they're interesting, they're full featured, they're running Linux and I said, Well, I can handle that. I work with Linux on it, not a daily basis but almost daily basis. It's a full operating system, I'm comfortable with the command line I've been doing that for many years, but it does have a lot of moving parts, and it really started to feel a little complicated and too much like some of the my day job so to speak. So I looked at the Arduino and I said, Well, this is simple and simple is good. In fact, I only have to write two functions. Right. And of course, that's not really true. But it's not true in a good way, as we'll see.
So if I think about the overall flow of the system we have the flight stop sensor itself and that of course has those normally open output contacts and that feeds into the Arduino Wi Fi board, utilizing the very simple breadboard you can see that's not actually the, the home bot itself it's a similar looking a stock photo there. And then, from that we are going to make calls up in AWS to various things to do various activities which we'll talk about. And ultimately, we want to be able to push tweets out to notify status and if the flood stopper indicates moisture on the floor, as well as SMS notifications of course to be proactive so that myself or my wife can go down and check things out of the basement.
Okay, so let's talk about this step by step and the first step is, of course, to learn about Arduino programming Arduino of course is a terrifically functional open source and freely available hardware and software platform, accessible through arduino.cc. I mostly use the web editor for building compiling and deploying this was one exception to that we'll talk about a little bit later, the Arduino programming model is very appealing because, in theory, there's only two functions are set up. And there's a loop. And of course that's not entirely true. And we'll talk about a little bit why and some of the other capabilities later. But for the most part, that of course is a basic structure to it. We I got started with the starter kit, great way for someone like myself who had never really done this kind of electronics programming before has basic board tutorial parts, everything you need to occupy yourself for several weeks if not longer I of course wanted to eventually get to a Wi Fi enabled box. So I purchased this Wi Fi enabled Arduino board it's the same functions basically the same platform as the as the board in the starter kit, but it includes Wi Fi capabilities built in this one of course was the MKR 1000 about $37 a few years ago, there are newer versions available right now. And that leads us to actually interesting thing this photo here you can see it has what are called the headers installed so protip number one, save yourself a headache and by the version that has the headers already installed, really easy to work with. Using the plug into the breadboard and very easy to plug in wires to do your testing. If you buy the version on the right, which I made the mistake of once it's much harder to work with. And if you're terrible at soldering like I am. It's just a complete headache. So, that's my first tip for you. You also see that it has on the lower left side, a micro USB cable which is how you connect up to your PC or your Mac to to program it. One more, more in that a little bit later. So let's talk about the software platform. The Arduino boards are programmed in C, and I can handle this I was a professional software engineer using C to build client server network system in the 80s that I'm dating myself a little bit but I did this and I could do it again. The Arduino IDE, the web ID is pretty darn nice it has pretty standard capabilities for software engineering practices so of course you can have multiple files like you can see in the tabs in the screenshot below. They've got a nice built in secret tab where you can put passwords or API keys or things like that. And they have tons of embedded and freely available libraries examples and things like that. Lots of stuff to find and most of it is pretty good quality. So that's a really good platform. Something that I was comfortable with. Terrific set of tutorials adequate way to get started. Okay, let's talk about step two, which is actually building the circuit itself. This turned out to be a pretty basic circuit, as we'll walk through the step by step. This is my PowerPoint rendered schematic, a logical schematic, what the what the circuit looks like. We use a number of pins here you can see a four and 678 and a one to actually control the logic from a software which we'll look at in a few minutes. I have three LEDs that I created to indicate power activity and alarm. And of course those are set in output mode using the pin mode output function there with a 220 ohm resistor. The way these are set up of course is the power is controlled by software from the number chip there six seven or eight that goes into the LED and of course it has to go out through a resistor down to ground. Pretty simple circuit, very basic. And the other three, the other two excuse me, were set up exactly the same way. I also put a temperature sensor on this just for kicks, which is a little bit flaky these days. And I have to have to look at why that is. power goes into the temperature sensor. Obviously, the other leg goes out to ground and then there's a third leg in the middle, which goes to a pin that we read the, the setting on between zero and 255 255, and then we do some basic math on it to calculate what the ambient room temperature is, again, pretty straightforward process here with pretty inexpensive sensor. And then finally the flood stop circuits itself which is the heart of what we're doing here.
This goes out, of course we run power through that circuit. It's normally open so there's no voltage coming through from the flood stop circuit. And in order for the sensor PMA for to read low, most of the time. What you do is you run it through a resistor down to the ground so that it doesn't get Aaron's errant readings. When the flood stop circuit census water, of course that circuit goes from open to closed voltage goes through, and then chip pin a four read high and be able to respond to query by in our software. So that's the basic circuit. Pretty straightforward. This is really the most complicated, electronic component that I had ever built which is not saying much, but it was a really good process for me to learn how this works, and to build something like that.
Okay, now we're on to Step three, where we actually look at the Arduino code. I'm presenting a slightly simplified version for clarity ever remove some conditional compilation and some error checking, just to make it a little easier for you to, to be able to understand this. There's one of the main functions is post message the home bot and this is what actually makes a, an HTTPS post up to AWS lambda, with a simple JSON formatted payload of data. So we'll kind of build up to that as we go through the code. The heart of it of course is this loop function. And there's a number of elements to it, if, when it starts up, it does a post info message to indicate to the, to the world that it's online and live and connect to the network. And then there's some things that happen periodically every hour it checks the temperature, just for kicks, every three hours, it'll post that up to AWS. Of course, if a water sensor is wet. Every 60 seconds it's checking if water is detected it'll immediately post an alert message, and we'll see what happens up on the AWS side. As a result of that. Likewise if it senses a significant change in temperature. It'll also post an alert message. and then it's time for the daily summary that happens once every 24 hours, then it will post a summary message. So that's kind of the basic structure. Let's go ahead and switch over to the Arduino IDE and we can actually look at this. So here's the nice web based IDE. And you can see we've got some constants defined in terms of the numbers of the pins for the power ops in alarm led as well as the input pins for the water sensor and temperature voltage. There's a bunch of stuff in here that I'm not going to talk about in detail around time and keeping track of time and keeping track of temperature, the time is interesting I'll talk about that in, when we get to the following slide but first I want to talk about the structure here. We got some timing constants that are defined in terms of sample delay. This is set up to every 60 seconds, and then some things to indicate with how frequently the tweets, some parameters around how long to wait for network connection, things like that. Let's go ahead and just go ahead and dive into the setup, so the setup is very straightforward, we configure the pins that we need for some which are used for output, some of which are used for input. We flash the LEDs just so that when you're there and you're looking at the thing and you first plug it in, or debugging, you can see that it's on. We initialize a bunch of things in terms of counters and trackers and things like that. And then we exit the setup that's pretty straightforward. The Loop has a number of components to it. So the first is I mentioned, if this is a one time startup then go ahead and post the info message and one of the reasons of course is to get some reassurance at home by this app, it's connected to the network. The Wi Fi network. But also, it is a. It allows the system to get the current date and time and that's driven by actually the networking stack. It gets it from a network time server, because the Arduino chip itself the board has no long term battery and has no notion of keeping track of time so we get that from a network server. Then we check the temperature here, and we keep track of. Is it time to record our hourly temperature if so we'll put it in the array. And if it's time to post the temperature, then go ahead and call this post temperature log message function which we'll talk about below. Next we check the water sensor and if in fact the water sensor is nonzero. Then, we are, we have a leak of some sort. So we go ahead and we post an alert message and keep track of things there. We do have a counter in there so that we don't continue alerting. We max it out at three so that I don't get more than three text messages because that would just be annoying. And then this is just administrative things to keep track of. Hey, how do I set set my daily summary yet have I passed the time threshold. If so, I'm going to start to format this message and go ahead and do this post info message. So if I scroll on down to really the the post message format, I created this, the simple structure where I'm sending in a message which is one of these verbs here, up to the lambda function. And then, in a message of course, depending on what the verb is here. There's actually different variables, some sensor utility room sensor, whether this is an info message, whether it should send out a text message, etc.
These are not very interesting these posts info message post status message functions because they're really just string processing and putting in horrendously escaped. Tag key value pair formats, ultimately these things go down to a map to the post message to home bot function, which takes that horrendously formatted message body connects to the network, and then ultimately uses this networking function Connect SSL to connect up to the API gateway in AWS, with obviously I've replaced the real the real gateway name here. You can see it's just an HTTP POST. It adds em, the, the message. The message content. And then that's it and it gets handled by the API folks function. And then we just look here for what the return value is to make sure that that it comes back, as it should with the 200. That really is the core of the Arduino functions and home bot. The other things here are pretty straightforward most of this, like the network functions are from some library sample libraries, an Arduino that I've used, and then the temperature and time functions are pretty straightforward. So if we think about what we learned from this. I mentioned that the Arduino needs to get time from some sort of network time service, and that's built to the network stack. And if you try to access time and figure out what it is before that's happened of course it'll come back as zero. UTC is definitely the way to go. The Arduino has no notion of time zones or lif hours weekdays leap years, those types of things. So everything is much simpler if you just log in and keep track of it as UTC HTTPS connection of course is secured with TLS. And in order to do that, the network stack needs to have a Root of Trust that is it nice to have a certificate issued by a trusted certificate that it's connecting to which in this case is running in AWS needs to be issued by our certificate authority that is trusted by the board so the way to do that is you have to run this firmware updater to actually take the certificate from just the AWS website there and actually save it into the firmware on the board. Otherwise, the network stack will not be able to create an HTTPS connection, because it doesn't have a trust a level of trust with the, with the, with the server. And when you do that, you actually have to use the Arduino IE app, the program, you the browser based version doesn't have the capability to do the actual firmware update on the board so that's something I learned. And the way you do that is you run this app here you can see it's called the firmware updater it's part of the platform. And there's an element to the simple UI that lets you can see at the bottom, upload a certificate to the Wi Fi module so that's the process for doing it. One of the things, however, is that I mentioned you can't use the browser version so I actually ended up using a different computer for this. And when I use a different computer, of course, that's one thing that changed I also happen to use a different cable. And one of the interesting things about these micro USB cables Pro Tip number two is that many of them, most of them are providing both data and power, but some of them only provide power they don't provide data. And if you grab the wrong one inadvertently because they all look the same or you don't think there's a difference. And at the same time you switch to a different computer and you're trying to use a different ID, you will drive yourself crazy and beat your head against the wall, because you don't understand why this thing isn't connected. So, even though these things look exactly the same, just make sure that you use a cable that is providing both data and power connections, and not just power so Pro Tip number two. Okay, the networking code is actually pretty straightforward. Really, very easy to work with the formatting of the data can actually be a headache for the posts, and one of the things I learned is that I was using a free tool called postman to do some testing against the AWS side of things, and things were working fine for postman but they weren't working fine when I was sent the data up from the Arduino component, and there's actually some subtle differences in the way those two different tools formatted the data as it came through and that was a headache to to debug so make sure you look carefully at that.
Now we're in step four, we look at the code that actually runs inside of AWS. Now of course, we have the Arduino that's Wi Fi enabled, and that's making network calls to something. Now one option, I thought about originally was to actually have the Arduino itself directly make the tweets and to directly SMS from the Arduino board itself. Now that's possible. It's difficult there's a lot more code that's required to connect up with Twitter. And there's some services you might have to use SMS seen. I looked at that, that's a little bit more complicated and I decided let's just do this inside of AWS because there's a very rich platform there to do these kinds of things. So the way that works is, essentially, I want to have Arduino called what's called a lambda function inside of AWS, it's just one Java class that you'll see. And in order to do that, what you do is you set up what's called an API gateway, in AWS, and you set up a basic flow for the API gateway to call the lambda function, and then the lambda function in my code actually calls out to you use what's called the Amazon simple notification service or SNS, which is used to send SMS. I store some data in the Dynamo dB, and I make API calls that you'll see to tweet out some updates. So, pretty simple HTTP POST into the API gateway. Pretty fun and easy to create this message protocol, and I talked a minute ago about postman, and some of the challenges there that in some cases can get you wrapped around the axle in terms of very subtle payload formatting. This is a screenshot of the AWS API gateway you can see it's a simple post for home bot. And it's got a unique AR n there that is a unique URL essentially that homebuyer is going to call with a method request here at the top, then it calls a lambda function. You can see it's mapped to this lambda function called homebound on the right hand side, and it simply sends an HTTP 200 status which means, everything's good with an empty body back because there's nothing that we want to send back. So that's pretty straightforward. The lambda function itself you can see very straightforward as well. I chose to implement everything inside code inside the lambda function AWS has some capabilities to on you can see on the right hand side there at a destination, you can basically glue together output from a lambda function. I chose to do it inside the code itself. And you can see here, it's a Java function with one function called handle request that's inside my home bot message handler class. And you can see that I've allocated a whopping 384 megabytes of memory associated with this, because we love dependencies right. When I first looked at lambda function, lambda is a very capable platform of course and they support a ton of different languages. You can see there that you can develop your lambda functions and so I looked at this and I thought well maybe, maybe I'll start and I'll use go and go. Ultimately, I said, it's a no go because I don't know though, that was a little time there. But it ended up being dependency hell because you can't just write a function to do something right, you're going to end up pulling in XML parsers and other libraries and things like that, and I'd never used go before, and I had also. I didn't want to have a learning curve hat dealing with that at the same time I'm dealing with an unknown platform because then I'm trying to learn and find my way in dark cave, you know without a map, whereas switching over to Java. I can certainly do Java, I was a software engineer building Java programs in the 90s. And I use the IntelliJ IDEA Community Edition the free version, really powerful ID. It wasn't dependency or packaging hell it was packaging heck. So that was relatively easy to overcome and AWS is a terrific platform. Their Java API's are well documented really straightforward and easy to work with. So if we look at the code for here I mentioned there's one class called home bot message handler. And there's really just one function that I had to write. But there's lots and lots of packages and you can see here, I had to pull in
AWS Java packages XML processing packages. There are some Twitter packages, things like that. Nothing crazy, but it did end up being a little bit of a trial and error to pull in and find the right packages to get things so that the lambda function was able to resolve all of its dependencies, so I probably could clean this up and make it a little bit more efficient but I haven't had time to do that. Now let's take a look at the actual Java code that implements the lambda function, switching over to the Java ad, you can see we've got the code exists in a package called home bot. I've got some documentation to keep my keep my head straight here. That explains what the message format is that comes across the wire and this will match up with the information that's sent over from the, the Arduino code that we looked at a few minutes ago. At the top, of course, are the requisite set imports in order to resolve all the dependencies. And then here in the class. How about message handler. There's really just one function of importance called handle requests, and that takes the input stream that sent to it, and provides an output stream, to be able to to publish results. So, create this thing called buffered reader. That takes, and processes the input stream. And then what we're doing is we're basically parsing that reader into this JSON object and then we can start to pull out key value pairs. First thing we do of course as we look at what's the message type here. And then, if it's a status message I'll do certain things, if it's an alert message I'll do certain things, etc. Ultimately, if it's a status message for example we know to look for the sensor status because that's what's going to be sent with it. And then we pull that out, determine if it's dry or wet, and then we'll actually tweet out the results, because that's what we're supposed to do as part of the status message. Likewise on an alert message, we'll get the information out. In addition to tweet it out. We're going to publish the SMS SMS message to alert myself that, hey, there's a problem you better. You better go take a look at it. Then is the information message, which we use to tweet out as well. And then there's a couple other things. Temperature log message and a test message which I used for for debugging debugging purposes. And then of course there's the unknown message, which actually tweets out saying, hey, something's up. I've gotten something unexpected, you need to check out what's going on. Pretty straightforward there. Now if we look at the actual on the scroll down code that does the external communication. Publish SMS message here you can see, we are using this function called Amazon SNS client, and that's what use is used to push this out and you can see you put in a phone number, that's obviously not my real phone number. But you tell it that hey this is an SMS message type promotional go ahead and send this out and publish it. As long as you sit within stay within the rate limits that are imposed by AWS. This is free, and the rate limits are extraordinarily high for something like this so there's, there's no danger of of hitting any, any rate limits with this. The second external communications function is tweet out, which is really really simple because I'm using this library called Twitter factory. What you do is you provide it with some OAuth authentication tokens, essentially, you can see some placeholders there, you obtain those by registering as a developer or a bot on the Twitter website. Once you have those, you can then use them to you can see with a very few lines of code, just go ahead and do what's called an update status which means tweets. Essentially, and send that out again very straightforward, much, much easier than going against the raw Twitter API, which is pretty complicated. The rest of this is basically parsing and managing data. This is one additional thing which is to where I put in some code to persist this to Amazon's built in dynamodb, and here this is again really straightforward I simply take this Amazon Dynamo DB object. I instantiate it, and then you're basically putting in key value pairs into that periodically. So some notes on this, I mentioned I use this Twitter for j library and you can see the URL up there, really, really easy, and I recommend, again using that then, rather than trying to, to work directly against the Twitter API.
Publish SMS message, really simple, Amazon has that built in, likewise for dynamodb. So, terrific platform, very easy to work with. And once I got through the dependency hack. This was actually pretty straightforward. So we think about now what does this look like well of course Hobart is alive and active on Twitter, under the handle at 70 combat you can see there, and he's made or it has made up over 6700 tweets over the past few years, and sends out daily updates around 1700 UTC, you can see that right here in the middle, as well as updates every six hours from both the sump pump bot, and the utility room bot. The SMS is that come through, you can see a screenshot from, from my phone here they come through again once a day, basically saying hey I'm alive and well. This is my max and min temperature from utility room. And as I mentioned earlier that data is definitely not right, my utility room was not 115 degrees, probably closer to 80. So, I definitely need to look at that and understand, if there's a loose wire, or if I need to replace the temperature sensor components. Okay, and now it's time for the video demo ARB home bought itself in action. So let's take a look.
Hello, and welcome to the utility room
my house. Placement the homebuyer lives. You see as a small interior room in my home. We have a gas powered forced hot air
And we have in here of course the electrical box. We have the hot water heater This is the new hot water heater you can see it's from November 2017 replacement for the one that leaked. And you can see over here. The flood stop system and home by itself and we'll talk about that in a minute. The flood stop system you can see it's mounted on the wall is a very simple circuit board. And down here in the floor we have the actual water sensor, very simple circuit. That was running, probably a couple of volts through here with wires that are exposed and when we drop a drop of water on it and a few minutes. Then we will. We'll see an alarm flood stop sensor is also connected to the hot water heater, you can see there's electronically controlled vowels here to the input. And when the alarm goes off, it will actually close the valve to prevent unlimited water from flowing through. Obviously, we've got a water tank full of hot water so if it leaks, or this will come out, so we wanted to put in a better way of doing this. Here's the home by itself and you can see it's. Hold up with painters tape, but it does work. And it's hooked up to the output to the the ports on the flat stop. And you can see that it's running voltage through that and if it's one stop census water and it closes, then it'll actually go off and you can see we have some basic LEDs. And we have the temperature sensor as well. So now we're actually gonna give a demo, and I'm gonna take some water, put a drop of water on the sensor what will happen is a number of things will happen at once. First of all, one stop will make an annoying alarm. Second, the bow on the flood stop will close up here and you might hear that, and then the home by itself will go into alarm mode, and it'll send out a tweet, which we'll see as well.
So let's watch this in action. Here we go.
we're gonna silence that.
And you might have heard the little valve here closing and home by itself is on a 62nd cycle. So, sometime in the next 35 seconds. We should see it wake up, and the red light will go off and indicating the water sensor is wet, and then we'll actually go through the process of sending out a tweet and an SMS message, which we'll have a look at as well. We didn't actually catch the red LED on video, but we do have a screen recording of a text message coming in here. And there we go.
We're here in the storage room part of the house by
the sump pump. And you can see some pump out is right here next to it. Very similar circuit, very similar setup. In this case, we have a water sensor that's dangling down about eight inches or so, into the sump pump area. It's the middle of summer so the water level is quite low here in the springtime late winter in springtime. This does tend to run fairly frequently, and on the off chance that the flap gets caught again. The water level will rise up the sensor will get wet and the utility back room. excuse me the some compromise will alert. So we shall demonstrate the sump pump that I take in the water center out and make it easier to pour a drop of water on here, and we'll see what happens when one around you can see immediately that the red light goes on, indicating something's happening. And in a moment or two, what'll happen is the sump pump bot will wake up from its cycle. The yellow light will flash indicating that it's active and the red light should flash indicating that it is actually in alert mode, and it will send out a set an SMS message as well as a tweet indicating this
yellow it has gone on, it's trying to connect to the network right now. I believe it's what it's doing.
To get the time.
Then what it's doing is the red light goes on indicating events in alert mode, and it is sending out an SMS message that should show up momentarily, as well as a tweet.
As we saw in the video demo home bot will tweet out Robert, when the water sensor. When water sensor detects water, you can see that here, but sump pump in the utility room from earlier today. Likewise, the SMS messages come through on the phone indicating that there's an alert and some action needs to be taken. So now we close the closed loop here, all the way from looking at the actual hardware, though, water sensor the code that runs the flow through AWS, and the actual output here into Twitter, and an SMS notification. So let's wrap up. We currently have two bots that are running the utility room bot that we saw in the first part of the video demo. And there's definitely something that's not quite right with temperature sensor, so that's on my to do list, and then the sump pump bot, which is, which is a part of the second part of the video demo, you know, aside from the temperature sensor thing. This is pretty reliable in terms of the Arduino hardware, the infrastructure that I'm using. I don't have to really monitor these things, they run, month after month after month without any issue, and we get my daily text messages we get the tweets. So I've been really pleased with that. There's no memory leaks or crashes or anything like that. So that's that was pretty fun, and I was pretty pleased with the output there. So what's next. Well, I am pretty busy these days so I don't know that I'm going to have time or make time right now to do anything further on home bought, maybe perhaps beyond 60 that finicky temperature sensor. There is the potential for another bot called toilet bot. We have one problematic toilet in the house, we've replaced the valve system a couple of times it still runs once in a while, so my thought process was to utilize this inexpensive water flow meter component that I purchased. And essentially, you hook this up to your Arduino and using Arduino interrupts, which is an entirely different way of programming beyond setup and loop. This will basically send pulses into the Arduino board, and it can calculate how much water is flowing every second. And obviously, if a toilet is quia sense, nothing. Nothing's happening, there's no pulses. If there's water running to refill the toilet, and obviously there'll be certain number of pulses per second. So it would be very easy to put together a system that detected, how long this or that was running for, and if it exceeded the 45 or 60 seconds that was typical, then it could send to the large challenges around this are well, there's some basic plumbing involved but I can handle that it's going to be some plastic copper line and things like that, but more challenging is that there's no power, that's immediately adjacent to the toilet so i'd either have to run an extension cord up and around the vanity which would be pretty unattractive or drill into the bottom of the new vanity. That could be problematic as well. So, that's not on the horizon right now, but it is technically doable and could be an interesting project. Of course, these things are available online for purchase because everything is, and clearly there are relatively inexpensive components that I simply could have purchased to do something pretty similar from a Wi Fi enabled water meter to a sump pump monitor. But. But ultimately, that wouldn't have been as much fun I've learned a time here. I really enjoyed the whole process of discovery exploration, making mistakes and learning and putting all this together I'm pretty proud of this is crude, and basic, and ugly as the thing is, it's really neat to have it in your house and know that this is something that you've built and wired together. So ultimately,
this is fun. It was a very different kind of technical challenge that I face on a daily basis and I would encourage folks to do that. The set of electronics and the types of components that are available today are really mind blowing. You can just put together incredible things for a very small investment of money, and a modest investment of time. Sometimes security around this like the HTTPS certificate and getting the figuring out how to make tweets, is the hardest part and that's okay I work in the security business on a daily basis and I understand the need for it. And this actually reinforces the need for us in the in the security world, to try to make things easier and simpler and more transparent for folks who are just trying to get their job done or do something fun like this. Don't be afraid to question the tools that you're using sometimes your tools are imperfect. And of course, as always, the internet is an incredible source of information, technical information guidance opinions. Sometimes it's even right, sometimes it's the right answer for you, sometimes it's not so just take that also with a grain of salt, you may not find an actual recipe for the exact steps you're doing. And that was certainly the case here, there were bits and pieces and examples and demos that I pulled from to help me learn how to solve one problem at a time. And there were some examples online that were fairly close but there was nothing that was exactly this thing sewn together. And that was kind of the fun bit right, figuring out how do I do this in a way that where you're creating your own path. So I want to thanks. Certainly, thank you for attending. I hope this was a useful and interesting session. And I want to thank hope, and the organizers of this conference I know it was a big shift to do this online, and really pleased and thrilled to be one of the presenters, and to participate this year. And I certainly hope that we all stay healthy and stay well and can be together in person, next year. So when Thank you This is going to be ending the recorded part of this. And I'll be available live for q&a.
How many of us have had problems like that, and call the plumber went to, you know, the hardware store and tried to find that sensor you know and just didn't didn't figure out all those problems that was an inspiring. Talk about how you approach this this common sort of problem that had I think in your case, somewhat uncommon solution. Jason Welcome Welcome to hope and maybe you could just start out by telling me how you how you would recommend that people get started as a beginner, what the journey that you went on and what sort of mindset, you need to take.
Thanks Greg and thanks to you and all the organizers of hope for having the opportunity and doing this virtually i think is has worked out really well. And I think is a great accommodation for the for the state that we're in. I definitely have a growth mindset, in general, I'm consider myself a lifelong learner and I'm not embarrassed to try something new and be a beginner at whatever it is, whether it's intellectual or physical activity. And I did call a plumber trust me, we had to bring in the professionals to change out the water heater but I you know I saw that component on the fly stopper and I thought well wait a minute I can do something interesting with this, and I really want to be alerted, if I'm out of the house or under the bout if something's going wrong and it's kind of opened up this whole world to me of home automation and the way that you can build on these platforms into things kind of that, that moves away from the pure software world into the physical world and I think I would encourage everyone to try this it's, you know, even though this is a very basic project and it's, you know, I think it's well within the range and the capability of, you know, a huge number of people whether you're a beginner whether you're, you're a teenager or even younger than that, or whether you're someone more advanced in yours like me and you have different skills and you want to want to try to learn something new so I really think that too often people have a closed mindset, they're not open to trying new things and learning new things I want to encourage people to try to approach things differently. Oh yeah
that's that's what hope is all about so So absolutely, absolutely. We had a few questions about some of the some of the details. One of them was essentially about the choice of more industrial parts versus like more hobbyists are explorers for the cheap as far as combined in their work to do have to do, dig into choices of, you know, components.
And you can see clearly that it's, you know, held together with painters tape and using breadboard so clearly this is, this has hobbyist parts, and I think if I were to want to take it to the next level, then yeah I would probably work with someone who has more experience than me in building circuits soldering and putting together something that's a little bit more. I would even say professionally packaged. A little bit more resilient packaging so I didn't explore that because I was really interested in the process of getting it working and seeing how this didn't work to end to end. And that's kind of where i, where i, where i stopped on that journey,
someone was watching your video very closely and they wondered whether you were broken a bit when you were installing the anchors because I think they noticed some of the anchors and also a whole mind, take the harder you don't play it.
It was just curiosity about the difficulty of drilling into that concrete. Oh,
down where the, the water sensor is.
So, well the water sensor is just, there's just on the floor is underneath that PVC pipe that's holding in place, so I didn't even drill I didn't throw into that and then there's a drain there that is completely separate system that's just the outflow from the condensation from from the water heater.
My next question.
You're muted Greg.
I put my question to the tech side of the doghouse.
I'll cover for you, Greg.
Okay. There are building automation systems and standards are those necessary or relevant or good building blocks so I mean clearly this is a pretty basic hobbyist style project. This is using five volts to go through the board so this wasn't something that required either complying with standards or a permit or anything like that clearly if you're working with something more standard or substantial if you're trying to interface with 120 volts, you got to know what you're doing, which I do not I wouldn't you know build something that uses that type of voltage or ties into something that could be dangerous in any way. So definitely know your limits and be careful not to cross that line.
Somebody had a question of Have you looked into making PCBs it's pretty cheap and easy to get one made and thought are a couple of resistors.
I haven't looked into that I think that's a really interesting idea for a potential next step here, and you know it would be interesting to, to look at what other platforms, there are to kind of have people even use some software like this, you know, even in some future state I could, I could open source some of this so that people could leverage it for even more accelerated mechanisms are ways to do this on their own I'd be happy to share that with people.
I'll let you take over Greg. Yeah, thanks for being out there for us I don't know if people know I have a bunch of dogs in the house and so far, this is the first time they elected to hell like when I was in the middle of speaking. My posh house for that. It's just is just a big video. So, there's also a question about the sensors. The question was why did you not set up the sensors to trigger interrupts on those first two whole months.
I suppose I could have done that it's. Those are just a plain circuit that is either open or closed. So I wasn't sure if you could hook it up to an interrupt or not.
Yes, that sounds like a real learning process. So, yeah, this was inspirational and I apologize, I might have missed it in the talk that you put out there is there an online resource with any of these photos or, you know, I have
not had a chance to put that together, I haven't got
to that level yet but obviously the, the talk here will be on on replay and people can watch that and if they can get in touch via the program, they want to follow up with you so well thanks so much for, for sharing this is there anything else you want to mention in closing,
I want to thank you and I do want to encourage folks to, you know, take a growth mindset and really look at things that you can learn and try new things out. And I think that that's a pathway toward lifelong intellectual engagement and fun, and just the ability to grow. Thank you
once again that's what hope is all about. So this has been Jason garvis talking about home bought, it's alive It's still alive right. It's still alive, we can still use okay I just want to make sure it was still an accurate title, and this is Wi Fi enabled cloud based tweeting and SMS in our, you know, water leak detector, a basic DIY project story. Thanks for being with us Jason and enjoy the rest. Oh, thank you.