Home Automation using Raspberry Pi, Arduino, Domoticz, MySensors.

Hi Fellow makers,

This is my first Instructable on Home Automation. The idea is to build a controller and wireless nodes to control and monitor.

After a lot of hit and trial with many different controllers like OpenHab, DomotiGa, Ago Control, finally I decided to go with Domoticz as Controller and MySensor for Nodes.

You must be wondering why I decided to build. I had a problem which I wanted to resolve. It all started with Water management. I live in a area where we get water supply for only 2hrs a day. This is when I have to fill up the overhead tank so that I can use the water for daily consumption. The problem is the overhead Tank is on terrace above 3rd Floor and without access to floor as its locked. Secondly The water supply is from 4AM-6AM which is a very inconvenient time. I cant know how much water is stored and when its overflowing or when its empty.

So I decided to build my own water level sensor and a relay to control the water pump.Home Automation using Raspberry Pi, Arduino, Domoticz, MySensors.

Step 1: How would it look like

Step 2: Preparing Raspberry Pi

Lets begin buy preparing Raspberry Pi as a controller. I have used Domoticz as a control software.

  • Install Domoticz on Raspberry Pi. Download the software from Domoticz Download
  • Burn the image to SD card using Win32 Disk Imager
  • Now plug in the SD card and boot.
  • Connect to Raspberry Pi using terminal
  • Run command sudo raspi-config
  • Apply Expand File System.
  • Reboot.
  • Now you can access the Controller software.

Step 3: Adding Gateway to Raspberry Pi

Now we will create the gateway, so that the nodes can communicate.

For gateway we will use

  • NRF24L01+
  • Arduino Uno or Arduino Mini Pro
  • USB Cable to connect with Raspberry Pi
  • Some cables.
  • LED's 2-Green, 1-Red, 3 – 1K resistor (Optional)

Follow instructions here to connect the NRF24L01 module to Arduino.

Now load the Gateway Sketch on Arduino. Skecth is available here

Once done, connect Arduino to Raspberry pi using USB cable.

Now we will configure the gateway on Domoticz. Goto Setup>> Hardware.

  • Type in any Name you want for Gateway
  • Select type as MySensor Gateway USB
  • In Serial Port if detected it would show USB01 or USB02. Select it.
  • Check Enabled.
  • Click Add.

The optional LED's can be used to Show the TX,RX, Error status on getway.

Now your gateway is ready to accept new nodes.Home Automation using Raspberry Pi, Arduino, Domoticz, MySensors. schematic

Step 4: Building a Water Level Node with Relay

The first step is build the Ultrasonic sensor module for installation on water Tank.

Material used:

  1. HC-SR04 ultrasonic Module
  2. Some Wires
  3. Casing to hold everything together
  4. 2pcs 2 Pin terminal Block(I did not have any other connectors handy)
  5. 1pc Red Led
  6. 1pc 1k resistor
  7. Some hot glue to keep everything in place.

The instruction on connecting the wires can be found here

Now will build the receiver for Ultrasonic sensor.

  1. Solder female header pins on prefboard for Arduino and NRF24L01+.
  2. Build the Relay driver using the circuit shown.
  3. I have added a 3.3V Regulator using AMS1117 for NRF24L01+
  4. Once everything is in place tested the cuircuit
  5. For power supply I am using an old Nokia Charger I had lying around.

For more detail: Home Automation using Raspberry Pi, Arduino, Domoticz, MySensors.

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Follow Us:
Scroll to Top