Tasmota + D1mini (or Sonoff) - Temp & Humidity, ws2812 LEDs, and Motion Detection

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
believe it or not there are actually other smart home devices in the world besides the Soloff I know I didn't believe it at first either but it's true as far as arduino-compatible Wi-Fi devices go the two most common are the note MCU and the d1 mini in this video I'm going to show you how to load test mode onto these boards and then add some new and useful things like a temperature and humidity sensor control programmable LEDs and a motion detector of course all using home assistant cuz that's what I do the brains in these little devices is the same as what's in the Sun off that's this esp8266 chip now the difference between the d1 mini and the sonne off is the number of available pins the Sun off basic has three pins that are easily accessible the d1 mini has 11 so that means you can connect a bunch of input devices like sensors and a bunch of output devices like relays or lights I've used the d1 mini for my holiday LEDs and for my first smart garage door opener it runs arduino sketches just fine but I'm not a trained Arduino code writer that's one of the big reasons why I use taz modem taz Moda is a great alternative to an Arduino sketch or the default firmware on some of these cool and cheap smart home devices tez Mota is really capable and I think it's pretty user friendly so I want to see what all we can do with tez Mota on the d1 mini the first step is to download the latest version of tez mota and the Arduino IDE if you don't already have them once you get the Arduino IDE installed open the Preferences and paste this URL into this box while you're here take a peek at where your sketch book is located we're going to need to copy some files there in just a second then go to tools board boards manager then search for esp8266 and install it then go to the Taz mota live folder and copy everything in there go to the location of your arduino sketch book that you just saw in your preferences and paste everything that you just copied from the tez mode of life older now open sonofa ino and then go to the user config tab add your Wi-Fi info your MQTT info and give it a unique project name one of the really nice differences between this board and the SONA is there's no funky procedure putting it into programming mode it's a development board so it's always going to be in programming mode just use a micro USB cord plug it into your computer and then select the comm port that just appeared now under tools select the board type and then make sure that the rest of your settings look like this now if you're using the node MCU board you may need to do another step before it will show up in your comm port slist I had to install this CP to 10x driver I think that's because the node MCU board has another chip on it I don't exactly know what it does but maybe someday I'll find out another important difference between the node MCU and the d1 mini is that the node MCU can run on 5 volts or 12 volts while the d1 mini can only use 5 volts so if you're using 12 volt lights using a node MCU board instead of a d1 mini means you don't need to add an extra power supply or a voltage regulator that's nice once your upload has hit a hundred percent go to your router or an app like thing and find the IP address of the new device then put the IP address into your browser that'll open up the Taz modem main page Taz Moda will set the device type as sawn-off basic by default to change it go to configuration configure module and then in the drop-down menu select generic in older versions of Taz mota it was called d1 mini or note MCU now it's just called generic now save and the board will restart when it comes back up go to configuration and configure module and now look at all those options every one of those boxes can be configured to do something so let's have some fun to mess around with this board and all these new options I bought a pack of 37 sensors for now we're gonna use a couple of what I think would be the most interesting and useful to folks a lot of folks are interested in getting temperature and humidity so let's connect that sensor first the one I have is the dht11 it's a pretty common model but there are others the Taz Moda website has a list of supported sensors and it tells you which options to select from the menu for each sensor if you don't see the sensor that you want to use that doesn't mean you can't use it it just means getting it to work is gonna take a bit more effort getting the temperature and humidity to show up in Taz mota is super easy the sensor has three wires one goes to ground one goes to voltage and the output goes to a GPIO pin go to the configuration module menu and for that GPIO pin select dht11 then save and the board will restart when it restarts you should see the temperature and humidity front and center now getting those values to show up in home assistant in some way that we could use them for automations was a little bit tricky but not too bad go to your configurations Yamma file or your configurator in a door and in the sensors section add this d1 mini 0 1 is what I called my project when I loaded Taz Mota on this board you'll need to put your own project name in the place of mine the tricky part here was getting the value template right if you look at the payload that gets sent on that topic it looks like this this is JSON formatting so it's in pairs you can see time has a value and temp unit has a value but dht11 has two values getting the template to pull the right value had me stumped for a bit thanks to me Hardy I wrote Russ for pointing me in the right direction the key was adding dht11 between a couple of periods to the template you may never have to use this again but it caused me enough trouble that I thought I'd better include it save your configuration file and restart home assistant with the template working you should now see temperature and humidity in home assist and two new sensors that you can use for automations like automatically buying a one-way ticket out of town when the humidity is above 85 percent now you could attach this same sensor to a sawn-off just connect the output to one of the other GPIO pins and the rest of the settings are the same so even though I'm using the d1 mini I'm still really thinking about my baby the Sun off for the next bit of fun let's connect some programmable LEDs Taz Moda is already set up to run ws2812 leds those are very common and easy to get they're essentially the same as the Adafruit neopixels if you've ever heard of those or use them before now if you're going to run more than a couple LEDs you're gonna want a separate power supply each of the GPIO pins on the d1 mini can only support a load of about 12 milliamps each of those LEDs requires between 20 and 60 milliamps so plan your power supply accordingly I've got a string of 5 volt LEDs so I use a 5 volt 3 amp power supply which provides enough power for the d1 mini and 150 LEDs connect the data pin from your LEDs to one of the GPIO pins on the d1 mini and then int as mota select ws2812 for that pin of course make sure you have the positive and negative kin that on the LEDs - after that hit save and the board will restart again when it comes back up you'll have a dimmer slider and a toggle button to play around a little bit with the available effects in Taz mota go to the console and use the color scheme and dimmer effects there's a couple other things - like speed and fade when you want to trigger the lights from home assistant you can call the service mqtt publish with topics and payloads that look like this I think one of the most useful things is going to be to have the payload be a plus or a minus for different buttons that's cool next step is to go back to your configuration Yama file or the configurator rn8 or under the lights section and copy in this after you do that save and restart home assistant now you should see a new light on your overview page when you turn the light on and click on the little light bulb or the name of the light you'll get a color wheel and the dimmer slider that's cool now let's set up the PIR PA R stands for passive infrared we typically use these as motion detectors but they're not really detecting motion they're detecting Heat and as someone pointed out in the chat in the last live stream they should only detect large balls of heat like humans and ignore small balls of heat like pets well most pets like most other sensors the PIR has three pins voltage ground and output of course the output goes to one of the GPIO pins but if you look in the options on the drop down menu you won't see one that says PIR the PIR is essentially a switch so for this sensor we're just gonna select switch now in taz mota switch one is defaulted to control relay one so if you want the PIR to directly control the relay set it as switch one but I wouldn't recommend doing that mostly because the way the PIR works it doesn't just go on when it detects a large ball of heat it goes on and then off and then it goes back on and then back off and then back on and back off and then back on and back off you catching the pattern here so if you connected that directly to your relay it'd be kind of messy it's better to use the on and off as a trigger for an automation once you've selected switch to for one of your GPIO pins hit save and it'll restart now to set the MQTT topic for that switch when the board starts back up go to console and then type switch topic to space and then whatever you want to use for the topic for your PIR sensor for my example I set my topic to d1 mini 0 1 PIR if you're setting this up for your house it probably makes sense to make the topic associated with the location where you've got the PIR sensor it'll make things a lot easier to sort out in your automations for the PIR there's a few things we need to set up in home assistant first you need to go to the configuration TM will file and setup a new binary sensor the platform is MQTT and the name is whatever you want the important part is that the middle section of this topic matches whatever you put after switch topic to in the Taz Moda console if you haven't got that right it won't work next we want it to a home assistant what kind of binary sensor this is so in the customized section we set the device class as motion there are like 20 different kinds of binary sensors you can use and all of them essentially act like a switch so they'll be set up the same way now to get the motion detection to actually do something we need to set up an automation in this case you can't use the automation editor at least when I tried I ran into some problems but with this automation in the configuration dot yam will file it worked fine if that guy would help me set up this automation I'd thank him but since he didn't I won't well that's it if at any point you've made use of Taz mota I hope you make it a point to head over to Theo's github page and let him know how much you appreciate what he's done I can't imagine how much time has gone in to putting together this bit of software and I for one I'm super thankful for it so Theo here's to you now the Salt Lake City Maker Faire is coming up fast in the next few days we're gonna be working real hard on the display so I should have some fun stuff to share and hopefully at least a few of you will be able to come by and say hi when we're there one last thing my last livestream a couple people asked me if I do this full-time I wish I did but I don't if you think what I'm doing is cool and you want to support me the best thing you can do is click on the product links that I put in the description or on my website it doesn't cost you anything extra and you don't even have to buy the product that you click on just using my link to get to like Amazon and buy anything else helps me out that's all for now hope that was helpful to you as always thanks for watching until next time adios [Music] you [Music]
Info
Channel: DrZzs & GrZzs
Views: 199,847
Rating: undefined out of 5
Keywords: Home Automation, Home Assistant, Tasmota, Sonoff, D1mini, NodeMCU, Arduino, Motion Detection, PIR, Temperature, Humidity, ws2812, LEDs, Programmable LEDs, Smart Home
Id: sVml02kP3DU
Channel Id: undefined
Length: 11min 17sec (677 seconds)
Published: Mon Mar 19 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.