GithubHelp home page GithubHelp logo

top-gun / smt50-esp Goto Github PK

View Code? Open in Web Editor NEW
13.0 7.0 0.0 6.03 MB

Using a Truebner SMT50 with an ESP8266 for wireless irrigation control

License: GNU General Public License v3.0

C++ 100.00%
soil-moisture-sensor smt50 truebner

smt50-esp's Introduction

SMT50-ESP

Interface a SMT50-moisture sensor via an ADS1115 and transmit data via MQTT

Usecase: Control lawn irrigation with a soil moisture sensor. The sensor (Truebner SMT50) is connected to a Wemos D1 (ESP8266). Data about moisture and temperature is transmitted via WiFi and MQTT-protocol to a MQTT-broker inhouse. The project uses ioBroker as a MQTT-broker, and there is a second script on the ioBroker-server that remotely controls an irrigation clock by means of a Wifi-relay.

The core component is a Wemos D1-microcomputer. The Truebner-sensor offers two datums as analogue signals (0-3V). Since the Wemos has only one analogue input, I added an ADC-chip ADS1115. The ADS1115 can sample up to four analogue signals and connects to the Wemos via the I2C-protocol.

The project is supposed to run from 3 AA-batteries, so low consumption is an important requirement. The Truebner sensor has a permanent power consumption of 2.7 mA, this would drain the battery unacceptably fast. The solution was to switch the sensor with a cheap 5V-relay that is known to operate well on 3.3V. The sensor is powered for about 0.4s during each cycle. The manufacturer recommends 0.3s for the sensor to become stable, 0.4s compensates for the mechanical latency of the relay.

The Wemos D1 will supply one reading of both moisture and temperature, then switch to Deep Sleep for approcimately 60 minutes. This cycle uses around 10mAh per day, so the sensor is expected to last the whole year with just one exchange of batteries during the growing season. My setup allows for an easy upgrade to bigger batteries or even Li-Io cells plus solar charging.

For further documentation look at the "Documentation"-folder:

documentation/architecture is a diagram of the information-flow

documentation/parts-list-Teileliste is a text document with all used parts and links to potential sources

documentation/truebner-smt50.png shows sampled data as a flot-diagram (ioBroker)

documentation/Bodensensor-offen.jpg shows the assembled sensor device

documentation/Sensor-Schaltbild.png shows the wiring in the sender case.

smt50-esp's People

Contributors

top-gun avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

smt50-esp's Issues

ADS1115 returns -1

Hi,
in first, thanks for great idea and solution for that !

in second, have small issue here, which i hope I will solve ... what ever i do, your code return me as results for voltage reads -1 , when i used esp easy , ads working fine, get results, also when i used ads basic Arduino example , I do get correct results .. is very strange to me as your code looks identical .. no special stuff regarding that ADS, I was into, my ads is broken, but it works with other code ?! ... only difference is, they put readings in loop part and you have it in setup, even i put it down into loop, turn off sleep , still get results -1 , any clue why ? what can be wrong ? ordered another ADS1115 just to try it , even i dont believe is broken ... please advise.

+question - soil moisture - when do you start your irrigation on which percentage ? and when do you stop it ? how deep you put sensor ?

this one is working fine : i do not see difference :(
sketch_jul25b.txt

connection to mqtt

Hallo und guten Morgen

Ich hab da mal ne Frage;

Meine mqtt -Geschichte läuft mit Benutzernamen & Pw; dies kann im code jedoch nicht hinterlegt werden..
? kann ich bei const char* mqtt_server =...... einfach noch zwei Linien einfügen mit dem Bn & dem Pw ? (wenn ja, - wie?)

... muss man bei der IP Adresse des mqtt servers den Port nicht angeben?

Habe ich dann, wenn alles funktioniert im iobroker in den Objekten unter sonoff; shelly oder so ein neues Objekt mit dem ich weiterarbeiten kann?
Wie du siehst, bin ich nicht gerade der pro auf diesem Gebiet...

Freundliche Grüsse
Matthias

Use loop() to receive MQTT callback reliably

Super Projekt. Lief bei mir dank toller Anleitung auf Anhieb. Vielen Dank.

Lediglich der MQTT callback kam so gut wie nie an. Mein Broker ist wohl zu langsam. Ich habe daher die Abfrage in die loop() verfrachtet. Die boolesche Variable callback_done wird entsprechend in callback() gesetzt. Die Integer-Variable max_runtime enthält die Millisekunden bis zum Timeout.
Jetzt geht's problemlos.

void loop()
{
  mqttClient.loop();

  // looping until MQTT callback has been received or timeout is reached
  if ( callback_done || millis() > max_runtime ) {

    // deep sleep now
    WiFi.disconnect( true );
    delay( 100 );
    ESP.deepSleep(Minuten * DS_Intervall, WAKE_RF_DISABLED);  
    delay( 100 );
    
  }
}

Sensor04-Truebner-SMT50.ino

Interessantes Projekt! Mir ist noch nicht ganz klar, wohin dieser Code kopiert werden soll. Ich habe meinen Wemos D1 bereits mit Tasmota geflasht und vor dem Kompilieren den ADS1115 aktiviert. Muss ich den Code vor dem Kompilieren irgendwo einfügen?

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.