Skip to content

FC-28 Soil Moisture Sensor #98

Open
@arcostasi

Description

@arcostasi

FC-28 Soil Moisture Sensor is a simple breakout for measuring the moisture in soil and similar materials. The soil moisture sensor is pretty straight forward to use. The two large exposed pads function as probes for the sensor, together acting as a variable resistor. The more water that is in the soil means the better the conductivity between the pads will be and will result in a lower resistance, and a higher AOUT.

fc-28-moisture-sensor

The FC-28 module has both digital and analog outputs. The analog output AO of the FC-28 gives a direct analog value of sensor readings, because it is the value of voltage drop across the probe. So analog output value returns a voltage value proportional to the resistance of the soil. That is, value will be high when the soil is dry and the value decreases as it gets wet.

The FC-28 module has a threshold adjust potentiometer for the digital output to preset the required threshold value. The sensor value will be compared with this threshold value by the LM393 comparator. When the sensor value is above the set threshold value the digital output DO will switch to a HIGH state (+5V). That is if the soil is less moisture then the voltage across the probe becomes high and that switches digital output to high state. The output LED is just inverse to the digital output if DO is High then the LED turns OFF. An ON DO LED indicates that the resistance is low than the threshold that is the the soil moisture is higher than threshold.


Technical Specifications

  • Operating voltage 3.3V-5V
  • Power indicators: (red) and digital switching output indicator (green)
  • Comparator Chip : LM393

Pinouts

  • VCC: .3.3V-5V
  • GND: 0V Ground Reference
  • DO: digital output (0 or 1)
  • AO: Analog output (0 – VCC)

Documents

Code

To connect the sensor in the analog mode, we will need to use the analog output of the sensor. When taking the analog output from the soil moisture sensor FC-28, the sensor gives us the value from 0-1023. The moisture is measured in percentage, so we will map these values from 0 -100 and then we will show these values on the serial monitor.

const int sensorPin = A0;

void setup() {
  Serial.begin(9600);
  pinMode(sensorPin, INPUT);
}

void loop() {
  int analogValue = analogRead(sensorPin);
  int moisture = map(analogValue, 0, 1023, 0, 100);

  Serial.print("Moisture in soil: ");
  Serial.println(moisture);
  delay(1000);
}

Metadata

Metadata

Assignees

Labels

open for voteVote at https://wokwi.com/features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions