Magic Farm
Agriculture has very significant impact on the economy of the country but because of shortage of water in our country we are not able to produce good yield of crops and we are in need of new farming techniques which can help us to produce good yield and fast growing .With the practice of modern
2025-06-28 16:34:04 - Adil Khan
Magic Farm
Project Area of Specialization Computer ScienceProject Summary Project Summary:
Agriculture has very significant impact on the economy of the country but because of shortage of water in our country we are not able to produce good yield of crops and we are in need of new farming techniques which can help us to produce good yield and fast growing .With the practice of modern farming techniques where plants can be grown without the need of soil by means of nutrient solution ,Hydroponics are in the rise and we need 95% less water than normal . Now towards controlling the hydroponic plant growth we need to environment control setup which work automatically so we can save the cost of labor. Internet of Things allows for Machine to Machine interaction and controlling the hydroponic system autonomously and intelligently. Our aim is to develop an intelligent IoT based hydroponic system. The system so developed is intelligent enough in providing the appropriate control action for the hydroponic environment based on the multiple input parameters.
Pakistan’s economy is strongly dependent on the agriculture .Because of the deficiency of water and uncertain weather conditions increase in demand of food, labor cost and more specifically doubt on quality of food,These increase in motivation for indoor farming such as hydroponic.
But it result in rise of another problem in urban areas where people have no land for farming so they wish to use hydroponic technique but they didn’t know much about farming and they are too busy to take care of plants so it generate a need of an automated system which take care of their indoor farm and they can keep an eye on it remotely, that’s where IOT comes in play.
In hydroponic system we don’t need soil we meet the need of required nutrients for growth through nutrients solution mixed with water and supplied directly to root so root can absorb nutrients more efficiently and even more effectively as compare to soil. Monitoring of water level, pH, temperature, flow, and light intensity can be regulated by the use of Machine learning.
Project Objectives Objectives:The goal of this project is basically to create an automated environment where anyone can do farming without need of land and without any worry for watering. It also meets your green foods need and it may be use as a source of animal fodder. This project will enable anyone to setup an indoor farm and it provide you remote access to keep an eye on your farm and enable you to monitor all information as well as growth of your plants and all other alerts:
- Enable anyone to setup their onw farm within even very congested space as you can setup on your house roof.
- Provide you cheap and fresh vegetable.
- Automatically control everything and maintained best environment for growth of your plants.
- Enable you to monitor and control your farm remotely.
- Plants will grow fast and healthy regardless of what the weather conditions are.
The Implementation Phase will include the following aspects:
1.Developing Hardware
We starting developing hardware with the help of connecting different devices like Arduino, ph sensor, light sensor and combine them with wires and do install software for cording in raspberry pi and also start coding in pythons for sensors results checking so that it will easily connected to cloud.
After this phase we built an iron pipe frame and cover it by Polycarbonate hollow sheets so it can be in working condition regardless of climate and install our devices which we connect earlier in your fram and step up all water flow lights and fans to control our condition
2.Raspberry Pi
We Use Raspberry Pi 3 Model B is single board computer. Its CPU speed ranges between 700MHZ and 1.2 GHZ. It also has on board memory between 256MB and 1GB Ram. It is the heart of the system.
It play to importan roles.First is to communicate to arduino and take input from arduino for mechain learning processing and return some action which have to take.Secondly it send data to cloud data base so our app will keep users update about their farm.
3. Arduino
We use arduino to collect all the inputs from sensor and send them to pi for further processing so pi will run machine learning algorithm on it and predict the action which have to take and pass ouput to arduino where arduinohave predefine output on inputs so after taking pie output as input arduino take appropriate action to control the conditions
4.Sensors
We use temperature, humidity, level indicator, Ph level and light sensors to take different values as a parameter so we will process this data and predict that which action need to take based on the values of parameter.
5.Developing Software
We will develop a machine learning algorithm to predict action by processing the data which is receive from sensor and as we train our algorithm so it will predict more likely action which will be take on the bases of data so the prediction is optimized and more accurate.
6.Storing Data
We will store all the data on the cloud so our client app will retrieve data from cloud and keep user update that what is going on.
7.App
We will write an application for android so user can get updates and keep monitor remotely we enable user to do some actions remotely.
There are many effective benefits of this project which is given below:
- It provides fresh vegetables and fruits in less time of growth as campare to simple farming .
- It solve the problem of land and water so in crises of water and land its help ful.
- It's provide indoors farming so weather changes would not effect on farming.
- Enable anyone to setup their on farm within even very congested space as you can setup on your house roof.
- Provide you cheap and fresh vegetable.
- Automatically control everything and maintained best environment for growth of your plants.
- Enable you to monitor and control your farm remotely.
- Plants will grow fast and healthy regardless of what the weather conditions are.
- Python 3.6: Python is an interpreted language which is open source. We have used python3.6 throughout our project for developing the neural network code and also coding the sensors interfaced to the Arduino communicating to the RaspberryPi. Python is also used for a Chat bot service in our client that returns the values from the firebase cloud to tell about the present sensor values and thus is quite useful.
- Nanpy: Open source library available for python that becomes relatively easier to control the Arduino using a Raspberry Pi. The Nanpy module for Arduino contains the libraries and code for all the sensors that are pushed together at once to the Arduino micro controller. We need to write specific Python codein the Raspberry Pi that tweaks the sensors that need to be used. The Arduino is connected to the Raspberry Pi using the USB connector son the Pi.
- Tensor flow: Open-source library written in C++ by the google brain team at Google. It is used for developing deep neural network programs utilizing the GPU of the system. It is fast and efficient and hence is widely used these days for developing artificial neural network programs.
- Pandas: Pandas is mainly used for data mining and cleaning operations. It is highly used for loading and cleaning the data in python. We have used pandas to load csv libraries into the program and hence use it for developing the neural network program.
- Google Firebase: Firebase is a SaaS, Software as a Service Cloud service provided by Google. It is free and can be used with your Google account easily. We have used firebase for uploading our sensor data along with the predicted output to the firebase cloud. With the ease of a free cloud service, the values are exported in JSON which can be read easily by the python environment for calculations. Firebase is thus a great software for all cloud applications with a No-SQL feature.
Working and Connectivity of Components:
Our project hardware consist of four main sensor like humidity temperature sensor (DHT 22) which is used for sense sudden temperature changes in environment, also we used light sensor (LM 393) which is use for light intensity checking, our third sensor is PH sensor which is used to check ph level, and our last sensor is water level indicator sensor which is used to check water level in tank and these four sensors are connected through wires with arduino devices and arduino take some data as input from these sensors and arduino is also connected via uart with Raspbarry pi and in Raspbarry pi machine learning algorithm is running with predict some action and then through output to arduino and through 2 channel relay module connect with other hardware ( fan, shower, lights, etc) and then it perform some actions like (to slow it, fast it, start it, stop it) in this way our hardware is working .
- Flow Chart digram


| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 79980 | |||
| iron Frame | Equipment | 1 | 15000 | 15000 |
| Polycarbonate hollow sheet | Equipment | 1 | 14000 | 14000 |
| Ph sensor module | Equipment | 1 | 7000 | 7000 |
| pvc 4inch pipe | Equipment | 1 | 1500 | 1500 |
| raspberry pi+ pi case | Equipment | 1 | 6500 | 6500 |
| arduino uno | Equipment | 1 | 600 | 600 |
| plant cups | Equipment | 6 | 200 | 1200 |
| grow light | Equipment | 1 | 3500 | 3500 |
| 10mm pipe | Equipment | 1 | 1500 | 1500 |
| 18v supply | Equipment | 1 | 1200 | 1200 |
| 12v dc fan | Equipment | 250 | 4 | 1000 |
| water pump | Equipment | 2 | 350 | 700 |
| High pressure pump | Equipment | 1 | 2000 | 2000 |
| 12mm pipe | Equipment | 1 | 700 | 700 |
| spray nozzles | Equipment | 5 | 150 | 750 |
| connector for nozzles | Equipment | 5 | 200 | 1000 |
| drill machine | Equipment | 1 | 2150 | 2150 |
| 3'' inch bit | Equipment | 1 | 250 | 250 |
| 1 | Equipment | 1 | 200 | 200 |
| drill screw | Equipment | 500 | 5 | 2500 |
| paint for frame | Equipment | 1 | 500 | 500 |
| tires for frame | Equipment | 4 | 250 | 1000 |
| 2 channel relay | Equipment | 6 | 300 | 1800 |
| wires ties and nuts | Equipment | 1 | 1500 | 1500 |
| light sensor module | Equipment | 1 | 200 | 200 |
| DHT22 | Equipment | 1 | 680 | 680 |
| solution pvc | Equipment | 1 | 200 | 200 |
| 3/4 pipe pvc | Equipment | 1 | 400 | 400 |
| water level sensor | Equipment | 1 | 450 | 450 |
| traveling and frame transportation | Miscellaneous | 1 | 10000 | 10000 |