
Monitoring the water level in your rain barrel, water tank, or IBC container can be easy and reliable – if your sensor is placed correctly. The SmartGateways Distance Meter Gateway uses an ultrasonic sensor, which works by bouncing sound waves off the water surface. But incorrect installation or placement can lead to strange readings, jumping values, or no data at all.
In this blog post, we’ll explain:
- How the sensor works (in simple terms)
- What conditions must be met for accurate measurements
- Real-world installation examples (with sketches)
- The most common issues and how to solve them
This guide is based on the official Smart Gateways Manual with extra tips to help you avoid frustrating mistakes.
1. How the Ultrasonic Sensor Works
The Distance Meter Gateway uses an ultrasonic distance sensor. That sounds complicated, but it just means this little device uses sound to measure distance — like a bat.
What does it do?
The sensor sends a sound wave (you can’t hear it) and waits for the echo. When the sound bounces back (like an echo in a canyon), the sensor knows how far away the surface is — for example, the water level in a tank.
What distances can it measure?
- Minimum distance: 20 cm (the sound needs space to bounce back properly)
- Maximum distance: 450 cm
If your water level gets too close to the sensor (under 20 cm), it stops working and show strange values, mostly a distance of 0 cm.
What is the sensor’s “view” or “angle”?
The sound wave spreads out like a cone:
- The beam angle is 30° wide
- That means the sound doesn’t just go straight down — it spreads out as it travels
- The further the distance, the wider the area it sees
Example:
At 100 cm distance, the “view area” is about 53 cm wide.
So the sensor may “see” the sides of your tank or a pipe if it’s in the way.
What can go wrong?
The sensor doesn’t know what it’s measuring — it just hears echoes. If the sound bounces off:
- a slanted wall
- a pipe
- or a floating lid
…it can give the wrong distance.
That’s why it’s important to install the sensor pointing straight down, with clear space under it.

2. Basic Sensor Requirements
Before installing your Ultrasonic sensor, make sure the following conditions are met:
- Minimum distance to surface:
The sensor only works for distances greater than 20 cm. Too close, and it won’t detect the water (The ultrasound waves need some distance to measure). - Maximum distance:
Reliable readings up to around 450 cm. - Sensor must be mounted straight (90°)
It must point directly downward to measure the distance accurately. - Clear line of sight to the water:
The sensor should not “see” any wall edges, pipes, or overflows below it. - No foam, waves, or floating debris:
These may distort or block the ultrasonic signal. - Keep it dry:
The sensor head is waterproof, but the rest of the device (the white box) must stay dry and protected.
3. Sensor Placement and Gateway Settings
Correct placement of the ultrasonic sensor is critical for accurate and reliable distance readings. The sensor must have a clear “view” of the water surface, and its mounting height must be set correctly in your system to interpret the values meaningfully.
Below we explain the most common installation methods with examples, and how to set the correct offset.
General Rules for Placement
- The sensor must point straight down (not angled).
- There should be no obstacles (like edges, wires, or pipes) within the 30° beam cone.
- The surface below must reflect sound well (still water is ideal).
- Do not place the sensor too close to the water — minimum 20 cm is needed.
- The sensor must always be placed above the maximum water level.
- Keep the sensor away from walls, corners or tank edges. The sound beam has a 30° cone shape, so any nearby wall or object can cause unwanted reflections or false readings. Leave enough space around the sensor so that the entire sound cone has free space all the way to the water surface.
4. Height Setting
The height is the actual physical height of the tank or pit — from the bottom to the highest possible water level. This value is crucial, as all calculations in the gateway are based on it. These calculations include determining the percentage of water in the tank.

