Project #29 - DFRobot - Soil Moisture - Mk29

Project #29 - DFRobot - Soil Moisture - Mk29

 

https://www.donluc.com/?p=4127

 

https://youtu.be/kZTjxTFsymg

 

#DonLucElectronics #DonLuc #DFRobot #ASM #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

 

 

 

 

Soil Moisture

 

Soil moisture is the critical parameter in agriculture. If there is a shortage or overabundance of water, plants may die. At the same time, this data depends on many external factors, primarily weather conditions and climate changes. That is why it is so vital to understand the most effective methods for analyzing soil moisture content.

 

This term refers to the entire quantity of water in the ground’s pores or on its surface. The moisture content of soil depends on such factors as weather, type of land, and plants. The parameter is vital in monitoring soil moisture activities, predicting natural disasters, managing water supply, etc. This data may signal a future flood or water deficit ahead of other indicators.

 

DL2409Mk04

 

1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
1 x USB 3.1 Cable A to C

 

FireBeetle 2 ESP32-C6

 

ASM - A1
LED - 15
DC - D2
CS - D6
RST - D3
VIN - +3.3V
GND - GND

 

DL2409Mk04p

 

DL2409Mk04p.ino

CODE
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - Soil Moisture - Mk29
29-29
DL2409Mk04p.ino
DL2409Mk04
1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";

// LED Green
int iLEDGreen = 15;

// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "29-29";

void loop() {

  // Gravity: Analog Soil Moisture Sensor
  isSoilMoisture();

  // DFRobot Display 240x320 - ASM
  isDisplayTH();

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

CODE
// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - ASM
void isDisplayTH() {
  
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // Don Luc Electronics
    screen.setCursor(0, 30);
    screen.println("Soil Moisture Sensor");
    // Gravity: Analog Soil Moisture Sensor
    screen.setCursor(0, 60);
    screen.println( "ASM: " );
    screen.setCursor(60, 60);
    screen.println( iSoilMoistureVal );
    screen.setCursor(0, 90);
    screen.println( SM );

}

getEEPROM.ino

CODE
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getSoilMoisture.ino

CODE
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){

  // Connect Soil Moisture Sensor to Analog 0
  zz = analogRead( iSoilMoisture );

  // iSoilMoistureVal => 0~900 Soil Moisture
  iSoilMoistureVal = map( zz, 0, 4095, 0, 900);

  // Threshold
  if (iSoilMoistureVal > Threshold)

    // 300~950 - Humid Soil
    SM = "Humid Soil";
    
  else {
    
    // 0-300 Dry Soil
    SM = "Dry Soil";

  }

}

setup.ino

CODE
// Setup
void setup()
{
  
  // Give display time to power on
  delay(100);

  // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();
  
  // Delay
  delay( 100 );

  // Wire
  Wire.begin();

  // Delay
  delay( 100 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // Initialize the LED Green
  pinMode(iLEDGreen, OUTPUT);

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

People can contact us: http://www.donluc.com/?page_id=1927

 

Teacher, Instructor, E-Mentor, R&D and Consulting

 

-Programming Language
-Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc...)
-IoT
-Wireless (Radio Frequency, Bluetooth, WiFi, Etc...)
-Robotics
-Automation
-Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
-Unmanned Vehicles Terrestrial and Marine
-Machine Learning
-Artificial Intelligence (AI)
-RTOS
-Sensors, eHealth Sensors, Biosensor, and Biometric
-Research & Development (R & D)
-Consulting
-Etc...

 

Follow Us

 

Luc Paquin – Curriculum Vitae - 2024
https://www.donluc.com/luc/

 

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
DFRobot Luc.Paquin: https://edu.dfrobot.com/dashboard/makelogs
Hackster.io: https://www.hackster.io/neosteam-labs
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

 

Don Luc

icon DL2409Mk04.zip 1.08MB Download(1)
License
All Rights
Reserved
licensBg
0