Put It All Together

By Emir

After setting up the all of the sensors we covered in previous tutorials, we get to the fun part of making the whole system work together. Check this tutorial on how to do that!

Step 1

Prepare device and sensors

To make it easier to connect all sensors on Arduino, we suggest using extension board shield.

Here is a list from ebay for all materials we used. All hardware material cost around $47.

Step 2

Mount expansion board on Arduino

Expansion board has two different parts with different number of pins.

Pair matching parts with Arduino side and connect male pins from board to female pins on Arduino.

Step 3

Attach DHT22 sensor

Because we need to use 4.7 k ohm resistor, take two parts of wire and solder resistor with them. Each side of resistor should go with one wire.

Screw one end in 5V hole and other in Pin 8. This is used instead of attaching resistor on DHT22 pins directly as shown in tutorial.

Connect wires to DHT22 as follows:

  • Pin 1 - Vcc (5V);
  • Pin 2 - Pin 8 (Arduino);
  • Pin 3 - Not connected;
  • Pin 4 - Ground (Arduino);

I suggest to solder DHT22 pins with wire through the window on female jumper side (see picture).

Step 4

Connect relay module

Connect relay module with Arduino board using six wires.

  • Gnd - Gnd (Arduino);
  • In1 - Pin 2 (Arduino);
  • In2 - Pin 3 (Arduino);
  • In3 - Pin 4 (Arduino);
  • In4 - Pin 5 (Arduino);
  • Vcc - 5V (Arduino).
Step 6

Attach float switches

First float switch is important to stop pumping water in upper pipes. If this float switch is not set properly after starting the pump, it will not stop.

This float switch has to be surrounded by protective material to avoid perlite from blocking the floating part on the switch. I used case for filter and it fits perfectly for this use. For other two I used perforated stainless steel sheets and made them into the shape as on the picture to fit in container pipe and to make them more stabile. Mount it before connecting the wires as shown on the picture.

For the first float switch connect one wire with ground and other to Pin 9 on Arduino.

At the same time connect each wire from other float switches with the same ground Pin from the first one. This way you will save pins and time for next two float switches.

Connect the next two float switches to Pin 10 and Pin 11 on Arduino. Connect the half-empty alarming float switch to Pin 10, and float switch from bottom tank to Pin 11.

Step 7

Attach waterproof temperature sensor

Like DHT22, this sensor also need resistor between Vcc and signal wire. Do the same like in one of the previous step and connect resistor between Pin 12 and 5V.

Connect yellow wire from sensor to Pin 12 on Arduino.

Connect gray wire from sensor to ground on Arduino.

Connect red wire from sensor to 5V on Arduino.

Of course you can connect ground wires with other where you have space. Same case is with 5V.

Step 8

Attach Real Time Clock

Before attaching RTC, insert the battery.

RTC and light sensor use same protocol called IIC. They will share the same pins on Arduino for communication.

There is one trick about these pins. For SCL and SDA pins on Arduino we use analog pins A5 and A4. But the same pins SCL and SDA can be found on digital sides pins (last two after GND and AREF).

In our case this will help us because we will connect RTC using analog pins 4 and 5, and for light intensity sensor we will use pins on digital pins side.

Connect (RTC - Arduino):

  • SLC - Pin A5;
  • SDA - Pin A4;
  • Vcc - 5V or 3,3V (I use 3,3V);
  • Gnd - Gnd.
Step 9

Attach light intensity sensor

Like previous sensor, lux sensor also uses IIC protocol.

For this sensor we will use SLC and SDA pins on Arduino digital side pins. Marks for these two pins are from bottom side. Also, you can use same pins used for RTC. This protocol allow us to use multiple sensors at the same pins.

Connect (lux sensor - Arduino):

  • SCL - SCL;
  • SDA - SDA;
  • Gnd - Gnd;
  • Vcc - 5V.
Step 10

Test everything now

Now it is the best time to test all of the sensors.

Connect Arduino with USB cable to computer and upload code using Arduino IDE.

How to test sensors?

This code reads sensors every minute.

Be sure to avoid night shift. If you test this in late hours change value at line 84.

Test soil sensor triggering water pump. Pump will stop when you change position on shielded float switch.

Of course be sure that other two float switches are sending 1, and play with them after.

If light intensity is under 6000 lux, turn on relay channel 1. If your room light is under 6000 lux, turn on mobile phone flash light ant after next reading you will see that relay channel will be turned off and lux value will be more then 20000 lux.

show more
Step 11

Put sensors in place

After you are sure that electronic is working fine, put sensors in their place.

Fix float switches in tank. Insert stone bubbler and water pump in tank. Make holes on tank cap for air and water pipes.

Insert waterproof temperature sensor inside tank.

Insert float switch in upper pipe tank (like on picture).

Make hole for water pump pipe and fix it in place.

Make sure that light sensor is on surface where sun light can reach it.

Step 12

Connect devices to relay

During testing we just follow LED on relay module.

In this case we use water and air pumps, both work on 5-12V. Because of this we choose 9V power source.

There is one trick. When we power Arduino 2.1mm power plug there is one pin with same voltage we can easily use - Pin Vin.

We will use power source from Vin pin for pumps. Connect Vin Pin from Arduino with middle pin on relay channel one. We can use this middle channel pin to connect with second channel, because they use same power source.

Then connect positive pin from water pump with relay channel 1 pin. Choose that one which is not powered if is not driven by module.

Orange wire on picture is power source from Vin (9V if we use 9V power source for Arduino). We make bridge for the same power source from one to another relay channel with white wire. Red wire from device is connected to relay channel pins to be turned on when relay channel is turned on too.

Ground wires from both pumps connect with any ground Pin on Arduino.

Tutorial Forum

Ebay link doesn\'t work

Hey i just bought al the stuff required to perform the earlier steps in this proces of building my first hydroponic farm.rnrnNow i'm heading towards putting ...