How Does It Work?
The ultrasonic sensor reports the distance value in centimeters (cm) by default.
you could also use this sensor to monitor a salt tank level.
You may follow our previous guide toinstall Home Assistant on Raspberry Pior an old laptop.
Step 2: Measure Tank Depth
you better measure the tank depth.
This is the distance that you better subtract from the total depth.
Then go through this:
Now find thewaterlevelsensorproject and clickEdit.This opens thewaterlevelsensor.yamlfile.
In the file, copy and pastethis YAML code.
The steps are as follows:
After downloading the firmware, clickOpen ESPHome Web.
ClickConnectand then snag the USB serial COM port where your NodeMCU, D1 Mini, or ESP32 is connected.
ClickInstall.ClickChoose File, browse to thewaterlevelsensor.binfirmware file, and clickInstall.
Once the firmware is flashed, disconnect the USB cable.
JSN-SR04 Ultrasonic Sensor
Vin
5V
Once the ultrasonic sensor is connected to the MCU, reconnect the USB cable.
ClickLogsunder thewaterlevelsensor.This will display the logs and data received by the sensor.
For the project, we used the SR04 sensor, which isnt waterproof.
We drilled two tiny holes and used a metal wire to keep the SR04 module attached to the cover.
Another bigger hole was made for the wires connected to the ultrasonic sensor.
You may keep both in one case and supply power to the NodeMCU.
Also, ensure good Wi-Fi signal strength when you are installing the NodeMCU or the sensor.
Read our guide onhow to boost your Wi-Fi signal to extend the Wi-Fi range.