Build Your Own Plant Humidity Sensor

by ppb in Circuits > Arduino

2847 Views, 35 Favorites, 0 Comments

Build Your Own Plant Humidity Sensor

Finished in plant.jpg

Do you want to perfectionize your plants well being? Are you unsure how much water your plant needs? or do you just want to track how much water the plant consumes? Then this project is for you.

Supplies

Electronics:

  • Arduino Nano (any other microcontroller)
  • Arceli Water Level Sensor (alternatively: soil moisture sensor)
  • 16x2 QAPASS LCD
  • RGB LED Module
  • Cables/Wires
  • Power Cable (Mini USB type B to USB type A)

Materials:

  • PLA Filament

Tools:

  • CAD Software (Autodesk Fusion 360)
  • 3D Printer (Flashforge Adventurer 3)
  • 3D Print Slicer Software (FlashPrint)
  • Soldering Iron & Wire

Build Your Circute

Koblingsskjema.png

Choose your components and create your circute diagram. The diagram will be very useful when programming the microcontroller.

Program Your Microcontroller

Electronics test.jpg

Program your microcontroller and test the system.

Arduino Code:

#include <LiquidCrystal_I2C.h>     // include the library code for the LCD screen
LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

#define POWER_PIN 6
#define SIGNAL_PIN A1

int value = 0;  // variable to store the sensor value
int red_light_pin = 4;
int green_light_pin = 3;
int blue_light_pin = 2;

void setup() {
  Serial.begin(9600);           // start the serical console

  // sensor setup
  pinMode(POWER_PIN, OUTPUT);   // configure D4 pin as an OUTPUT
  digitalWrite(POWER_PIN, LOW); // turn the sensor OFF

  // LCD setup
  lcd.init();
  lcd.backlight();
  lcd.setCursor(2,0);
  lcd.print("Humidity:");
  lcd.setCursor(2,1);

  // LED setup
  pinMode(red_light_pin, OUTPUT);
  pinMode(green_light_pin, OUTPUT);
  pinMode(blue_light_pin, OUTPUT);
}

void loop() {
  // sensor loop
  digitalWrite(POWER_PIN, HIGH);  // turn the sensor ON
  delay(10);                      // wait 10 milliseconds
  value = analogRead(SIGNAL_PIN); // read data from SIGNAL_PIN and store it to value variable
  digitalWrite(POWER_PIN, LOW);   // turn the sensor OFF

  // LCD loop
  lcd.setCursor(2,1);             // define where to write on the LCD screen
  lcd.print(value);               // write value on LCD screen

  //LED loop
  if (value<300) RGB_color(150,0,0);                     //Red
  else if (value>300 && value<350) RGB_color(150,150,0); //Yellow
  else if (value>350) RGB_color(0,150,0);                //Green

  delay(990); // wait 990 milliseconds
}

void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
 {
  analogWrite(red_light_pin, red_light_value);
  analogWrite(green_light_pin, green_light_value);
  analogWrite(blue_light_pin, blue_light_value);
}

Downloads

Model Your Enclosure

For this project I used Autodesk Fusion 360 to model the enclosure. The goal was to make it as small as possible, so it fits in the plant pot. To do this I downloaded 3D models of the electronic parts and used them to make a tight fit. I did leave some space for the wires. At the end the enclosure consisted of 3 parts that could be assembled by press fitting. The STL files are listed below.

3D Print Your Enclosure

CAD and 3D printed.jpg

The 3 parts were first sliced with FlashPrint and then 3D printed with an FlashForge Adventurer 3. The material used was black PLA.

Assemble

Wiring.jpg

Solder the electronics and insert them into the main enclosure. Then fit the other two enclosure parts.

Test Your Unit

Finished.jpg

Connect the power supply and test your sensor unit in your plant

Share Your Result and Gained Knowledge

Finally, I would like to encourage to comment below and maybe even create your own instructable.