<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb" -->

---
title: Measuring Water Softener Salt Remaining with ESP32
description: A DIY project using an ESP32 microcontroller and a Maxbotix MB7052 ultrasonic distance sensor to monitor water softener salt levels. The sensor is mounted...
canonical: https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Measuring Water Softener Salt Remaining with ESP32 | daily.dev
og:description: A DIY project using an ESP32 microcontroller and a Maxbotix MB7052 ultrasonic distance sensor to monitor water softener salt levels. The sensor is mounted...
og:url: https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb
og:image: https://api.daily.dev/og/posts/ebjpmUTSb.png
og:image:alt: Measuring Water Softener Salt Remaining with ESP32
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Measuring Water Softener Salt Remaining with ESP32

**[apalrd's adventures](https://daily.dev/sources/apalrd)** · 8 min read · 0 upvotes · 0 comments

## Summary

A DIY project using an ESP32 microcontroller and a Maxbotix MB7052 ultrasonic distance sensor to monitor water softener salt levels. The sensor is mounted through the brine tank lid via a 3D-printed 1" NPS housing. Software is built with PlatformIO and ESP-IDF, reads UART data from the sensor, applies a median filter over 64 samples (trimming top/bottom 20%), and publishes results to MQTT every 60 seconds in JSON format. Data flows through Node-Red into InfluxDB/Grafana, and later Home Assistant via MQTT sensor and template sensor for a tank-full percentage display.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.apalrd.net/posts/2021/salt_meter>

## Questions this post answers

### How do I filter noisy ultrasonic sensor readings on an ESP32 for more accurate distance measurements?

A median filter approach works well: collect the last 64 samples into a local buffer, sort them, remove the top 20% and bottom 20% of values, then take the mean of the remaining samples. This trims outliers caused by ultrasonic ping noise. The Maxbotix sensor reports in integer centimeters, so this averaging step meaningfully improves accuracy before publishing results.

_Makers tuning sensor accuracy for home automation projects share approaches like this on daily.dev._

### How do I add a large capacitor to stabilize a Maxbotix ultrasonic sensor powered by PoE on an ESP32?

Adding a large capacitor across the power leads of the Maxbotix sensor smooths the power spikes that occur during ultrasonic ping events. Without it, the high current draw during pings causes instability when running on PoE power. The exact capacitor value is not specified, but sizing it large enough to buffer the transient load resolves the reliability issue.

_ESP32 PoE hardware gotchas like this surface regularly for IoT builders on daily.dev._

## Similar posts on daily.dev

- [An Automated Water Tank Controller](https://daily.dev/posts/an-automated-water-tank-controller-etkmpnont) · Hackaday · 0 upvotes · 0 comments
- [My first ESP32 sensor solved a real problem, and now I'm building new projects every week](https://daily.dev/posts/my-first-esp32-sensor-solved-a-real-problem-and-now-i-m-building-new-projects-every-week-xg2qcsehh) · XDA Developers · 0 upvotes · 0 comments
- [Dealing With Intermittent Water Utilities](https://daily.dev/posts/dealing-with-intermittent-water-utilities-hoeqazcdg) · Hackaday · 0 upvotes · 0 comments
- [DIY ESP32-P4 weather station & air quality monitor connects to LoRa and ESP-NOW sensors, various weather APIs](https://daily.dev/posts/diy-esp32-p4-weather-station-air-quality-monitor-connects-to-lora-and-esp-now-sensors-various-wea-fyniccq3k) · CNX Software · 0 upvotes · 0 comments
- [I built a cheap ESP32 weather station to automate my Home Assistant server](https://daily.dev/posts/i-built-a-cheap-esp32-weather-station-to-automate-my-home-assistant-server-vjfkl9qcz) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#iot](https://daily.dev/tags/iot)

[View this post on daily.dev](https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Measuring Water Softener Salt Remaining with ESP32","url":"https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb"},"datePublished":"2026-08-11T08:55:33.351Z","dateModified":"2026-08-11T09:24:44.681Z","description":"A DIY project using an ESP32 microcontroller and a Maxbotix MB7052 ultrasonic distance sensor to monitor water softener salt levels. The sensor is mounted...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/03fa0af276730f5fc1c7c21bcab2354f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/03fa0af276730f5fc1c7c21bcab2354f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"apalrd's adventures","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"apalrd's adventures","logo":"https://media.daily.dev/image/upload/s--4zkx8dRj--/f_auto,q_auto/v1786438309/logos/apalrd?_a=BAMAMicg0","url":"https://daily.dev/sources/apalrd"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,iot","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"apalrd's adventures","item":"https://daily.dev/sources/apalrd"},{"@type":"ListItem","position":3,"name":"Measuring Water Softener Salt Remaining with ESP32"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/measuring-water-softener-salt-remaining-with-esp32-ebjpmutsb#faq","mainEntity":[{"@type":"Question","name":"How do I filter noisy ultrasonic sensor readings on an ESP32 for more accurate distance measurements?","acceptedAnswer":{"@type":"Answer","text":"A median filter approach works well: collect the last 64 samples into a local buffer, sort them, remove the top 20% and bottom 20% of values, then take the mean of the remaining samples. This trims outliers caused by ultrasonic ping noise. The Maxbotix sensor reports in integer centimeters, so this averaging step meaningfully improves accuracy before publishing results. Makers tuning sensor accuracy for home automation projects share approaches like this on daily.dev."}},{"@type":"Question","name":"How do I add a large capacitor to stabilize a Maxbotix ultrasonic sensor powered by PoE on an ESP32?","acceptedAnswer":{"@type":"Answer","text":"Adding a large capacitor across the power leads of the Maxbotix sensor smooths the power spikes that occur during ultrasonic ping events. Without it, the high current draw during pings causes instability when running on PoE power. The exact capacitor value is not specified, but sizing it large enough to buffer the transient load resolves the reliability issue. ESP32 PoE hardware gotchas like this surface regularly for IoT builders on daily.dev."}}]}
```