For example, if your tank is 100 cm high and can be completely filled to the top, then you should enter 100 cm as the height. However, be aware: if the sensor is placed exactly 100 cm above the bottom, it typically cannot measure the top 20 cm. This is because ultrasonic sensors have a minimum measurable distance, usually around 20 cm. In this case, the sensor would only detect the water when the level drops below 80 cm — so you wouldn’t know when the tank is completely full.
You can solve this by mounting the sensor higher than the tank itself and using an offset value. How this works is explained in the next section.
Another important note: the measured distance (from the sensor to the water surface) must never exceed the configured height in the gateway. If it does, the gateway will interpret this incorrectly, thinking the water level is far lower than physically possible. This leads to incorrect readings — even negative values — which are unacceptable.
To avoid this, we recommend setting the height slightly higher than the actual tank height. For example, instead of exactly 100 cm, use 105 or 110 cm. This creates a safety margin that prevents issues when the sensor detects slightly more than expected.
5. Offset Setting
The offset is used to correct the measurement when the sensor is not placed exactly at the top edge of the tank. For example, if the tank is 100 cm high but the sensor is mounted 10 cm above the tank, the sensor will measure from 110 cm. In this case, you need to enter an offset of -10 in the gateway’s web interface. This tells the gateway to subtract 10 cm from every measurement, so the level is calculated correctly.
You can also place the sensor 10 cm below the top of the tank. In that case, the sensor only sees water up to 90 cm. To correct this, you set the offset to 10. The gateway will then add 10 cm to the measured value.
Using the offset helps ensure that the water level is always shown accurately, even when the sensor is not installed exactly at the top of the tank.
Need help? Reach out via smartgateways.nl/en/contact for support or additional information.

6. Sensor Placement Examples
Correct placement of the sensor is critical to ensure accurate and reliable distance measurements. The diagrams below illustrate common installation scenarios, highlighting both recommended and problematic setups.
These examples help you understand:
- How to avoid false readings caused by obstacles or reflections
- The importance of aligning the sensor perpendicular to the measured surface
- How height and surface shape influence measurement quality
Use these diagrams as a guideline when planning your installation to ensure the sensor performs optimally in your specific environment.
Diagram 1

- Sensor is placed in the center above the tank.
- Tank size: 100 cm high and 50 cm wide.
- The sensor cannot measure the top 20 cm when the tank is full.
- Beam angle is 28.1°, close to the 30° maximum.
- Sound waves can reflect from the side walls – Reflections are more likely when the tank is nearly empty.
- This may affect measurement accuracy when the tank is almost empty.
Diagram 2

- Sensor is mounted off-center on top of the tank.
- Tank dimensions: 100 cm high and 50 cm wide.
- The sensor’s 30° beam hits the left side wall.
- This causes ultrasonic waves to reflect prematurely.
- Reflections lead to incorrect or unstable measurements.
- For best results, place the sensor in the center above the tank.
Diagram 3

- Sensor is mounted 10 cm above the top of the tank.
- Tank size is 100 cm high and 50 cm wide.
- The 30° ultrasonic beam hits the tank walls.
- Sound waves reflect off the walls, causing false readings.
- This results in inaccurate or unstable measurements.
- Place the sensor lower or expect that the level of the tank will not exceed the red markings
Diagram 4

- Tank height is 100 cm and width is 80 cm.
- Sensor is mounted 10 cm above the top of the tank.
- Offset is set to -10 cm in the gateway settings – the gateway subtracts 10 cm from the measurement to correct for the 10 cm higher placed sensor
- The ultrasonic beam does not hit the tank walls.
- No reflections occur, resulting in reliable measurements.
- Offset corrects the distance so the water level is accurately reported.
Diagram 5

- Tank height is 100 cm and width is 80 cm.
- Sensor is mounted 10 cm below the top of the tank.
- Offset is set to +10 cm in the gateway settings.
- The ultrasonic beam does not hit the tank walls.
- No reflections occur, resulting in stable and accurate readings.
- The offset adds 10 cm to the measurement to show the correct water level.
Diagram 6

