SuperHouse #20: The $6 universal home automation button

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi i'm jonathan Aqsa and this is super house wouldn't it be great if there was some sort of little wireless button that you could connect to your home automation system something really cheap maybe only cost like five or six dollars and you just stick it somewhere whenever you press it it tells the home automation system to do something you could use it for all sorts of purposes you can stick one on your fridge so that when you press it your home automation system orders pizza maybe you could put one just near the door so that as you leave home you press it your home automation system will lock all the doors turn off the lights close the blinds and maybe change the settings on your climate control system that'd be really handy like a leaving home button so the question is why am i standing out here with a bunch of rubbish bins well here we have three different types of bin there's the regular waste bin which is collected every week there is a green waste bin with a red lid which is collected every second week alternating with the recycling bin and of course the universal problem is remembering to take out the rubbish and then we've got the added problem of which other bin do we take out not just the regular bin recycling or green waste I'm going to combine the little ambient tile display that I showed a couple of episodes ago so that every week it comes up with a color that shows which bin needs to be taken out but then there's a universal question of have you taken out the bins yet so what I want to be able to do is cancel that indication when the bins go out what I'm going to do is use a little button attach it to the bin so that when you see the indication in the kitchen that says it's this week you have to take out the recycling bin you come down and grab the recycling bin take it out press the button the clears notification sounds kinda silly but it's a good way of illustrating both ambient displays and also a universal button so hidden just inside this tile is the ambient display that I showed in a previous episode there are adjustable RGB LEDs behind the tile so the home automation system can send commands to it eliminate them I can use those as indicators for different situations all I need to do is publish to MQTT to make it come on so what I have done is created a little script that checks the day of the week and checks whether this particular week is meant to be recycling bin or green waste bin and then it eliminates the appropriate color the day before so you know when the bin is due to go out so for example it could come up blue when it's recycling bin night and it can come up red when it's time to take out green waste bin which has the red lid then of course what we need is some way to tell the home automation system that we've taken the bins out and it needs to clear the notifications and not worry about it until next week now I've got the original inspiration for this project from a product called flick flick is a tiny little Bluetooth low-energy button and the idea is you can pair it with your phone and then use it to trigger different events on the phone it's like the size of a large bottle cap and the idea is that once it's paired with your phone the flick software lets you activate different functions so you could bind a button to take a photo so you could put your cell phone up on a tripod somewhere have the flick button in your hand press it and it takes a photo or you could make it do something like place an emergency call you could have it as a panic button so it sends your location and sends a call to a friend or emergency services flick also supports things like IFTTT which is if this then that what that allows you to do is bind inputs to events with different recipes so you could have a recipe which is if you press this button I want you to place an order for a pizza or I want you to tell my home automation system to activate the alarm system there are all sorts of things you can do but it's all bound through the phone with flick the button activates your phone or something on the phone which then talks out to their cloud service which then links to whatever you've wired up to it I wanted a slightly different approach same sort of concept I wanted the cheap little button that you could press but instead of tying it to my phone I wanted to tie it to my home automation system so what I can do is put a button somewhere whenever I press it and if in happens and I found a really cheap way to do it have a look at this this is a little RF remote control that you can get on eBay or Aliexpress or many places and they're really cheap I think I paid about five dollars 86 for this so but that's US dollars let's call it six bucks just for round figures and this one is a single channel remote but you can also get multi channel remotes and this is the receiver now this is basically like a you know garage door remote control press the button and the receiver does something it has a relay on here and it has common and they're normally closed and normally open outputs and it runs off 12 volts so all you do is put 12 volts in here whenever you press this button the relay fires that gives us a really easy way to control something with a cheap button let's hook it up and see how it works now over here I have a power supply this is a 12 volt power supply coming off a bench supply and I've got positive and negative so it's chucking positive chuck in negative and now we have the receiver active if I press this button you might be able to hear the relay firing the receiver has several different modes by default with this jumper just not in place whenever you press it it comes on for a quarter of a second or half a second or if you press it and hold it it stays on for that long if I put this jumper across this side it toggles on toggles off toggles on toggles off if I put the jumper on this side it toggles on and as far as I can tell it just never turns off and I haven't found a way to turn it off you have to actually take power off the receiver before it will drop out so I'm not quite sure what the point of that is but it's different mode but what I want to do is just leave this little jumper off because then it gives us momentary output and of course being a relay we can just connect this to say a digital input of an Arduino and then whenever we press this button when I can detect it and here we've got remote control of an Arduino based project what I have here is nerd we know a compatible board this just happens to be an ether mega because it's got onboard Ethernet it's useful and what I've done is loaded up a little program that outputs it goes high on pin 13 which is the LED whenever digital pin 7 is pulled to ground it's got the input pull-up turned on so I'll just use a little jumper put it into ground anytime I put it into pin 7 you can see the LED turns on so what we can do now is use the output of the receiver to trigger this on the Arduino so what I can do is take this ground connection from the Arduino I'll put it into the common on the receiver then I will grab the normally open connection which is this one put a jumper into that put that into pin seven of the Arduino and now whenever I press this button the receiver is telling the Arduino that this means pin needs to go low and the Arduino then turns on the LED ok so that means that from anywhere around the house now I could stick this little six dollar button onto something press it and this Arduino knows whenever I pressed it now because this particular board has Ethernet I could then have code on here that does something like publish to mqtt every time I press this button so now I have a six dollar button that can activate my home automation system make it do whatever I like because once I can detect that that signal and act on it then I can just have it activate something in openhab I could make it turn things on or off so what I'm going to do is use this to clear the notifications that are set on the rubbish bin reminder as a demonstration of creative dis sketch which I'll run on the ether mega now you don't need to necessarily read every line of this I'm going to post the source code online I'm just going to give you a quick explanation of what it does and also this is probably more complicated than you need does a whole lot of extra things for example it uses a MAC address ROM rather than simply setting the MAC address in the sketch so it does the usual Ethernet setup staff needs spi and Ethernet needs the pub/sub client because it's going to publish to mqtt and it sets up the callback for mqtt it's just for reading responses from the broker creates the ethernet client and that's the reconnect function which repeatedly tries to connect to the MQTT broker if it doesn't have a current connection so in setup it just opens a serial connection so that it can report back just for debugging and it turns on the input pin pull up on the button pin which is the input which we are going to use to sense the receiver and it sets the callback etc and sets up Ethernet using either Mac with DHCP or the Mac and the IP if it doesn't use DHCP so the main are just down to the bottom there is little supporting function here which is used to read from the MAC address ROM but we can ignore that so the main loop basically it checks whether MQTT is connected to the broker and it attempts to reconnect if it's not then it reads the button pin and it checks the state of the pin and whether it was previously hi and now it's low which means that it's detected a transition from high to low so it knows that the button has just been pressed it's not that it's already been pressed including the last time I read through it means that it's transitioned from one state to another so it's detected a transition and then it's also checks how long it has been since the last time it sent a message there is a minimum message interval here and this allows basically debouncing or rate limiting and then all it does is published to the topic Universal button 1 the message hello world and just sets the the housekeeping variables there and records what time this message was sent so what we can do over here is use the mosquito sub to subscribe to that topic Universal button 1 so I'm now subscribed to the topic and here we have the ether mega which is running that exact code you can see that it's connected to Ethernet here it's getting power so this is actually running power over ethernet to getting the power off the network cable and that is then used to run the receiver and the receiver output is just a cross ground and digital pin 7 exactly as we saw saw before so now if I grab my remote control press the button you can see it comes up with hello world every time this receiver detects a message it asserts pin 7 and the Arduino then publishes to MQTT pressed again and we get it again but if I press it now nothing happens because it's within that 5 second rate limit now if I've waited a little while press it again and now it goes again now of course this will work with almost anything doesn't need to be an Arduino you could use an esp8266 could be a Raspberry Pi digital pin because the output of the receiver is just a relay connection it doesn't even care what the voltage is is just shorting the pins so you can connect it to a 3.3 volt port or a 5 volt board it really doesn't matter you actually have total isolation between the two systems as long as you supply 12 volts to the receiver module then it'll pick up a signal from that little transmitter and the other cool thing about this is it lasts for ages I mean this is basically just like the remote control in your garage door and knowing how often do you have to replace the batteries in that these things last few years I wouldn't be surprised if you get three four five years with an alkaline battery in this so six dollar button last few years and the other thing is I keep calling it a six dollar button and you're saying hey but you've got an expensive Arduino board there that's receiving it the thing is you don't actually need a dedicated board if you have anything in your home automation system or it could be an Arduino anywhere around the place or any other microcontroller and it happens to have a spare digital input you can use that input all you have to do is put this receiver wherever you've got an existing microcontroller for it into a spare digital pin and now you've got a way to control stuff on your home automation system if I was putting this button inside somewhere I could just use some double-sided tape put it on the back and then I could stick it onto whatever surface I like and just leave it there but this is going to be mounted outside so I'm going to give it a little bit of extra protection and might seem silly but I'm just going to put it inside one of these ziplock bags and then I've got one of these little silica packets which is you know you find an electronic equipment it's used to absorb moisture to stop it tarnishing if there's a new moisture around in the packaging so I just sealed that up and then I've got this ready to go I can mount that on the frame and I'll drill a couple of holes I think through the frame of the bin and then I can just feed some zip ties through the holes and zip tie this on to the bin and then it will be fairly well protected I think should last for a while so just under here should be a good place I think I can drill through this little tab and then cable tie it on here because it's on the back of the bin it will be nice and safe when the rubbish truck comes along and picks it up it grabs it from the sides so this is a convenient place to be able to grab the handle press the button whenever the bin is taken out so that's it the project is all done now on the appropriate day the little status LED will come on in the kitchen we'll know that it's time to take out either the green waste bin or the recycling bin and then when I take them out I just drag the bin out press the button and then that cancels the display then next week comes up with the warning again that way the home automation system knows which been to put out and it knows when they've been put out so I would really like to know what sort of things you would do if you had a little six dollar button that you could just make do any arbitrary thing on your home automation system so please put comments down below make sure that you comment and subscribe and like this video as well you probably notice that I'm doing a few more of these videos now it's becoming more important for me so it's really important for to get some feedback I want to know if you're enjoying these what sort of topics you'd like to cover and I will keep making them as long as people keep watching them so thanks see you next time and in the meantime go and make something awesome
Info
Channel: SuperHouseTV
Views: 63,435
Rating: undefined out of 5
Keywords:
Id: Gb8OR_mZodw
Channel Id: undefined
Length: 16min 36sec (996 seconds)
Published: Fri Nov 11 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.