Smart Water Softener

Enhancing an ordinary water softener with an ESP8266 and ultrasonic sensor to receive alerts when the salt level is low.

Smart Water Softener
Photo by Yoann Boyer / Unsplash
Skill Cost Time
2 / 5 ~10 Euro ~60 min

In the age of innovative technology, our homes are becoming more intelligent and efficient. Recently, We embarked on a DIY project to enhance a water softener system. We integrated an ESP8266 microcontroller and an ultrasonic sensor to measure the salt level, allowing remote monitoring through Home Assistant and receiving timely alerts when salt needs to be added. Let us walk you through turning a standard water softener into a smart, connected device.

Water Softeners and Salt Levels

Water softeners remove minerals like calcium and magnesium from hard water, ensuring that mineral buildup does not damage pipes, appliances, and fixtures. These softeners operate using salt pellets, which need to be replenished periodically. Keeping an eye on the salt level is crucial for the system's efficiency.

Making the Water Softener Smart

The idea of making the water softener smart struck when we realized that monitoring the salt level manually was not the most convenient or efficient way. We used an ultrasonic sensor to measure the distance between the salt surface and the top of the softener tank. We use an ESP8266 microcontroller to operate the sensor, employing WiFi and MQTT to communicate with Home Assistant.

Water softener's cross-section with minimal salt level and distance measurement


We had the option to use a separate power supply for the microcontroller and sensor, but instead, we utilized the device's 25V AC voltage, converting it to 5V DC using a step-down transformer.

Completing the hardware setup was a relatively uncomplicated task. We crafted small openings in the foam cover, ensuring the ultrasonic sensor had a clear line of sight to the salt within the compartment. The sensor was securely mounted in this space. Furthermore, we encased the step-down transformer and microcontroller in a protective casing for added safety. We affixed connectors to the power terminals on the water softener's PCB to establish the necessary power connections.


We wrote Arduino code for the ESP8366 to read the data from the ultrasonic sensor (connected to GPIO13 ) and send it to Home Assistant. The code enables the specification of distance thresholds indicating the salt compartment's full and low levels. A refill is necessary when the salt level reaches the water level.

Water Softener in Home Assistant

We created an automation to notify when the salt level reaches the set threshold. These notifications appear as persistent mobile app alerts, which can only be removed once salt is added to the compartment.

Manual checks for the salt level are now a thing of the past, saving valuable time and effort. Additionally, the prompt alerts guarantee the water softener operates efficiently, extending its lifespan and cutting down on maintenance expenses.

Bill of materials

  1. AC/DC to DC step-down converter
  2. ESP8266 based microcontroller
  3. HC-SR04 ultrasonic sensor


In our quest for an effortless monitoring solution for the water softener, we stumbled upon an intriguing alternative: the Aqara Water Leak Sensor, powered by a battery and Zigbee technology.

While we didn't opt for this approach, it could be an ideal solution for those desiring simplicity. Placing the sensor on the regeneration salt proves ingenious, as its detection of water signals the need for a refill. With a price tag of approximately 15 euros, this sensor eradicates the complexities of wiring and programming, providing a straightforward solution. Although there's a minor inconvenience in removing and replacing the sensor during salt refills, its real-time notifications render it a convenient and efficient method for monitoring the water softener's salt supply.

Aqara Water Leak Sensor inside the water softener
Tip: If you opt for this, consider attaching a string to the sensor for effortless retrieval later!


Combining the power of an ESP8266, ultrasonic sensor, and Home Assistant transformed the water softener into a smart device that enhances the home's efficiency and convenience. This project showcased the capabilities of DIY IoT solutions and highlighted the endless possibilities of making our homes smarter, one project at a time.