Home Automation – HA4IoT (Windows 10 IoT)

Story

Update 2: The project is still growing and a lot of new features are already implemented (like a Twitter-Client and the integration of Telegram-Bots). Please check the GitHub repository and release notes to learn more about the new features (or follow me on Twitter) . I hope I am able to update this project page as soon as possible.

Update 1: First I want to say “thank you” to everyone who has read this project page and gave me feedback (either private or at the comments). It was a lot of fun to present this project at Maker Faire Rome 2015 and Microsoft Technical Summit 2015 and future events are still waiting. I added some pictures from the events.home automation ha4iot windows 10 iot

I am developing a home automation solution for the last 3 years. This includes the physical installation of the hardware and developing the software.

Features

At this time, the following features are supported.

Inputs

Outputs

  • Lamp (ceiling) (driven by relay, no dimming)
  • Socket (driven by relay, no dimming)
  • Roller shutter (window) (driven by two relays for up and down)
  • Fan (ceiling) (driven by 3 relays for every gear)
  • Bathroom fan (driven by 2 relays for every gear)

Other features

  • The solution contains a web app for iOS, Android, Windows, Mac OSX which can be used to control the virtual actuators. The configuration for the web app is loaded from the controller (Windows IoT instance).
  • All events generated by inputs and outputs can be published to a Microsoft Azure Event Hub and/or logged to a CSV file.
  • The controller (Windows IoT instance) provides UDP based tracing which can be shown using a console application. The trace is very detailed and can be used to find bugs or wrong connected actuators etc.
  • Custom actuators can be added to support more hardware.
  • Physical outputs can be combined to logical outputs.
  • Animations (the physical outputs within a logical output can be animated).
  • The whole system is designed to be as resistant to errors/hardware failures as possible. Even if multiple core components are disconnected/broken the remaining system still works as intended (e.g. some of the boards in the living room are not reachable due to a hardware failure, but the bathroom still functions as intended)
  • Support for 433Mhz remote relays.

The concept

As we renovated our home 3 years ago, I decided to implement my own home automation solution. The main idea behind the implementation is to control everything from the power distributor using relays. Due to this decision every button, lamp, socket, roller shutter etc. needs to be connected by it's own cable via the actuator to the power distributor. A bus like KNX or EIB is not required.

Note: Due to the fact that I live in Germany, every component is designed to work with the 230V power supply. Other kinds of power supplies may need further modifications. The installation of 230V cables (NYM), new power distributors etc. are done by my preferred electrician and not by myself.

Hardware

The new power distributor

We installed a new power distributor which is responsible for the two floors of our home.

The I2C bus

In general, the I2C bus is not designed to work with longer cables but it is possible to increase the maximally possible length using some tricks (I do not know the reason for every optimization but these are the things I found at the WWW).

  • Drive the bus at 5V. The RaspberryPi drives the bus at 3.3V, so a I2C level shifter (P82B96) is required. This is the first (and only) device which is added to the RaspberryPi 2 (called Controller in my solution). The cable for this connection should be as short as possible. The specification allows running the bus at up to 15V but the slaves like PCF8574 only support max 5V.
  • Use a twisted pair cable like CAT7. It is important to use one pair for SDA&GND and another one with SCL&GND. Do not use a single twisted pair cable for SDA&SCL. Also ensure that the shielding of the cable is connected to PE (in Germany).
  • Prefer a strand cable. This makes it more complex to connect everything but will boost up the length of the cable.
  • Add pull-up resistors with 10k to the end of the bus for SDA and SCL.
  • Limit the bus speed to 100kbits (Standard Mode) even if the slaves supporting faster speeds.
  • Include a I2C buffer (P82B96). The IC can be used as a level shifter or can be used to separate the bus in physical segments. I used one of this buffers within the power distributor. The buffer should be placed at the middle of the bus.

This optimized I2C bus is used to connect every board within the power distributor.

The relay boards (outputs)

CCTools from Germany sells boards with relays which can be connected to the I2C bus. It is also possible to buy the boards as individual parts or the circuit board only. This allows replacing the port expander with pin compatible alternatives. The former is required because the available addresses of the devices are limited. I added holders for the relay and ICs so I can replace them easier if one o them is broken. Another point is that I can use a PCA9555D instead of a MAX7311 because the PCA9555D is cheaper and can be ordered easier (in Germany).circuit home automation ha4iot windows 10 iot

The HSRel5 relay board has 5 relays and 3 GPIOs. All required ports are taken from the internal PCF8574 8bit port expander which has 8 GPIOs. The first 5 are used for the relays and the last 3 can be used for other outputs. The relays require 12V to operate which can't be provided by the port expander (which can only drive a LED). So, a relay driver is needed.  The relays are connected with the relay driver and the relay driver in return is connected to an inverter. This inverter is required because the state of all ports at the port expander is HIGH after the IC gets power. This will close all relays, which is an unintentional behavior.

For more detail: Home Automation – HA4IoT (Windows 10 IoT)


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

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

Scroll to Top