After plenty of hit and trial with many one-of-a-kind controllers like OpenHab, DomotiGa, ago control, ultimately I determined to go along with Domoticz as Controller and MySensor for Nodes.
You should be questioning why I determined to build. I had a problem which I wanted to remedy. it all started with Water management. I live in a region where we get water supply for most effective 2hrs a day. this is once I should fill up the overhead tank so that i will use the water for daily intake. The trouble is the overhead Tank is on terrace above third ground and with out get entry to to ground as its locked. Secondly The water supply is from 4AM-6AM that is a totally inconvenient time. I cant understand how much water is saved and when its overflowing or while its empty.
So I decided to build my own water level sensor and a relay to govern the water pump.
How would it look like
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 using http://your-raspi-IP:8080
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)
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.
Building a Water Level Node with Relay
The first step is build the Ultrasonic sensor module for installation on water Tank.
Material used:
- HC-SR04 ultrasonic Module
- Some Wires
- Casing to hold everything together
- 2pcs 2 Pin terminal Block(I did not have any other connectors handy)
- 1pc Red Led
- 1pc 1k resistor
- 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.
- Solder female header pins on prefboard for Arduino and NRF24L01+.
- Build the Relay driver using the circuit shown.
- I have added a 3.3V Regulator using AMS1117 for NRF24L01+
- Once everything is in place tested the cuircuit
- For power supply I am using an old Nokia Charger I had lying around.
I have attached the sketch to control relay and read Utrasonic sensor using one Node.
The water level shown is in percentage. I dont know how I can get it display in % in Domoticz, but as of now it shows in cm but actually its in %.
The calculation is (Tank Height-Actual Reading)/3. The tank is 300cm high.
Automating the Motor(Water Pump)
You must be wondering where is the automation here. In Domoticz it supports Blocky. You can create your own rules to control.
Now in Domoticz goto Settings >>More Options>> Events and create 2 new events.
- If Time =5:00AM then Turn Motor On
- If Water level >=95 then Turn Motor Off.
- If Time >=6:00AM then turn off motor.
This would turn the motor on at 5 and once the water level is reached to 95 or time is >=6:00 then it would turn off the motor.
I have the temperature sensor already working, but its still on
Breadboard. Will complete it during weekend and upload. Also I am working on PIR and MQ-2 Gas sensor, still trying to figure out which sensors can be combined in one node. Thanks for reading and will be back soon with more nodes. In case you have any questions please feel free to ask will try to answer if possible.
Breadboard. Will complete it during weekend and upload. Also I am working on PIR and MQ-2 Gas sensor, still trying to figure out which sensors can be combined in one node. Thanks for reading and will be back soon with more nodes. In case you have any questions please feel free to ask will try to answer if possible.
Post a Comment