Greetings to everyone, and welcome back.
This is GROW, an open-source, easy-to-build soil monitor setup that comprises an XIAO expansion board paired with a soil moisture sensor. The values obtained by the soil moisture sensor are displayed on the XIAO Expansion Board's OLED screen.
Making a portable soil moisture meter that we could use anywhere to measure soil moisture was the primary objective of this project.
This was made possible because of the XIAO expansion board, and we are powering the whole project from a lithium polymer cell connected to the XIAO expansion board.
This article is about the whole build process of this project, so let's get started with the build.
Material RequiredThese were the materials used in this project:
- XIAO SAMD21 M0 Dev Board
- XIAO Expansion Board
- Gravity Soil Sensor
- 3D Printed Holder
- M2 Screws
We first start by making the Cad design of the whole model in Fusion360.
We modeled the soil moisture sensor after modeling the XIAO expansion board first. Modeling every component before creating the design is a smart idea because it makes the process more accurate and efficient.
We created a holder that will incorporate the soil sensor and XIAO expansion board. Four M2 screws are used to secure the XIAO expansion board in its holder. Since the soil sensor did not have mounting holes, we made three holes close to the module's edge instead. We will insert M2 screws into these holes to secure the sensor in its initial position.
After finalizing the model, we exported the holder and 3D printed it on my Ender 3 printer with white PLA using a 0.6mm nozzle.
HARDWAREWe're using the XIAO SAMD21 M0 Development Board, which, paired with the XIAO extension board manufactured by Seeed Studio, is the heart of this project.
It comes with rich peripherals that include an OLED, RTC, SD Card Sot, passive buzzer, reset/user button, 5V servo connector, and Grove connector for pairing multiple Grove devices with XIAO.
We can power the entire setup using any Li-ion or LiPo cell thanks to its integrated Li-ion charging circuit; later in the project, we will be using a small Li-Po cell to power the whole setup.
If you would like to get one for yourself, here is the link to its page.
https://www.seeedstudio.com/Seeeduino-XIAO-Expansion-board-p-4746.html
One of the reasons for using the expansion board was its intergraded OLED display, which we will be using for displaying sensor values.
Seeed FUSION
This project is sponsored by Seeed Fusion. Seeed Fusion offers one-stop services catering to your needs, from design & customization to production and promotion. Focus on your strengths, co-create and co-grow with Seeed Fusion! Explore more here: https://www.seeedstudio.com/fusion.html
As for measuring the soil humidity and moisture, we're using a gravity moisture sensor that uses the two probes to pass current through the soil, and then it reads that resistance to get the relative moisture level. More water makes the soil conduct electricity more easily (less resistance), while dry soil conducts electricity poorly (more resistance).
Here are a few of its specs.
- Power supply: 3.3v or 5v
- Output voltage signal: 0~4.2v
- Current: 35mA
- Pin definition:
- Analog output (blue wire)
- GND(Black wire)
- Power(Red wire)
- Value range:
- 0 ~300 : dry soil
- 300~700 : humid soil
- 700~950 : in water
- Using a soldering iron and jumper wires, we first connect the XIAO Expansion board to the soil sensor's VCC GND and sensor pin by following the wiring diagram that is included.
- The JST connector from the Li-Po cell is then plugged into the battery JST connector present on the XIAO Expansion board.
We're using a 3.7V, 100mAh Li-Po Cell here.
- Subsequently, the LiPo is inserted into the 3D Printed Holder, and the expansion board and soil sensor are mounted.
- Next, we install the expansion board using four M2 screws and the soil sensor in its proper position using three M2 screws.
Assembly is complete.
TEST SKETCH FOR SOIL SENSORHere's the test sketch which we first uploaded to the XIAO for basic testing of the soil sensor.
The XIAO DEV Board reads the value from the Soil Sensor analog pin, which is connected to the A0 pin of the XIAO. The value is then shown on the Serial Monitor at a rate of 57600 Baud.
void setup(){
Serial.begin(57600);
}
void loop(){
Serial.print("Moisture Sensor Value:");
Serial.println(analogRead(A0));
delay(100);
}
The soil is deemed dry if the value falls between 0 and 300.
A value between 300 and 700 indicates that the soil is humid, while a value between 700 and 950 indicates that there is an abundance of water in the soil.
MAIN CODEWe uploaded the main code to the XIAO, and we got a reading of 1β9 without adding the sensor to the soil.
We gather some dirt into a small container and place the soil meter inside for the initial readings.
The measurements range from 450 to 455, indicating that the soil is wet.
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
int SensorPin1 = A0;
void setup(){
Serial.begin(57600);
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
}
void loop(){
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Moisture Value:");
display.display();
if (analogRead(SensorPin1) <= 300) // 05
{
// display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 45);
display.println("ITS DRY");
}
if (analogRead(SensorPin1) >= 300) // 05
{
// display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 45);
display.println("WET!!!");
}
if (analogRead(SensorPin1) >= 700) // 05
{
// display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 45);
display.println("WATER");
}
// display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 20);
display.println(analogRead(A0));
display.display();
// Serial.println(analogRead(A0));
delay(2000);
}
RESULTFollowing an inside sensor test, we moved the instrument outside and placed the sensor probes on dry soil, where we obtained readings between 13 and 15.
When we added water to the dry soil, the GROW Meter detected it and gave us a reading higher than 700.
When the water is absorbed by the soil, the value drops to 450β500 after a few minutes, indicating that the soil is now moist.
The most appealing aspect of this setup is that it is small, lightweight, and portable, making it ideal for measuring soil moisture levels in various locations.
The XIAO Expansion Board, powered by a Li-Po cell, allows the entire setup to be truly portable.
This is it for today, folks. Special thanks to Seeed Studio for supporting this project.
And I'll be back with a new project pretty soon!
Comments