Experiments with smart house equipment

As usual men, I have 3 goals: plant a tree, grow a son, ant build the house. First one is done, second one is in progress, so it’s time to start third one. I’m little bit IT guy, so thinking about smart house. Digging around the internet, I found cheap smart switches, whose may help to improve house characteristics, ant make it smarter. Here they are:

I ordered some of them, to test build quality, and possibility to integrate with central smart house control system. From first view, they looks futuristic, have touch interface, works on wifi, let’s try to integrate with home automation system.

By default, these switches can be controlled over smart phone app, or directly by touch button. App is created by manufacturer, and has no possibility to integrate with home automation system. Also, communication works over internet with third party server, which stands over the ocean, so it’s not the best idea to trust this design. So, lets improve this design, with opensource solutions. Browsing github, I found project, which are ideal for my requirements: https://github.com/arendst/Sonoff-Tasmota

Main features required: works ower wifi, can be controlled over MQTT broker, and best of the best: can be flashed/upgraded over OTA. Few weeks ago, when I discovered this project, firmware upgrade procedure was (or I thought that it was) complicated, as additional programming pins should be soldered. This is not big issue, as these devices has lot of space to solder programming pins, but later I had big success, finding that these devices can be upgraded over OTA: over-the-air upgrade. So let’s start to hack this device:

First of all, I need to prepare laptop for this task:

  1. install python 3.5 in windows 10 (yes, I know, windows is not the best option for home use, but this is another topic) 🙂
  2. download magic sonOTA script: https://github.com/mirko/SonOTA
  3. install required libraries for sonOTA: pip3 install –user -r requirements.txt
  4. start the magic stript: python sonota.py, read instructions in console and let the magic happen.

In short, this script will push opensource firmware over OEM upgrade channel. Detailed instruction are written in hithub, so I don’t rewrite it here. After upgrade, smart switch was connected to home wifi network, got IP address and publishes web page, where you can configure various settings, as mqtt server address, smart switch hostname and other fancy stuff.

In my lab, I have Raspberry, running Openhab as smart home automation system, ant Mosquitto as MQTT server. So the last step, is to integrate smart switch to the smart home. As this smart switch has MQTT support, this task is easy. first of all, I created new item in Openhab:

Switch jungiklis <light> {mqtt=”>[openhab:Light/sonoff/cmnd/power:command:ON:1],>[openhab:Light/sonoff/cmnd/power:command:OFF:0],<[openhab:Light/sonoff/POWER:state:ON:ON],<[openhab:Light/sonoff/POWER:state:OFF:OFF]”}

Second, include this item to sitemap:

Frame label=”Apsvietimas”{
Switch item=jungiklis label=”Apšvietimas” mappings=[ON=”Įjungtas”, OFF=”Išjungtas”]
}

Vualia, now I can control room light with touch button, or over my phone via Openhab, or can create some automation script, and let smart home control lights automatically, is it not fancy? 🙂

 

At last interesting DIY project found

I always wanted to find interesting DIY project, where I can program, solder, and research some technology, by result creating useful stuff. Some time ago I found some cheap LORA modules, which allows create wireless communication between devices. Arduino also are good sandbox, which allows easy join some devices together, using tons of Arduino libraries available. So here are the main components for first recipe:

  1. Arduino nano:It’s one of smallest Arduinos available on the market, but still powerful enough to create some useful stuff, especially for the first project. Also, these modules are very cheap in China market.
  2. Oled display:These displays are also useful for printing useful information to the end user, or developer for source debug purposes. I2C communication allows connect these modules easily to Arduino board.
  3. LORA modules:I choosed Ra-01 module. These modules are small enough, allowing small product creation, using popular SX1278 chip inside, 100 mW transmit power, theoretically providing range up to 10 KM, it’s more then enough creating first communication to remote device. And one of the best option, there are Arduino library available for these chips. In the market exists Ra-01 baby sister: Ra-02 which have small antenna connector:At the moment I do not have this type of antennas, so choose first version of the board, but in the future there is posibility to upgrade with ease.

With these components, my goal is to create two independent Arduino boards, both sending each other some information, and display this information in the oled screen. After that, we will see how these components works together, and what usefull stuff we can create, maybe some Smart House device, who knows. See you soon 🙂

Hello world!

Hello and welcome to another one site about hobby and interests. Today was the big day, when I decided to publish some topics about my hobbies, and more interesting projects. I can’t promise update this site as usual as it can be, but I hope that we will see soon 🙂