Dennis LoiAndrea Panzino
Published

Soil monitoring with Agrumino and Blynk dashboard

A system to monitor the soil status using Wi-Fi with a remote dashboard based on Blynk.

IntermediateProtip1 hour57
Soil monitoring with Agrumino and Blynk dashboard

Things used in this project

Hardware components

Agrumino
Lifely Agrumino
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk
site+android app

Story

Read more

Code

Agrumino code

C/C++
#include <Agrumino.h>

#define SLEEP_TIME_SEC 600 //10 minutes

// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial

//Copy this from the blynk website
#define BLYNK_TEMPLATE_ID "template_ID"
#define BLYNK_DEVICE_NAME "TemplateName"
#define BLYNK_AUTH_TOKEN "token"

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ssid";
char pass[] = "wifi_password";

char auth[] = BLYNK_AUTH_TOKEN;

Agrumino agrumino;

void deepSleepSec(int sec) {
  ESP.deepSleep(sec * 1000000); // microseconds
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  agrumino.setup();
}

void loop()
{
  Serial.println("#########################\n");

  agrumino.turnBoardOn();

  //Get variables
  float temperature = agrumino.readTempC();
  unsigned int soilMoisture = agrumino.readSoil();
  float illuminance = agrumino.readLux();
  unsigned int batteryLevel = agrumino.readBatteryLevel();

  //Print variables to serial
  Serial.println("");
  Serial.println("temperature:       " + String(temperature) + "C");
  Serial.println("soilMoisture:      " + String(soilMoisture) + "%");
  Serial.println("illuminance :      " + String(illuminance) + " lux");
  Serial.println("batteryLevel :     " + String(batteryLevel) + "%");
  Serial.println("");

  //Collect the variables
  Blynk.virtualWrite(V0, temperature);
  Blynk.virtualWrite(V1, soilMoisture);
  Blynk.virtualWrite(V2, illuminance);
  Blynk.virtualWrite(V3, batteryLevel);
  
  Blynk.run();

  agrumino.turnBoardOff();

  deepSleepSec(SLEEP_TIME_SEC);
}

Credits

Dennis Loi

Dennis Loi

0 projects • 0 followers
Andrea Panzino

Andrea Panzino

0 projects • 0 followers

Comments

Add projectSign up / Login