- Tank size: 100 cm high, 50 cm wide.
- An obstacle inside the tank reflects ultrasonic waves.
- Reflections cause incorrect and unstable measurements.
- Sensor must have a clear line of sight to the water surface.
- Obstructions under the sensor are not allowed.
- Clear view is essential for accurate and reliable readings.
7. Troubleshooting: How to Diagnose and Test Your Sensor
If you’re experiencing unexpected results or want to verify the accuracy of your Distance Meter Gateway, it’s essential to use the live logging function while testing.
Step-by-Step Diagnostic Procedure
- Point the sensor at a representative surface
Make sure the sensor is aimed at a flat surface (e.g., water or a solid object) at a realistic distance. This surface should reflect the actual conditions of your final setup. - Set a representative height and offset
In the configuration, set the “height” (distance from the sensor to the bottom of the tank/pit) and “offset” (correction added to the measured distance) to values that reflect your intended installation. - Monitor live readings
Connect the USB port of the gateway to your PC or Mac. Install a small terminal program (e.g., PuTTY, CoolTerm, or SerialTools). Full instructions can be found here:
https://smartgateways.nl/en/view-the-log-of-a-gateway/ - Observe real-time measurements
The log will show two measurements per second, including:- The raw distance measured by the sensor
- The adjusted value after applying the height and offset
- The calculated percentage full
- Validate your setup
This logging process allows you to:- Confirm the sensor is functioning correctly
- Verify that distance readings are stable
- Check that your height and offset settings result in an accurate percentage full
- Get a feel for how the sensor behaves
By reviewing the logs, you gain an intuitive understanding of how your sensor performs in different conditions. This helps you fine-tune the installation and decide whether your final setup meets the requirements for reliable operation.
8. Frequently Asked Questions (FAQ)
What is the minimum distance the sonar sensor of the Distance Meter Gateway can measure?
The sensor needs at least about 20 cm distance to the water surface to measure correctly. If the water is closer than this, the sensor may give incorrect or no readings.
What is the maximum distance the sensor can measure?
The maximum reliable measuring distance is around 450 cm. Distances beyond this may lead to inaccurate results.
Why must the sensor be mounted pointing straight down?
The sonar sensor sends sound waves in a cone shape (about 30° wide). If it is tilted, the sound waves can bounce off walls or miss the water surface, causing wrong readings.
Can the sensor be placed near the tank edges?
No, placing the sensor too close to the edges is not recommended. Because of the 30° beam angle, the sound waves can hit the tank walls and reflect, causing false measurements. The sensor should be placed near the center with enough free space around it.
What is the “height” setting and why is it important?
Height is the actual vertical size of your tank from bottom to the highest water level. All level calculations are based on this number. The measured distance must never be greater than the height, or else the system gives invalid results. It’s best to set the height a little higher than the real tank height to avoid errors.
What does “offset” mean and when do I use it?
Offset is used when the sensor is not mounted exactly at the top of the tank.
- If the sensor is above the tank top (e.g., 10 cm higher), use a negative offset (e.g., -10) to subtract this extra height from measurements.
- If the sensor is below the tank top (e.g., 10 cm lower), use a positive offset (e.g., +10) to add the missing distance.
This correction ensures the water level is shown accurately.
What causes unstable or incorrect readings?
Common causes include:
- Sensor placed too close to walls or edges causing reflections
- Obstacles inside the tank reflecting sound waves
- Sensor mounted at an angle
- Sensor too close to the water surface (less than 20 cm)
- Incorrect height or offset settings in the gateway
- drop of moisture on the sensor, clean it with a dry wipe
Can obstacles inside the tank affect measurement?
Yes, any object that reflects sound waves inside the tank can cause wrong readings. The sensor must have a clear line of sight to the water surface — this is a strict requirement.
Can obstacles inside the tank affect measurement?
Yes, any object that reflects sound waves inside the tank can cause wrong readings. The sensor must have a clear line of sight to the water surface — this is a strict requirement.
How can I improve the reliability of the measurements?
- Make sure the sensor is mounted firmly and does not vibrate.
- Use a stable 5V power supply for the sensor.
- Place the sensor at a proper height above the water surface (at least 20 cm).
- Take multiple measurements and use averaging or median filtering to reduce fluctuations.
- Avoid placing the sensor in tight spaces with many reflections.
What should I do if the sensor does not give any readings?
- Check if the sensor is properly connected and powered.
- Ensure the trigger pulse duration is set correctly (minimum 10 µs).
- Use an oscilloscope to check the signal output.
- Test the sensor with another object at a known distance to see if it responds.
Where can I get support?
If you need help or have technical questions, you can contact the Smart Gateways team through their contact page. They’re happy to assist.
9. Conclusion
The Distance Meter Gateway offers a reliable and easy-to-use solution for monitoring water levels in tanks, brine containers, IBCs, wells, and more. With accurate ultrasonic sensing, seamless integration into platforms like Home Assistant, and flexible installation options, this sensor enables smarter water management and helps prevent overflows or shortages. Whether you’re tracking the salt level in a water softener or monitoring rainwater usage, the Distance Meter Gateway provides clear insights and dependable performance.
For detailed setup instructions and troubleshooting, refer to the logging guide and the comprehensive Home Assistant integration tutorial.

