mojo2600 / esp-soil-moisture-sensor Goto Github PK
View Code? Open in Web Editor NEWFirmware to send soil moisture sensor readings to MQTT
Firmware to send soil moisture sensor readings to MQTT
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;
}
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.
The code for adjusting the sensor reading to the battery level is not working correctly and the reading is then always 0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.