Hydroponics - Water Level Detection

Made by Ria Jethmalani

Found in DioT 2019: Internet of Plants

An IoT device that monitors the water level in a hydroponics farm and alerts the farmer/grower through sound and light.

0

Solution

My project aims to provide a solution to this problem. The soil moisture sensors are placed at two different levels to detect the level of the water in the container. Level 1 is the lower level and is indicated by the pink dot and level 2 is the higher level and is indicated by the orange dot. Different sounds emitted by the piezo indicate the current level of the water, an initial alert is sounded when the water level is below level 2, a second more urgent sound is emitted when the water level is below level 1. The LED light indicates when the water level is optimal i.e. it is above both levels 1 & 2, it is indicated by the green dot.

0
Work Flow
Flow
0

What is Hydroponics?

Hydroponics is the process of growing plants in nutrient-rich water without soil. Thus, the most important element for the plant’s growth is water. It is crucial that the roots of the plant are submerged in water since it is the only source of nutrients for the plant.

The set up involves a water container that is covered with a foam sheet on which the plants are placed. Only the roots of the plants pass through the foam layer and are submerged in the water. Some of the challenges of this set up are:

  • The water level is not visible from the outside
  • The container must be opened periodically to check the water level
  • The water must not be exposed to sunlight as it can lead to growth of bacteria, fungus and algae in the water which is detrimental to the growth of the plant  

0
Example of a Hydroponics Setup
Hydroponicssetup
0

Approach

While state of the art machinery is available in the market. My device provides a solution to farmers/ growers that are in the initial stages of hydroponics.

My device provides a means to inform the user when the water level is low without having to open the system or continuously monitor the system.

When the water levels are ideal the LED light glows green. Since all is well in the system this information is relayed only when the user wants to know this information and does so by glancing at the light.

However, when the water levels are low the information to be relayed is more urgent. For this purpose, I have used sound to grab the user's attention. There are two levels of sound. When the water goes bellow level 2 (the higher level) the piezo emits a sound that grabs the user's attention but is not very urgent. The second sound is emitted when the water level goes below level 1. In this case, since the water level is too low the sound emitted is more urgent.

The water level information is available to the user in a google spreadsheet. This information can be used to detect the trends in the timings at which the water levels are low. It is also helpful in calculating the rate at which the water is being consumed by the plants.  

0

Process

The first step in my process was to understand hydroponics. I then spoke to an expert from India who was able to shed light on the challenges he faces as a hydroponics farmer. While there are various challenges in hydroponics that can be solved using an IoT device, for the scope of this project and keeping in mind the resources available to me, I narrowed it down to water level detection.

In order to set up my device, I had to select a sensor that would be able to easy to work with at the same time accurate and easily available. I selected the soil moisture sensor YL-69 since it is accurate, available at tech spark and was simple to set up.

While I have worked with the piezo and LED light in the lab sessions, I had not worked with soil moisture sensors before. I had to study it in terms of how to set it up and also the type of readings it would provide before I could use it.

While writing my code, I decided to incorporate one element (i.e. sensor, piezo & LED) at a time. So I would write the code, run it to see if it works and then proceed to add more elements. This ensured I was adding on more elements only once the previous elements were working. 

0

Implementation

Parts List 

  • 1 x Particle Argon
  • 2 x Soil Moisture Sensor YL - 69
  • 1 x Piezo Speaker
  • 1 x Green (555nm) LED
  • 2 x 10kΩ Resistor
0
//Reference: https://diotlabs.daraghbyrne.me

//LED variables declared
int ledPin = D2;
int ledBrightness = 0;

//Soil moisture sensor variables declared
int moistPin1 = A5; // Location of soil moisture sensor on the breadboard
int moistPin2 = A3; //Location of soil moisture sensor on the breadboard
int moistVal1 = 0; //Assigning default/initial value to the sensor reading for moistPin1
int moistVal2 = 0; //Assigning default/initial value to the sensor reading for moistPin2

//Piezo variables declared
int speakerPin = D3; //Location of sound sensor on the breadboard

