Giter VIP home page Giter VIP logo

Comments (13)

stefanbode avatar stefanbode commented on July 2, 2024

This issue is new. Can you please recheck, if the behavior is reproduce able with a different SR04. Currently I assume a hardware defect, that causes the nodemcu wait to long for a sound reply. The behavior is known, if you disconnected the device.

from sonoff-tasmota.

helmar74 avatar helmar74 commented on July 2, 2024

Hi,
Nodemcu is fine, I can run a lot of different sketches on it, and also "normal" tasmota firmware

It doesn't matter if a SR04 is connected or not. I only selected as Device "18-generic) and for
D2 GPIO4 - 68 SNS_TRIG
D1 GPIO5 - 69 SNS_ECHO
image

the SR04 isn't connected. After saving the settings the device isn't reachable any longer or really slow:
image

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

As mentioned a disconnected device will always behave this way. The esp is a single core CPU. Is it wait for the signal nothing else will work. The sketch will only work with a connected and well working SR04

from sonoff-tasmota.

helmar74 avatar helmar74 commented on July 2, 2024

OK understood. I also figured out, that the distance is not measured correctly. A 70cm Distance is show 35cm:
image

from sonoff-tasmota.

whhsn avatar whhsn commented on July 2, 2024

Hi Helmar,

Do you still connect the sensor as:
D2 GPIO4 - 68 SNS_TRIG
D1 GPIO5 - 69 SNS_ECHO

I am trying this fork but I am getting strange behavior from the sensor - distance always > 1000 cm!!!

I am connecting the sensor as:
D1 GPIO5 - 68 SNS_TRIG
D5 GPIO14 - 69 SNS_TRIG

Did you manage to figured it out?

Thanks,

WH
tas

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

I haven’t seen this behavior on my SR04. Some of the GPIO on the wemos have 10k pull-up or Pulldown resistors. But I do not believe that this causes the issue. Do you have connected the SR04 to the 5V. This is important because the module does not work with 3.3V. My configuration also uses D5 as echo pin.

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

The reported value is the timeout value, if there is no response detected

from sonoff-tasmota.

whhsn avatar whhsn commented on July 2, 2024

The module is connected to the 5V & I tried with & without a capacitor on the Vcc but same results.
I noticed that the large values are obtained when the sensor is covered or facing a distant wall (I think more than 2 meters or so)

I turned on all logging & I got this:

15:57:24 HS-SR04: Avg Distance measured: 8.80, loops: 20
15:57:24 HS-SR04: New Distance: 3445.62
15:57:27 HS-SR04: Avg Distance measured: 9.12, loops: 20
15:57:27 HS-SR04: New Distance: 3445.52
15:57:29 HS-SR04: Avg Distance measured: 17.69, loops: 20
15:57:29 HS-SR04: New Distance: 3445.42
15:57:31 HS-SR04: Avg Distance measured: 22.23, loops: 20
15:57:31 HS-SR04: New Distance: 3445.32
15:57:34 HS-SR04: Avg Distance measured: 31.06, loops: 20
15:57:34 HS-SR04: New Distance: 3445.22
15:57:36 HS-SR04: Avg Distance measured: 18.63, loops: 20
15:57:36 HS-SR04: New Distance: 3445.12

You see that Avg distance measured is the right distance.
I'll check the code within a day or two to see what went wrong.

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

As posted in the other issue there is a limit defined about the maximum change between two values. Please take a look in the wiki here.

from sonoff-tasmota.

helmar74 avatar helmar74 commented on July 2, 2024

Hi @stefanbode @whhsn,
connected that way:
image
Always get round about 22cm Distance, no matter how long it is in real ...
image

Check of Power Supply doesn't helped, I have exactely 5V.
Replace HC-SR04 same issue. Both HC-SR04 works with my own code...

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

Take a look at the WIKI here. There is a 0.1mm max deviation between two measurements. If you don't want to have this change the constant: MAX_DEVIATION_BETWEEN_MEASURES . You can override the value in user_config_override.ino

Otherwise, you should see on the MAIN Web page that the value will constantly change by 0.1mm. Please feedback

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

I changed the timing and now also a disconnected sensor should not cause a headache.

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 2, 2024

Changed CODE to main project because SR04 now supported in original project

from sonoff-tasmota.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.