Hello,
I’m having issues with an ultrasonic sensor, I already read a lot of contents in both this forum and external websites but I’m still having problem with it.
I bought a JSN-SR04T ultrasonic sensor which I want to use to measure the capacity of my external water tank. As board I’m using nodeMCU with ESP8266.
I connected trigger sensor to D1 and echo sensor to D2.
This is my code at the moment
esphome:
name: cisterna_meter
esp8266:
board: nodemcu
# Enable logging
logger:
sensor:
- platform: ultrasonic
trigger_pin:
number: D1
#inverted: true
echo_pin:
number: D2
name: "Water Tank Level"
unit_of_measurement: "cm"
accuracy_decimals: 2
update_interval: 1s
timeout: 9.0m
#pulse_time: 10us
filters:
- filter_out: nan
I had to put a huge timeout value in order to make it work. Based on sensor seller, the sensor has a capacity up to 4.5m, so at first I set 4.5m as timeout. And with this, the sensor was timing out precisely at 2.40m, so the measure was fine until 2.39m.
I tried different values of timeout value and with the provided configuration it can read up to 3.5 meters, even if in this configuration I also getting warnings
[21:26:42][W][component:214]: Component ultrasonic.sensor took a long time for an operation (0.05 s).
[21:26:42][W][component:215]: Components should block for at most 20-30ms.
I saw the potentiometer on the board but I read that this should not be touched as it it used to change the frequency of the sound wave, so I did not touch it.
There is something I’m missing for sure, the timeout value is not respected (if I set 4.5m as the manufacturer indication, why it goes in timeout at 2.40m?).
I’m creating this post to ask you for help on this because I already spent few hours on this on several tests but I’m still not getting a consistent value.
These are the website I already used to try to fix the problem, but unfortunately with no success:
- Ultrasonic sensor JSN-SR04T
- JSN-SR04T and nodemcu
- GitHub - RedFoxy/HA-Tank-Level-Sensor: Sensor about to know the level of the water tank
- Reddit - Dive into anything
Thank you for your help