[PROJECT] Salt Tank monitor using Arduino & MQTT

Hello all,

This was inspired by Dr. Zzz's YouTube video on how he added a Wemo D1 with a Ultrasonic Sensor (HC-SR04) to his Hass.io system to monitor salt level in his water softener.

In order to make this work in Hubitat and use my RPi Mosquito MQTT Broker. I use Hubitat's MQTT Client connectivity to read and display the Salt Tank level. I wanted to use a NodeMCU for the Arduino but unfortunately the HC-SR04 requires 5v to operate and the NodeMCU I have only has pinouts for 3.3v. So now using a Wemo D1. :slight_smile:

I created an Arduino sketch that establishes a connection to WiFi, connects to your MQTT Broker, sends the current salt level distance to the topic and also accepts incoming delay time variances from the Salt Tank Driver.

Last piece was using the built-in Notification app to send me a PushOver message (removed need for WATO app).

Setup is fairly simple and documentation is in the Arduino sketch for what pins you need to use.

Arduino Code location:

Hubitat Driver:

Setup - Salt Tank Driver

  • Set your Salt Tank capacity based on # of salt blocks (default = 4)
  • MQTT Broker Address: IP or DNS name of MQTT Broker (I use Mosquito on a RPi)
  • MQTT Username: your broker username account
  • MQTT Password: your broker password for above username account
  • Topic to Subscribe: this is your root/device topic. Example: wardhome/salt-tank/#
  • Topic to Publish: this is the value you want to publish for a MQTT device to subscribe to. Example: wardhome/salt-tank/delay

Arduino Setup:

  • Wemo D1 pinouts: VCC-5V, Trig-D6, Echo-D7, Grnd-Grnd
  • Modify Basic Setup section. Note: distance_topic and subscribe_topic are key to matching. Example: distance_topic - wardhome/salt-tank/distance subscribe_topic wardhome/salt-tank/delay
  • Upload sketch
  • Runs initially every hour unless sent a message through Salt Tank Driver

Driver Configuration:

Notification App:

Dashboard Tile:
image

Hope this is fun for others!

7 Likes

Updated the generic MQTT driver to provide last topic update status info.

1.0.1 - added importURL and updated to new MQTT client methods

1.0.3 - added retained and QOS support

  • Added dedicated Salt Tank Driver with dynamic dashboard visuals

This is great. Now I need to figure out how to make one.

Actually very easy to do. :slight_smile:

Sweet. I’ll look for a parts list this weekend and get some stuff ordered.

I just linked the parts in the overview above. :slight_smile:

Thanks!!

Removed the need for WATO. Now you can use all the native apps in Hubitat. :slight_smile:

1 Like

aaron,

have you seen this one?

1 Like

I have not. Another interesting solution to the problem. :grin:

Device Driver - 1.0.3 - fixed dashboard CSS styling issues

Do I just need to install the Salt Tank.groovy driver from this location ? Hubitat/MQTT/SaltTank-Sonic-MQTT at master · PrayerfulDrop/Hubitat · GitHub

I think I have everything else going but not sure. lol

Not sure why i'm getting this error in the Logs for the Salt Tank driver
java.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 141 (updated)

The salt tank driver is in the root github drivers section.

After you install the driver code, add a new virtual device. Assign the driver to that device. Then follow instructions to listen to MQTT topic you set in the Arduino sketch.

Yeah the salt driver doesnt work for some reason on my system. I added the mqttt driver as well just to test and it works fine and it picks up the subscribed information no problem

mqttt

Can you pm me your setup on the salt tank? Should look something similar to this:

1 Like

sent pm