
This project builds a complete automatic irrigation system that physically opens a water valve when the soil is dry, relying on the FC-28 sensor and a switching transistor instead of a small pump — a broader practical extension of the soil-moisture sensing principle we covered earlier with NodeMCU.
Components needed
An Arduino board, an FC-28 soil moisture sensor, a solenoid water valve, a BC547 transistor, a 1N4007 protection diode, and a separate 12V power supply for the valve.
Wiring it up
The FC-28 sensor's analog signal pin (SIG) connects to Arduino's A0 port, while digital pin 2 controls the base of a BC547 transistor that acts as a switch to run the water valve. The 1N4007 protection diode is placed across the valve to absorb the voltage spike (flyback) that occurs when it switches off, and the valve is powered from a separate 12V external source apart from the Arduino's 5V circuit, with both grounds tied together.
How it works
The code continuously reads the analog moisture value across a 0-1023 range and compares it against a preset threshold (70 by default). When soil dryness pushes the reading past this threshold, the code sends a HIGH signal to pin 2 to turn on the transistor and open the valve; once moisture rises and the reading drops below the threshold, the code stops and closes the valve automatically — a complete watering cycle with no manual intervention.
You can find the FC-28 sensor and solenoid water valves at Juthour Tech.
اترك تعليقا