Problem with FC-28 moisture sensor calibration & correct values

Hello everybody ! :)

I just bought this moisture sensor |500x500

I've followed this tutorial

i use the analog input to read values : i have values between 483 and 1023.

My main problem is , when i put this sensor in my soil, i always have 100% humidity (1023). I tried different type of soil (drier, mid-dry) and this sensor appears to be extremely sensitive. When i put my sensor out, i see the humidity changing... So it's correctly wired i guess...

I tried to use the blue potentiometer , but the values are the same. The only change is the green led (D0) starts easily.

I've tried to change voltage too, from 5 to 3.3V. But it changes nothing.

What could i do to have coherent values from my sensor ?

Thanks in advance !!!

The sensor may have an digital output, with the trigger level adjustable by the pot.

It has a digital output, but only triggers 1 or 0 if the moisture level is reached ... That is not really what i want. I want a precise value of the soil moisture :S

Hi, You can buy a similar sensor with analogue output for a few $, but it is a rather crude sensor. It may be useful to determine soil humidity to control a water pump, but I think it is unsuitable for measuring soil humidity with reasonable accuracy. Depending on your plants and growing conditions it may or may not be a success.

It will be simple to connecting the analogue sensor output to the analogue Arduino input. If you print the values on the serial monitor you can observe changes as you change soil humidity. But, in my experience, the values will not be very stable over time (weeks). Still I enjoyed doing it, and learned a lot.

Soil humidity is an interesting subject, see:

immikimaru, The tutorial at uses a analog / digital dual output sensor, but only takes advantage of the analog output. That code will not work with your digital out only sensor.

I have the same sensor, but the little board is useless if you just want an analog value.

Try this: Vcc (3.3V - 5V) ---> 10K resistor ---> FC 28 ---> GND | | Analog Arduino

You will have value from 0 to 1023 (1023 = dry soil), in practice the sensor never reach 0 but approx 300 (depending of the sensor, the soil etc)

It's not very very precise, but it's good for plant monitoring if you don't need accuracy.

Hi! I had the same problem a week ago... This sensor have almost zero documentation and it is difficult to understand. After a week of study and reading I finaly understood how it works and how to use it. I'll post in my blog probably next wek about this sensor and how to use it properly.

But, in advance, if someone is having the same problem and got here, the code in the link ( has the following line: "sensorValue = constrain(sensorValue, 485, 1023);"

This line indicates that the Arduino will "understand" data in that range (from 485 to 1023). In other words, if you sensor can read values between 60 and 400, for example, you will only see 485. =) Here, in my project, I read only between 85 and 490. You need to comment this line in order to test your sensor first. Also, in that code you can see a "map" comman that indicates the minimum and maximum values and they need to be changed too.

So... Firstly you need to get only the analog read and test your sensor for dry and wet soil. With these values, you can use the constrain and map functions (or don't use it at all!).

Maybe I won't help the guy who posted it, but I hope to help other people that have same problem...

It has a digital output, but only triggers 1 or 0 if the moisture level is reached … That is not really what i want. I want a precise value of the soil moisture :S

Did you ever get your setup working?

I bought some similar sensors but they have digital and analog outputs. I have my code posted in my blog here:

This has all of the materials and what not that I was using. Hopefully you got a setup working but if not, this will do the trick. I am only using the analog portion of my sensor output to have a measurement via the LED of how “moist” the soil is. The actual watering still happens based on the digital output and adjustment of the potentiometer but that statement in the code could easily be modified for the 0-100% value of the mapped analog sensor output.

Also, here is what I used:

Arduino Code:

//———–Start All Code Here————-

#include <Servo.h>
Servo waterServo; //creates the name of servo
int val = 0; //holds the value of the digital sensor reading
int val2 = 0; //used to activate the watering after 5 loops of being “dry”
int servoPin = 3; //sets servo pin, must be a PWM pin for activating servo position
int waterPosition = 110; //watering position of the servo, in degrees from vertical
int waterHold = 0; //holding position to return to when done watering
int output_value; //this is the output value used in the analog sensor measurement of moisture
int sensor_pin = A0; //this is the analog input on the board from the sensor

void setup() {
pinMode(4,INPUT); //enable digital pin 4 for sensor input readings
pinMode(7,OUTPUT); //enable digital pin 7 output for sensor power
pinMode(13,OUTPUT); //enable on-board LED
Serial.begin(9600); //start serial output at 9600 bitrate – for readings
Serial.println(“Starting Code”); //notes in serial monitor
waterServo.attach(servoPin); //sets the servo pin as output
waterServo.write(waterHold); //sets the servo to the holding position specified at start
digitalWrite(7,HIGH); //set PIN 7 high to power the moisture sensor



void loop() {

/include commented out “000);” in order to include the
30 minute delay between readings

//analog reading of moisture levels from sensor
output_value= analogRead(sensor_pin);//read analog values from sensor
output_value = map(output_value,980,250,0,100);//map analog raw values to the scale of the sensor
Serial.print(“Moisture: “); //print in serial monitor
output_value = output_value/10; //divide output_value by 10 for LED blinking purposes

for (int led=0;led<=output_value;led++){
digitalWrite(13,1);//turn on the on-board LED (and the wired LED if using one)

digitalWrite(13,0);//turn off the on-board LED (and the wired LED if using one)

val = digitalRead(4); //read soil moisture sensor digital output
if(val == 1){ // if soil is dry, increment val2 in order to keep from watering too often
val2++;// = val2 + 1;

if(val2 == 5){ //if soil is dry for 5 consecutive readings, add water

waterServo.write(waterPosition); //start watering
delay(2*1000); //allow watering to occur for 2 seconds

val2 = 0;

//this is used to make the servo less jerky
//when returning to original position to stop water flow
for (int s=waterPosition; s>=waterHold; s–){
} //end of for loop to control servo return speed

}// end of if statement to check for 5 consecutive readings of “dry” condition
}//end of loop

//———–End All Code Here————-