The Best Ultrasonic Sensor for Water Levels, Tanks, and Reservoirs: Smart Gateways Distance Meter WiFi Gateway (with SN-SR04T Sensor)
The Smart Gateways Distance Meter WiFi Gateway is the ideal solution for accurately monitoring liquid levels across a wide range of applications. It features the popular and durable SN-SR04T ultrasonic sensor — a waterproof sensor designed for both industrial and domestic level measurements.
This smart gateway transmits measurement data wirelessly via WiFi and integrates seamlessly with Home Assistant, Domoticz, and other smart home platforms. Thanks to the included manuals and ready-to-use firmware, even beginners can achieve reliable level monitoring without any coding.
Applications of the SN-SR04T Sensor with Smart Gateways
The SN-SR04T sensor is perfectly suited for:
- Rainwater tanks
- Wastewater tanks
- Freshwater tanks
- Groundwater wells
- Barrels and IBC containers
- Water reservoirs
- Septic tanks
- Swimming pools
- Garden water storage tanks
- Water softeners (brine tanks, salt containers)
The sensor works both indoors and outdoors and measures liquid levels or objects without making contact. This makes it ideal for situations where hygiene or water resistance is important.
Why Choose This Sensor?
- Durable and Waterproof: The SN-SR04T is IP66-rated and built to withstand humid environments.
- Accurate Measurements: The gateway performs two measurements per second, viewable in real-time logs.
- Customizable Settings: Set your own tank height and offset to define what 0% and 100% full means.
- Easy to Install: Comes with a preassembled cable and plug-and-play firmware.
- Home Assistant Ready: Full integration with Home Assistant via MQTT or auto-discovery through ESPHome.
- Low Power Usage: Suitable for battery-powered setups.
- Proven Reliability: Praised by users as the “ultimate level sensor” in reviews and forums.
- Stable Connection: Operates reliably even with cable lengths over 3 meters.
Exceptional Value for Money
This sensor is widely appreciated for its outstanding price-to-performance ratio. For just a fraction of the cost of industrial alternatives, it offers reliability, flexibility, and ease of use — with no subscription fees or vendor lock-in. The gateway runs locally and continues working even without internet access.
Frequently Asked Questions and Support
The sensor comes with both Dutch and English manuals, including Home Assistant configuration guides. A comprehensive FAQ is available, along with troubleshooting tips — such as accessing real-time logs via USB. See the log instructions here:
https://smartgateways.nl/en/view-the-log-of-a-gateway/
A dedicated Home Assistant setup guide is also available:
https://haprofs.com/water-level-sensor-for-home-assistant/
Conclusion
The Smart Gateways Distance Meter with SN-SR04T is the best choice for anyone seeking a precise and dependable level sensor. Whether you’re monitoring the salt level in a water softener, the water level in a rain tank, or the contents of an underground reservoir — this sensor delivers everything you need. With excellent integration options, long-term reliability, and a strong user community, it’s a future-proof investment you can trust.