Skip to content

🌱 A basic soil moisture level sensor using Arduino UNO. Written in C++

Notifications You must be signed in to change notification settings

vbagieta/SimpleSoilMoistureSensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Soil Moisture Sensor

A simple soil moisture sensor using an Arduino UNO microcontroller.

Components Used

Code

This program is written in the C++ programming language.

πŸ‘‰ View Code

Used Libraries

Connections

Arduino Pin Display Pin Sensor Pin
GND GND GND
A4 SDA ❌
A5 SCL ❌
A0 ❌ AOUT
5V VCC ❌
3.3V ❌ VCC

Calibration

Sensor Calibration Code

The sensor data pin is connected to pin A0.

void setup() {
  Serial.begin(9600);
}
void loop() {
  int value;
  value = analogRead(A0);
  Serial.println(value);
  delay(100);
}

Steps

First, record the highest value the sensor obtains when dry. Change the value in the code (default is 603) to the measured value:

const int dryValue = 616; -> const int dryValue = YOUR_VALUE;

Next, measure the value the sensor obtains when wettest. Measure and replace the value in the code:

const int wetValue = 292; -> const int wetValue = YOUR_VALUE;

Now, upload the code to the Arduino and everything should work!

About

🌱 A basic soil moisture level sensor using Arduino UNO. Written in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages