PCBWay 3rd PCB Design Contest
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Design 1/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Usability 2/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Creativity 3/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Content 4/4

The arduino will automatically detect if the plants need something.

-When it's getting dark the light will turn on.

-If the plants need water it's activate the water pump.

-Every few hours the fan will turn on to give some fresh air.

And a timelapse.

Step 1: What You Need :

Let's have look :

-Arduino uno


-Wire i like these wire they are already cut in different size but it's obviously optional

-Photo resistor

-Soil moisture

-Water pump


-FAN i used a 12v from an old computer: (zalman)

Diode 1n4007


-Light If you can't order this one check "12v light Photosynthesis"


To get the project funnier i added a raspberry pi with camera to get a timelapse, if you interrested i will add a tutorial to set it up (very easy)

Step 2: Getting Started

It can look complicated but if you do part by part is simple:

Soil moisture:

To mesure if the plants need water we gonna mesure the humidity .

One pin goes to 5V , other one to ground and third the anolog to A1

Light sensor:

This part will allow us to mesure if there is enough light in the room

One part is connected to A0 with the resistor connected to the ground.

The other one to the 5v


This will be the most complicated of the project if you don't want a fan just skip it.

I posted one photo without the relay to get better idea.

- One wire goes from the resistor to pin 3

-The GND of the fan goes on the middle pin of the transistor.

The + of the fan goes to the relay (middle pin)

The last pin of the transistor goes to gnd

The diode goes to the midlle pin of transistor and to the GND


The anode(+) goes to the relay

The other to the GND of the power supply

Water Pump:

Still the same the + goes to midlle on the relay and GND to GND of the power source

We almost done! Just need to connect the relay to the arduino and updload the code .

Step 3: Final Schema

I used 2 relay in the graphic fritzing does not have relay 4channel yet.

Important for the relay i used only one 12v power supply , i separate the wire positive and negative then solder 3 wire from the positive and connect each part on the relay.One is enough as everything does not turn on at the same time.

I used a 5v power supply for the arduino




IN1: PIN2 Activate the light

IN2: PIN5 Activate the water pump

IN3: none

IN4: PiN4 activate the FAN

Step 4: The Code

To finish upload the code to the arduinio.

I wrote comment on the line to modify if you want to change the value (when to turn on the light or the water pump or how long the fan must be on or off).

Don't pay attention to the name of the variable as they are not relevant .

int PROBE= 1;
int value= 0; 
int TIP120pin = 3; //for this project, 
int ledState = LOW;             // 
unsigned long previousMillis = 0;        // will store last time LED was updated
long OnTime = 3600000;           // milliseconds of on-time FAN modify here
long OffTime = 60000;          // milliseconds of off-time FAN modify here
 int sensorPin = A0;   // select the input pin 
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() 
  // set the digital pin as output:
  pinMode(TIP120pin, OUTPUT); // Set pin for output to control TIP120 Base pin    
pinMode(4, OUTPUT);
  pinMode(2, OUTPUT); //pin connected to the relay
  Serial.begin(9600); //sets serial port for communication
void loop()
  // check to see if it's time to change the state of the FAN
  unsigned long currentMillis = millis();
  if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime))
    ledState = LOW;  // Turn fan off
    digitalWrite(4,LOW);//tur off the relay
    previousMillis = currentMillis;  // Remember the time
    digitalWrite(TIP120pin, ledState);  // Update
  else if ((ledState == LOW) && (currentMillis - previousMillis >= OffTime))
    ledState = HIGH;  // turn fan on
    digitalWrite(4,HIGH);// turn on the relay
    previousMillis = currentMillis;   // Remember the time
    digitalWrite(TIP120pin, ledState);    // Update 
  //code for the light
    sensorValue = analogRead(sensorPin);    
  Serial.println(sensorValue); //prints the values coming from the sensor on the screen
  if(sensorValue > 150) //Modify here for the light
  digitalWrite(2,HIGH); //turn relay ON
  else digitalWrite(2,LOW); //turn relay OFF
//code water pump
 value= analogRead(PROBE);  
 value= value/100;  //divided by 100
 if(value<5)  //modify here the value
   digitalWrite(5, HIGH);  
   digitalWrite(5, LOW);  

Step 5: Conclusion

If you respect the few steps in order will be very easy

My water pump is directly immerge into the water and the pipe deep in the ground , this is fine to get water everywhere in your farm but could be improve in order to control where the water is going.

Same for the soil moisture deep in the ground . Think to check it sometime because it gets damage fast .

The fan on the top to give fresh air or to renew it

For my use i kept the default value on the code but think maybe to modify it for the light to turn on when it's darker.

On the picture you can see it's a big mess i used to long cable so think carefully!

My plants grew up pretty fast but pay attention to what seeds you get mine are up to 90cm !

Looking forward for your comments of any improvement.

For the timelapse here

May 29,2020
98 viewsReport item
  • Comments(0)
  • Likes(1)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
    View More