In this short series, we’re going to get you set up with a completely DIY home automation system using MQTT. Why? Because it’s just about the easiest thing under the sun, and it’s something that many of you out there will be able to do with material on-hand: a Raspberry Pi as a server and an ESP8266 node as a sensor client. Expanding out to something more complicated is left as an exercise to the motivated reader, or can be simply left to mission creep.
We’ll do this in four baby steps. Each one should take you only fifteen minutes and is completely self-contained. There’s a bunch more that you can learn and explore, but we’re going to get you a taste of the power with the absolute minimal hassle.
In this installment, we’re going to build a broker on a Raspberry Pi, which is the hub of your MQTT network. Next time, we’ll get an ESP8266 up and running and start logging some data. After that, we’ll do some back-end scripting in Python to make the data speak, and in the last installment, we’ll explore some of the useful frills and fancy bits. Let’s get started!
Continue reading “Minimal MQTT: Building a Broker”
How minimal can a decent home automation setup be? If you need an HTML frontend, you’re going to need a webserver. An ESP8266 will do the trick. And then you need to be able to control your electronics. The cheapest and easiest way to do that is with the ubiquitous 433 MHz remote-controlled outlets and a $1 radio unit from an online auction site. Add in a cheap ESP8266 module, and your total outlay is going to be under $20.
That’s exactly what [Nikos Kantarakias] did. He combined a bunch of available ESP8266 Arduino libraries — one for driving the 433 MHz radio modules, [Paul Stoffregen]’s libraries for keeping time and for setting alarms, and another for keeping track of time zones — with some of his own code for setting up WiFi access, and it’s done.
It’s all available on GitHub for your perusal. The code does some strange things — like requiring a complete reboot every time you set an alarm — but it does let you set recurring and one-off activations of the attached devices with a web interface that’s served off the ESP8266 itself. If you want your coffee machine to turn itself on in the mornings, and want a system that’s easy for the other inhabitants of your house to configure, something like this might be just the ticket.
But if you’re looking for a project on the other end of the ESP-tech spectrum, [CNLohr] wrote a standalone Ethernet controller for the thing. Woah.
If you’re playing Hackaday Buzzword Bingo, today is your lucky day! Because not only does this article contain “Pi 3” and “IoT”, but we’re just about to type “ESP8266” and “home automation”. Check to see if you haven’t filled a row or something…
Seriously, though. If you’re running a home device network, and like us you’re running it totally insecurely, you might want to firewall that stuff off from the greater Interwebs at least, and probably any computers that you care about as well. The simplest way to do so is to keep your devices on their own WiFi network. That shiny Pi 3 you just bought has WiFi, and doesn’t use so much power that you’d mind leaving it on all the time.
Even if you’re not a Linux networking guru, [Phil Martin]’s tutorial on setting up the Raspberry Pi 3 as a WiFi access point should make it easy for you to use your Pi 3 as the hub of your IoT system’s WiFi. He even shows you how to configure it to forward your IoT network’s packets out to the real world over wired Ethernet, but if you can also use the Pi 3 as your central server, this may not even be necessary. Most of the IoT services that you’d want are available for the Pi.
Those who do want to open up to the world, you can easily set up a very strict firewall on the Pi that won’t interfere with your home’s normal WiFi. Here’s a quick guide to setting up iptables on the Pi, but using even friendlier software like Shorewall should also get the job done.
Still haven’t filled up your bingo card yet? “Arduino!”
If you’re building an omniscient home-automation system, it’s ability to make decisions is only as good as the input you give it. [Petewill]’s self-made panopticon now knows when someone is in bed. That way, the [petewill]’s automatic blinds won’t open when he’s sleeping late on weekends.
[Petewill] didn’t take the easy way out here. (In our mind, that would be a weight sensor under one of the bed’s feet.) Instead, his system more flexible and built on capacitive sensing. He’d tried force sensors and piezos under the mattress, but none of them were as reliable as capacitance. A network of copper tape under the mattress serves as the antenna.
Continue reading “Are You in Bed?”
If you just want to prevent your garden from slowly turning into a desert, have a look at the available off-the-shelf home automation solutions, pick one, lean back and let moisture monitoring and automated irrigation take over. If you want to get into electronics, learn PCB design and experience the personal victory that comes with all that, do what [Patrick] did, and build your own ESP8266 based irrigation controller. It’s also a lot of fun!
[Patrick] already had a strong software background and maintains his own open source home automation system, so building his own physical hardware to extend its functionality was a logical step. In particular, [Patrick] wanted to add four wirelessly controlled valves to the system.
Continue reading “ESP8266 Based Irrigation Controller”
Speech recognition coupled with AI is the new hotness. Amazon’s Echo is a pretty compelling device, for a largish chunk of change. But if you’re interested in building something similar yourself, it’s just gotten a lot easier. Amazon has opened up a GitHub with instructions and code that will get you up and running with their Alexa Voice Service in short order.
If you read Hackaday as avidly as we do, you’ve already read that Amazon opened up their SDK (confusingly called a “Skills Kit”) and that folks have started working with it already. This newest development is Amazon’s “official” hello-world demo, for what that’s worth.
There are also open source alternatives, so if you just want to get something up and running without jumping through registration and licensing hoops, you’ve got that option as well.
Whichever way you slice it, there seems to be a real interest in having our machines listen to us. It’s probably time for an in-depth comparison of the various options. If you know of a voice recognition system that runs on something embeddable — a single-board computer or even a microcontroller — and you’d like to see us look into it, post up in the comments. We’ll see what we can do.
Thanks to [vvenesect] for the tip!
[nebulous] has a lot of problems with his kitchen cabinets. Aside from a noted lack of micro-controllers, he was especially suspicious of the dark spaces under them. Anything could be hiding there.
The core of the project is a $10 Arduino-compatible esp8266 board from digistump. The board is powered by the five volt regulator of an L298N motor driver module hooked to a power-supply. All this controls a set-of LED strips adhered to the underside of the cabinets with the traditionally bad adhesive strips with which they come standard. We can predict an hour spent bent awkwardly cursing at them, a hot-glue gun in one hand, in [nebulous]’s future. The whole set-up is housed in a SparkFun cardboard box above the microwave. You can barely tell it’s not a commercial product.
We’re not certain if we like a future where even our cabinetry has an IP address. However, this is a good weekend project that could make all our cabinetry brighter, safer, and more connected.