int melody1[] = {2000,2000,2000,2000,2000,2000,2000,2000}; //tune that plays when the water level goes bellow moistPin1
int noteDurations1[] = {1,1,1,1,1,1,1,1};
int melody2[] = {1000,1500,1000,1500,1000,1500,1000,1500}; //tune that plays when the water level goes bellow moistPin2
int noteDurations2[] = {4,4,4,4,4,4,4,4};

int last_published = -1;


void setup() 
    {
        Serial.begin(9600); 
        pinMode(speakerPin, OUTPUT);
        pinMode(ledPin, OUTPUT);
        
	    Particle.variable( "level1", &moistVal1, INT ); //Detecting reading for moistPin1 in the console 
	    Particle.variable( "level2", &moistVal2, INT ); //Detecting reading for moistPin2 in the console
    }

void loop() 
    {
        moistVal1 = analogRead(moistPin1); //Reading moisture value for moistPin1
        Serial.println(moistVal1); 
        if (moistVal1 > 3000) //if sensor is not submerged in water call function playNotes1
            {
                playNotes1();
                log_to_spreadsheet();
            }
                delay(100); 
        
        moistVal2 = analogRead(moistPin2); //Reading moisture value for moistPin2
        Serial.println(moistVal2);
        if (moistVal2 > 3000 ) //if sensor is not submerged in water call function playNotes2
            {
                playNotes2();
                log_to_spreadsheet();
            }
             delay(100); 
        if (moistVal1 < 3000 && moistVal2 < 3000) //if both sensors are submerged in water flash LED light 
            {
            digitalWrite(ledPin, HIGH);
            delay(100);
            }
        else //Switch off LED 
            {
            digitalWrite(ledPin, LOW); 
            }
            
    }

void playNotes1() //tune/sound function for water level 1
    {
    
        for (int thisNote = 0; thisNote < 8; thisNote++) 
        {

        int noteDuration = 1000/noteDurations1[thisNote];
        tone(speakerPin, melody1[thisNote],noteDuration);

        int pauseBetweenNotes = noteDuration * 1.30;
        delay(pauseBetweenNotes);
    
        noTone(speakerPin);
        }
    }

void playNotes2() //tune/sound function for water level 2
    {
    
        for (int thisNote = 0; thisNote < 8; thisNote++) 
        {

        int noteDuration = 1000/noteDurations2[thisNote];
        tone(speakerPin, melody2[thisNote],noteDuration);

        int pauseBetweenNotes = noteDuration * 1.30;
        delay(pauseBetweenNotes);
    
        noTone(speakerPin);
        }
    }
    void log_to_spreadsheet() // recording log in Google Drive  
    {
        if(last_published + 60000 < millis() )
        { 
            Particle.publish("log_to_spreadsheet", String(moistVal1)); 
            Particle.publish("log_to_spreadsheet", String(moistVal2)); 
            last_published = millis();
        }
    }
Click to Expand
0
Hydroponics - Water Level Detection
Ria Jethmalani - https://www.youtube.com/watch?v=7OuAiFgX0pA&feature=youtu.be
0

Next Steps

The next steps for this project would be -

  • To improve the quality of information from the senor I would switch to a water level detection sensor. This will allow my device to be more precise. It would also allow the user to set multiple alerts at different levels. Since roots are different for different plants and also vary through the growth cycle this sensor would adapt easily across various plants and growth cycles.
  • To incorporate alerts through SMS. This would allow the user to monitor the water levels from anywhere.
  • To include other sensors such as water temperature sensor, Ph level sensor, nutrient level sensor to create an entire ecosystem.

0

Reflection

This project has allowed me to see how I can identify a problem and easily prototype a working solution. I have learned many new skills such as creating a circuit, working with particle, IFTTT and coding.

0

References

DIoT Labs: https://diotlabs.daraghbyrne.me/

Fritzing: https://fritzing.org/home/

Image: https://hellohomestead.com/how-to-get-started-with-hydroponics/

Emoji: https://emojipedia.org/

x
Share this Project

Courses

49713 Designing for the Internet of Things

· 16 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


Focused on
About

An IoT device that monitors the water level in a hydroponics farm and alerts the farmer/grower through sound and light.

Created

November 7th, 2019