Giter VIP home page Giter VIP logo

Comments (9)

whhsn avatar whhsn commented on July 20, 2024

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.

WH

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 20, 2024

Ahh,now I see clearly. There is damping factor that ensures values do not vary that much from one measure tot he other. Is described in the Wiki. Your first measurement was 3m. Now any additional measurement will change the value maximum 0.1mm. If you repower or change the limit from e.g. 0.1 to 1000 you should see the measured values. Anyhow the deviation is really high

from sonoff-tasmota.

whhsn avatar whhsn commented on July 20, 2024

It is working :)
The deviation is for testing - moving hand :)

The intended application for the sensor will be to monitor a container & it is building up rapidly so the deviation will be high also.

Thanks for your great work

from sonoff-tasmota.

helmar74 avatar helmar74 commented on July 20, 2024

I'm measuring distances which can varies about 10-20cm between two measurings.
Usage:
Device is in deepsleep for 1hour, than measuring

Example
12:00 distance is 180cm
13:00 distance is 181cm
14:00 distance is 200cm
15:00 distance is 182cm
16:00 distance is 183cm

Which settings should I do?
Have set deepsleep to 3600 and teleperiod to 10 (seconds)
How should I set MAX_DEVIATION_BETWEEN_MEASURES, and how must i define it in user_conf_override.h?

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 20, 2024

For the override. Please put the right spelling just posting from my iPad the concept

#ifdef MAX_DEVIA......
#undef MAX_DEVI.....
#endif
#define MAX_DEVIATIO...... = 100

from sonoff-tasmota.

helmar74 avatar helmar74 commented on July 20, 2024

Hi again,

tried these setting in user_conf_override.h:
#ifdef MAX_DEVIATION_BETWEEN_MEASURES
#undef MAX_DEVIATION_BETWEEN_MEASURES
#endif
#define MAX_DEVIATION_BETWEEN_MEASURES 100

The following compile error occurs:
Arduino: 1.8.5 (Windows 10), Board: "Generic ESP8266 Module, Serial, 80 MHz, 26 MHz, 40MHz, DOUT, 115200, 1M (no SPIFFS), nodemcu, Disabled, None"

In file included from C:\xxxxxxxxxxxxxxxxxx\sonoffAkku.ino:34:0:
user_config_override.h:38: error: expected unqualified-id before numeric constant

#define MAX_DEVIATION_BETWEEN_MEASURES 100
^
C:\xxxxxxxxxxxxxxxxxx\xsns_19_HC-SR04.ino:23:7: note: in expansion of macro 'MAX_DEVIATION_BETWEEN_MEASURES'

float MAX_DEVIATION_BETWEEN_MEASURES = 0.1;

   ^

exit status 1
expected unqualified-id before numeric constant

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

If i comment out the line "#define MAX_DEVIATION_BETWEEN_MEASURES 100" I can compile without error.
I also tried the followin lines:
#define MAX_DEVIATION_BETWEEN_MEASURES=100
#define MAX_DEVIATION_BETWEEN_MEASURES=100;

All lines bring me compile errors.

Can you please help?

from sonoff-tasmota.

whhsn avatar whhsn commented on July 20, 2024

Hi helmar74,
MAX_DEVIATION_BETWEEN_MEASURES is a float variable - you cannot override it in user_config_override.h.

In the file xsns_19_HC-SR04.ino you just change the number from 0.1 to 100 - like that:

float MAX_DEVIATION_BETWEEN_MEASURES = 100;

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 20, 2024

I made the value dynamically by getting an idea how strong your values change. the measured value is sometimes a little behind the current value if this changes at a constant rate. Anyhow better than before. Also removed some timing issues, if there is no echo detected.

from sonoff-tasmota.

stefanbode avatar stefanbode commented on July 20, 2024

This now part of the main project. Behavior is different now

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.