Overflow Tank Magnetic Shutoff
by Airplanedoc in Circuits > Arduino
1135 Views, 13 Favorites, 0 Comments
Overflow Tank Magnetic Shutoff
In my workshop I have a portable air conditioner, on the corner of my workbench, to take the edge off in the summer heat. I have a window that I can exhaust the hot air out of. However, I don't have a place convenient place to drain the condensate, and constantly draining the AC unit is not practical for me. Currently I am using a small bucket on the floor, which the overflow hose drains into. I have accidentally overflowed this bucket more than once. Today, that all ends. Using a sonoff smart switch, Home Assistant, a magnetic float switch, and a ESP8266 I am building a auto shutoff, when the water level fills the overflow tank it will automatically shut off the AC to prevent overflows when I am not paying attention.
Supplies
Supplies
1 Rubbermaid small recycle bin from big box hardware store $7.99
1 Magnetic Float Switch from Amazon $8.99
1 ESP8266 from Amazon $6.99
1 Sonoff S31 smart switch from Amazon $7.99
1 phone charger cord Free from junk drawer
1 Travel soap box From Dollar Tree. $1.25
Misc items wire, tape, self adhesive clips heat shrink tube
Total Price $33.21 so $35 with some misc consumables at the time of writing.
Tools
Soldering iron
Hole punch for float switch
Hole punch for the drain line
Wire strippers
Lighter
Software
Home Assistant
Tasmotizer
Latest Tasmota Bin file
Prepare the Collection Tank
- Drill or punch the correct size hole in the Rubbermaid recycle bin for the float switch.
- Insert the gasket for the float switch in the hole.
- Insert the float switch.
- Tighten the nut on the float switch.
- Drill or punch a Smaller hole above and to the side of the float switch for the condensate line.
As you can see I chose to install the float switch and the condensate line on the long side of the recycle bin. This particular bin has a smallish handle area on the narrow sides. I did not want the electronics on near the side where I would be carrying the bin to dump it out, or under where I likely would be pouring the water out. I placed the condensate line about 1" higher than the float switch, so it would always be able to drip. I also placed it about a 1" to the left of the float switch.
Flash the ESP8266 Chip
Now its time to load software on your esp chip. I like to use Tasmota for my devices but you may also use ESP Home. I will show the steps to load tasmota as that is my preferred setup.
1.Begin by plugging a power cord into your esp8266.
2.Open Tasmotizer on your computer
3.Plug your chip into a usb port on your computer.
4.Select your port and Bin file then click Tasmotize
5.Unplug your chip, and plug it back in
6.Select Configuration and set up your wifi and Mqtt info
7.Select get IP address
Wire Up the Sensor
Now its time to wire up the esp8266 chip. I had a DHT22 laying around so I also configured a temperature and humidity sensor for my workshop. Currently it only provides temp and humidity in my Home Assistant setup, but It could be useful for future projects, and It was unused. So I added it in.
- Take one wire from the float switch and connect it to d2 (GPIO4) and the other to any ground pin.
- Then connect the power cord to the ESP chip
- Do some wire management
- Close up the soap box
- apply some double sided tape to the back of the soap box
- I like to label the soap box with the IP address and the name I gave the device
In this step, I used a pair of wire strippers, soldering Iron, and a lighter to make some wire connections and shrink some heat shrink tube (all not shown)
Optional Step 1.5
- Connect the + wire from the DHT22 chip to a 3.3V pin
- Connect the - wire from the DHT22 to ground
- Connect the data wire from the DHT22 to D5 or (GPIO14)
Configure Tasmota
Once you have everything wired up to the correct pins, its time to configure tasmota.
1.Type in the IP address of your ESP chip obtained in step 2
2.Select Configuration on the main screen
3.Select Sonoff Basic for your module type
4.Select GPIO4 and select switch from the dropdown menu
5.Select save and return to home screen.
6.When finished save everything
7.Select console
8.Type "Setoption19 0" Press Enter
9.Exit to main menu
Bonus Step 4.5
If you are adding the DHT22 Select GPIO14 and select AM2301 from the dropdown menu.
Put It All Together
Finally I attach the soap box to the outside of the recycle bin with some double sided tape. Then I made sure that I had enough drain hose and wire to move the recycle bin in and out of its final position. Finally did a bit of hose /cable management to tidy things up.
Enter Home Assistant
In home assistant node-red I wrote a small flow to finish things up. When the magnetic float switch closes, a signal is sent to home assistant via MQTT. Node-red then turns off a sonoff s31 smart switch that was already running the AC unit so it can be turned on remotely and precool my workshop space. Now the same smart switch can automatically turn off the AC until the bucket is empty.
Future Ideas
In the future I might add a small submersible pump, and when the bucket fills, the float switch could just turn on the pump and then a time could automatically turn it off after a set period. Since I now also have the temperature in my workshop, I could set the AC to turn on and off based on the temp or humidity in the room. Oh the possibilities for another day. Beware of the home assistant rabit hole. :)