Archives

All posts for the month June, 2019

ABSTRACT

So you may recall my tank notification project whereby I create alerts to our mobile phone to notify us to empty the tank for the dehumidifier in the basement.  That project was cool, but it didn’t really come full circle.   I got tired of emptying that beast daily!  After all, who needs home automation if you can’t get your house to actually do all the work for you?  The point of automation is to transform a process workflow into a repeatable sequence of steps and turn those steps into actionable smarts, output, or work requiring little to no human intervention.  Sure, there are self-emptying dehumidifiers out on the market but I decided to build my own automated tank for the following reasons:

  • Because I can!
  • Commercially available self-emptying dehumidifiers often fail – their pumps wear out often
  • As a learning exercise – to learn the needed bit of knowledge and transform that knowledge into a process plan
  • Because, why the fuck do I want to empty a 5 gallon container of water every day during the humid seasons???

MY PROCESS

As the humidifier runs, the tank fills – this is basic physics at work.  During filling, the level rises.   Tank level is something we can measure and turn into system input.  To solve this problem, I need to know the following things:

  1. When the level reaches maximum – How do we measure that?
  2. How to communicate our input to the central computer so we get notified and so we can send instruction to the pump to turn on
  3. We know we need to turn the pump on at maximum level to prevent overflow (and a mess, and unhappy wife)
  4. How do we know when to turn the pump off?  We don’t want to run a dry pump – that is bad!
  5. Communicate tank status during draining
  6. Send signal to turn the pump off – what logic is used to define an empty tank and only run the pump when there is water present

NOTE: It is desireable to keep pump cycles to a minimum so we preserve the life of the pump.  This is why a 10 gallon container is used to collect condensate.  I use a 1/3 horsepower submersible pump to drain the container.  Drain time is about a minute.

1)

We can register maximum level using a float sensor.  In this design, I use two.  One at maximum level and one at minimum level.  This allows me 3 possible states to power the logic needed to drive the decision to turn the pump on and off as needed but not let the pump run dry. (VERY important!)  The float sensor I used was sourced from Amazon and looks as pictured here.  

 

This sensor was not ready to be used just yet.   I had to make a mount for it out of PVC, so that I could set the correct height.  I didn’t want the maximum tank level to be too close to the tank lid, that would just be too risky.  One of these is also set much deeper into the tank to register the minimum reading.

 

 

 

 

2)

Once we have the sensors mounted to the lid, and proper depth set, we can now read these using (you guessed it) an ESP8266 wireless MCU running my favorite flavor of open source firmware, Tasmota.  I have found so many versatile uses for this firmware which runs reliably on ubiquitous $6 modules.  Just two pin inputs and a ground connection are all that are required to read the sensors.  To hook them up, I used 4 conductor solid telephone wire from the terminals to the sensor wires.  

The ESP8266 was connected to both sensors and shared a common ground.  When the status is read (either ON or OFF) we use a rule to format an MQTT message to a computer running Domoticz (this should also work with other HA software apps as well).  On the Domoticz HA computer, we declare two integer values (1 or 0) and set them (click for larger image): 

Once those are in place, we can then setup a logic structure to power the decisions on when and when not to apply power to the pump.  In Domoticz, it’s super easy to create a logic scenario.  If you can click and drool with a mouse, you can implement a LUA script or a block type logic like this (click for larger image):

Every time the sensor state changes, the variables we set get updated by a rule placed into the Tasmota firmware console:

rule1 on POWER1#state=1 do publish domoticz/in {“command”:”setuservariable”,”idx”:5,”value”:”1″} endon on POWER1#state=0 do publish domoticz/in {“command”:”setuservariable”,”idx”:5,”value”:”0″} endon

rule2 on POWER2#state=1 do publish domoticz/in {“command”:”setuservariable”,”idx”:6,”value”:”1″} endon on POWER2#state=0 do publish domoticz/in {“command”:”setuservariable”,”idx”:6,”value”:”0″} endon

These two rules allow us to create the MQTT message when the event is triggered by a sensor action when the water rises or falls.  This message then updates the variables on the Domoticz computer and the logic re-evaluates the situation.   This process occurs constantly and allows us to run the pump only when needed and when it is wet.  We also get notified on our mobile device when the pump turns on and when it turns off so we are aware.

3)

What pump did I use anyway you ask?  I found this gem on Amazon (Amazon ASIN B000X07GQS) and boy is it FAST!:

In order to turn this on and off by command, I used one of the famous KMC70011 WiFi outlets which I re-flashed with Tasmota (I don’t like Chinese servers having control of my shit)  These are very reasonable on Amazon, and when you liberate them from their Chinese overlords, they are AWESOME!  Reflashing with Tasmota is fairly easy and these are easy to open and make the right connections.  They are also ETL certified for safety.