Starting home automation project

Some time ago I decided to start my own home automation project to manage most of devices in my home. At that point I didn’t know a lot about technologies, protocols and other things around. I also didn’t know what I have to automate and where I will have technical, software or any other restrictions.

Now I understand much clearly what I want to do and how it should looks like, this way wasn’t simple and I spent a lot of nights without sleep, but now my picture is sharp as 4K video, this is a result of many my personal mistakes. I’d like to share my achievements with enthusiasts like me and any other people who have interests in this area.

Let me roll the film one year back of this project.

First of all at that time I have read a lot about ATMega328 chip and Arduino controller based on that chip,  also devices, switches, sensors which could be connected and controlled through digital or analog pins. I was excited when red about projects made by other “home engineers”. Based on this “draft” in my mind I ordered couple of Arduino Nano controller,  USB to TTL convertor, breadboards, soldering iron, bought passive elements such as resistors, capacitors, wires, temperature sensors, 1-2-4-8 relay switches and even motors (which never used in my project).


I started to write C code in Arduino studio to manage digital output on the board which has been connected to the relay board. Amazing! I can control relays switches directly through the code. For me it means that I can control some physical stuff from the code.

Then I continued my research to figure out how I can control the same module remotely. First of all I’ve found RF transmitter/receiver modules which could be connected directly to Arduino board, but these modules provide only physical layer of connection. They are do not implement any network protocols such as TCP/IP or something similar. I just didn’t want to implement my own network protocol  through radio these modules. And then I found.

On the market has been just released ESP-01 module based on ESP8266 chip which is small, powerful  and support Wi-Fi connection and TCP/IP stack. Bingo!  Thank you engineers, I’m shaking your hands.

Out from the box at that period of time this module supported AT commands in Terminal to manage device. Well, not really convenient option, but better than nothing. Another one thing which I figured out that two devices are using different power voltage, 5V for Arduino and 3.3V for ESP, relays are also using 5V logic. The good thing that Arduino has internal power step down convertor and able provide 3.3V to external devices. I went by this easiest way but after some testing found that this solution is not reliable and then installed independent step down convertor exclusively for ESP-01 from main power source.

After some development and a lot of research I’ve connected Arduino module with ESP-01 using AT commands and made solution stable. Now I did have connection between modules and wireless connection to my home Wi-Fi network, the next goal was implement some protocol to use switches remotely. My firsts test has been based on standard TCP/IP stack and sending 0 or 1 to the ESP-01 module, not really bad implementation but not scalable.

I continued my research and found that for IoT best option for my goals will be using Mosquitto server to transport messages between devices in network. Again a lot of research and then I’ve found implementation for MQTT for Arduino module, by the way I flashed different firmware by independent engineers to ESP-01 to work not using AT command but to have more native support of communication.

To manage devices in my network I had chosen to use Raspberry PI as a home micro server as central point of communication. At that moment I was able to switch relays remotely using MQTT protocol by sending 0 or 1 to the device through Raspberry PI. Fantastic! Very close to make life convenient.

Last thing, control system. I spent again a lot of time to test frameworks/solutions to use in my project. I stopped on OpenHAB. Well, really nice solution, flexible, customizable and powerful, but never works ) A lot of bugs, base functionality which could be changed in next night build and break whole system, hard way to determine root of cause and etc – a lot of pain I got with OpenHAB. I tuned  my solution to work somehow, used a lot of glue and even chewy gums and got my manageable switches through web page and mobile app. Incredible!

Conclusion. My first home automation step has been completed, I used next stack to achieve my goal and manage lights in my garden:

hardware – Arduino Nano(ATMEGA328), ESP-01(ESP8266), Raspberry PI

software – Moquitto, Openhab, C, Java

Based on my current experience I’d say that my project has been successfully completed and I achieved my goal, but like at very known picture below.

Leave a Reply

Your email address will not be published. Required fields are marked *