How To Build A Plant Monitor With Arduino

About the project

In this tutorial we will learn how to detect a soil moisture using a moisture sensor and flash a green LED if everything is ok

Project info

Difficulty: Moderate

Platforms: ArduinoDFRobotVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Jumper wires (generic) Jumper wires (generic) x 1
Breadboard (generic) Breadboard (generic) x 1
LED (generic) LED (generic) x 2
Arduino UNO Wifi Rev.2 Arduino UNO Wifi Rev.2 x 1
ElectroPeak 0.96" OLED 64x128 Display Module ElectroPeak 0.96" OLED 64x128 Display Module x 1
DFRobot Gravity: Analog Soil Moisture Sensor For Arduino DFRobot Gravity: Analog Soil Moisture Sensor For Arduino x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

In this tutorial we will learn how to detect a soil moisture using a moisture sensor and flash a green LED if everything is ok and OLED Display and Visuino.

Watch the video.

Step 1: What You Will Need

1 / 6

Arduino UNO (or any other Arduino) 

Soil moisture sensor module, Get it here

Jumper wires

Breadboard 

OLED Display 

1X Red LED, 1X Green LED 

Visuino program: Download Visuino

Step 2: The Circuit

  • Connect OLED Display pin[VCC] to Arduino pin[5V]
  • Connect OLED Display pin[GND] to Arduino pin[GND]
  • Connect OLED Display pin[SDA] to Arduino pin[SDA]
  • Connect OLED Display pin[SCL] to Arduino pin[SCL]
  • Connect Arduino 5V to piezo buzzer module pin VCC
  • Connect Arduino GND to Green LED negative Pin
  • Connect Arduino GND to Red LED negative Pin
  • Connect Arduino Digital Pin 3 to Green LED negative Pin
  • Connect Arduino Digital Pin 2 to Red LED negative Pin
  • Connect Arduino 5V to moisture sensor module pin VCC
  • Connect Arduino GND to moisture sensor module pin GND
  • Connect Arduino analog pin 0 to moisture sensor module pin A0

Step 3: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this tutorial will not work! If you have not done follow the steps in this tutorial to setup the Arduino IDE to program Arduino UNO! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: In Visuino ADD and Set Components

1 / 6

Add "OLED Display" component

Add 2X "Compare Analog Value" component

  • Double click on the DisplayOLED1 and in the elements window drag Text Field to the left, then in the properties window set size to 3Close the elements window
  • Select CompareValue1 and in the properties window set "Compare Type" to ctBiggerOrEqual and Value to 0.7 <<this is the sensitivity value, you can change it if you want
  • Select CompareValue2 and in the properties window set "Compare Type" to ctSmaller and Value to 0.7 << this is the sensitivity value, you can change it if you want

Step 5: In Visuino Connect Components

  • Connect Arduino analog pin 0 to CompareValue1 pin In, CompareValue2 pin In, DisplayOLED1>Text Field1 Pin In
  • Connect CompareValue1 Pin Out to Arduino digital pin 2
  • Connect CompareValue2 Pin Out to Arduino digital pin 3
  • DisplayOLED1 pin I2C Out to Arduino board I2C pin In

Step 6: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 7: Play

If you power the Arduino UNO module, and the LED should flash (red not enough water,green enough water) and the OLED Display will show the moisture levelCongratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it here and open it in Visuino: https://www.visuino.eu


Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...