One of the less well publicised services offered at LiveHouse is custom Home Automation and IoT Sensor design. I really should make more noise about it because these projects are the most fun to work on. The customers that bring these ideas are the ones who are thinking smart about solving practical problems with the investment they've already made in home automation technology.
Yeah, it's nice to not answer another question about whether Alexa or Google is a better smart home hub. For the record, the answer is neither. Get a dedicated automation controller and use one of them as a voice interface.
But I digress...
This project came from one of our customers in Queensland. He has 3 water tanks that he wanted to be able to monitor the levels of. Then water use could be tracked and the information could be used to make decisions about when it was necessary to use mains water rather than the tanks.
The solution needed to meet these requirements:
- Simple and therefore inexpensive
- Water/Weather Proof
- Accurately measure the water level in a 1.7m deep tank
- Wireless data communications
- Integrate with existing Vera Automation Controller
Fortunately I have a bit of experience in a number of these areas, except one.
Measuring Water Level
Measuring water level is an interesting challenge. You could use multiple float sensors to indicate when the water level is at or below a specific level, as I did in my Auto Pool Fill project. This is probably ok if you just want a high-medium-low indication. But it's pretty difficult to install in a smaller rain water tank.
There are sensors used in fuel and water tanks on boats and caravans, however these fail the inexpensive test. Likewise the eTape sensors, which also have a limited length.
Another option is to use Ultrasonic sensors, basically bouncing sound off the top of the water. I've previously used ultrasonic sensors for measuring the distance from my garage wall to the front of my car - basically a parking sensor that Vera can use in logic related to the garage door.
Things get a little bit trickier inside a water tank however. The walls of the tank might be a source of reflections and echoes that prevent the ultrasonic sensor from operating correctly. The surface of the water isn't always going to be calm - when water is rushing in from the gutter you don't want to see readings bouncing around on Vera.
I've often said that going from 0 to 1 is the hardest part of any project, and there is always a chance that things won't work as intended on the first attempt.
The starting point was choosing a sensor. There are very few inexpensive waterproof Ultrasonic sensors available. The one selected was the DYP-ME007Y which is typically used on vehicles and has a range of 0.3m to 3.5m according to the spec sheet.
It conveniently has a 1.8m cable allowing the electronics to be well separated from the transducer which makes the design and installation a lot easier.
The sensor was paired with a protoboard containing voltage regulators, an amplified nRF24L01 radio and an Arduino Nano. This was mounted inside a weatherproof enclosure so it could survive outdoors.
Communications between the sensors and Vera are via a MySensors Ethernet Gateway. You might be asking yourself, why not Z-wave? Well, it's entirely doable as there is an Arduino board with Z-wave, the Z-Uno. The problem is the cost, and with 3 sensors this added up quickly. Also the customer has a desire for Pool and Irrigation control based on our previous projects, so a MySensors network was the better choice.
After allowing for various filtering techniques to maintain stable readings, the sensors are tracking the water level to a 0.01m resolution, and updating Vera at most every 10 seconds if the level changes.
In addition to the sensors themselves, the customer commissioned the development of a plug-in for Vera that would use the distance device as an input and provide a % capacity and the volume in litres of each tank. This plugin also provides scene triggers so that automation can be driven by changes in the water levels. It also gives you something a lot more human friendly on Vera's web interface.
In the Real World
The sensors have been installed, and are so far working as expected. The real test will be how they handle the turbulence of incoming rainwater and very low levels of water where the sides of the tank might become an issue and create echoes.
If any updates are required to the firmware on the sensors, they can be updated by USB or the Arduino is socketed and can be swapped over with an updated one.
It's always a pleasure to work with a customer who has a big picture view and understands what capabilities their home automation system needs to have to make that a reality. Thinking in terms of infrastructure, rather than point solutions means that while some of the initial investments will be larger, down the track adding more capability will be cheaper, and the integration will be simpler and tighter.
They already have their eye on our reticulation project and you can see how the reticulation controller could use the water tank sensors as an input to decisions on which tanks to use or when to switch to mains. It'll leverage the MySensors network and Vera integration they've already invested in.
There are dozens of different Arduino compatible sensor types available that can be used to build sensors that aren't available on the shelf next to your typical smart home gadgets.
If you've got a project idea, chances are we can make it a reality.