Capacitive Soil Moisture Sensor With M5Stack ATOM Matrix | M5Stack

In this tutorial, we will build a simple soil moisture indicator using an M5Stack ATOM Matrix, a capacitive soil moisture sensor, and Visuino.

The project provides an easy visual indication of the soil condition:

🟢 Soil moisture is sufficient → the ATOM Matrix lights up green

🔴 Soil is too dry → the ATOM Matrix lights up red

The tutorial shows how to connect the capacitive soil moisture sensor to the M5Stack ATOM Matrix and how to configure the logic in Visuino to continuously monitor the analog sensor value. Based on the measured moisture level, the built-in RGB LED matrix automatically changes color, making it easy to see when your plant needs watering.

Unlike resistive moisture sensors, the capacitive sensor is more resistant to corrosion, providing greater reliability and longer service life for continuous monitoring.

This project can be used as the basis for smart plant watering systems, greenhouse monitoring, indoor gardening, educational electronics projects, or as part of a larger IoT plant monitoring solution.

In this tutorial, you will learn how to:

  1. Connect a capacitive soil moisture sensor to the M5Stack ATOM Matrix
  2. Read analog soil moisture values in Visuino
  3. Compare the measured value against a moisture threshold
  4. Display a green or red status on the built-in RGB LED matrix
  5. Build a simple visual soil moisture indicator

📥 Download the Visuino project file at the bottom.

🎥 Watch the Video!

Note: The moisture threshold can be adjusted in Visuino to match your particular sensor, soil type, and watering requirements.

STEP 1
What You Will Need
  1. ATOM Matrix ESP32 More info
  2. Capacitive Analog Soil Moisture Sensor
  3. Jumper wires
  4. Visuino program: Download Visuino

 

What You Will Need

What You Will Need photo 2

What You Will Need photo 3

What You Will Need photo 4

STEP 2
The Circuit
  1. Connect Capacitive Soil sensor pin GND to Atom Matrix pin GND
  2. Connect Capacitive Soil sensor pin VCC to Atom Matrix pin 5V
  3. Connect Capacitive Soil sensor analog pin AOUT to Atom Matrix pin GPIO [33]

 

The Circuit

STEP 3
Start Visuino, and Select the Atom Matrix Board Type

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 "Atom Matrix" as shown on Picture 2

Start Visuino, and Select the Atom Matrix Board Type

Start Visuino, and Select the Atom Matrix Board Type photo 2

STEP 4
In Visuino Add Components
  1. Add "Compare Analog Value" component
  2. Add "Digital To Color" component

In Visuino Add Components

In Visuino Add Components photo 2

STEP 5
In Visuino Set Components
  1. Select "M5 Stack ATOM Matrix" board and in the properties window expand "Modules">"RGB Matrix">"Elements" and click on the 3 dots button
  2. In the "Elements" window drag "Fill Screen" to the left side and in the properties window select "Color" and click on the Pin Icon and select "Alpha Color SinkPin"
  3. Close the "Elements" window

 

 

  1. Select "Compare1" and in the properties window set "Compare Type" to ctSmallerOrEqual and "Value" to 0.5

Note: You should experiment with the correct value to achieve the best sensitivity, the best way is to connect GPIO 33 to serial pin and see the correct values in Serial monitor (When soil is dry or wet).

  1. Select "DigitalToColor1" and in properties window set "False Value" to clRed and "True Value" to clGreen

In Visuino Set Components

In Visuino Set Components photo 2

In Visuino Set Components photo 3

In Visuino Set Components photo 4

In Visuino Set Components photo 5

STEP 6
In Visuino Connect Components
  1. Connect Atom Matrix GPIO [33] pin [Out] to "Compare1" pin [In]
  2. Connect "Compare1" pin [Out] to "DigitalToColor1" pin [In]
  3. Connect "DigitalToColor1" pin [Out] to Atom Matrix > "Fill Screen1" pin [Color]
  4. Connect "DigitalToColor1" pin [Out] to Atom Matrix > "Fill Screen1" pin [Clock]

In Visuino Connect Components

In Visuino Connect Components photo 2

STEP 7
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.

Generate, Compile, and Upload the Arduino Code

STEP 8
Play

If you power the M5Stack ATOM Matrix module, the built-in LED matrix will immediately start showing the soil moisture status in real time — displaying green when the soil has enough moisture and red when it is too dry.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.com

icon Matrix-plant.zip 9KB Download(0)
License
All Rights
Reserved
licensBg
0