GithubHelp home page GithubHelp logo

mojo2600 / esp-soil-moisture-sensor Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 1.0 5.49 MB

Firmware to send soil moisture sensor readings to MQTT

C++ 79.26% Shell 12.50% Python 8.24%
iot mqtt homie-esp8266 homie soil-moisture-sensor

esp-soil-moisture-sensor's People

Contributors

mojo2600 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esp-soil-moisture-sensor's Issues

Battery Drop Correction to normalize to reading at 3.0V

Hello

Can you explain this?

// Battery Drop Correction to normalize to reading at 3.0V
moisture = vccReading3VSetting.get() * moist_raw / batteryCharge;

Example:
vccReading3VSetting.get() = 958
moist_raw = 750
batteryCharge = 60

8.981 = 958 * 750 / 80

Result 8981.25

it should be less than 1000 or not?

Can you explain it to me?

Sorry for my bad english.

Usage of the Wire library.

In the file "esp-soil-moisture-sensor/src/esp-soil-moisture-sensor.cpp" in the function "getSendTemperature()" there is a Wire.endTransmission() after a Wire.requestFrom().
That Wire.endTransmission() can be removed, it is at the moment at line 197.

Explanation: Common-mistakes#2

There is no need to use a while-loop. If two bytes are requested, then two bytes are available if there was no failure.

  // Request 2 bytes , Msb first to get temperature
  Wire.requestFrom(TMP_ADDR, 2);
  // Read temperature as Celsius (the default)
  if(Wire.available() == 2) {      // changed, while -> if == 2
    int msb = Wire.read();
    int lsb = Wire.read();
                                   // changed, removed Wire.endTransmission
    int rawtmp = msb << 8 | lsb;
    int value = rawtmp >> 4;
    temperature = value * 0.0625;
  }

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.