Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FC-28 Soil Moisture Sensor #98

Open
arcostasi opened this issue Aug 2, 2021 · 2 comments
Open

FC-28 Soil Moisture Sensor #98

arcostasi opened this issue Aug 2, 2021 · 2 comments
Assignees
Labels
open for vote Vote at https://wokwi.com/features

Comments

@arcostasi
Copy link
Contributor

arcostasi commented Aug 2, 2021

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);
}
@urish urish added the open for vote Vote at https://wokwi.com/features label Sep 16, 2021
@leftCoast
Copy link

leftCoast commented Aug 19, 2022

That's a terrible moisture sensor. How about using the el'-cheapo capacitive one you can find on Amazon? Those, if you calibrate them, (Well, and seal them up from getting water in their entrails) typically work great for years.

@arcostasi
Copy link
Contributor Author

I understand, this sensor is widely used here in Brazil due to its low cost and many students buy this sensor to do some project at home or at school. But it's always good to know something more precise and of better quality. I appreciate the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open for vote Vote at https://wokwi.com/features
Projects
None yet
Development

No branches or pull requests

4 participants