International Journal of Sensor Networks and Data Communications

Agriculture is the backbone of a country particularly in South Asia because of excessive agrarian land resides there. It is beneficial for human growth and the State’s emerging Gross Domestic Product (GDP). South Asia particularly Pakistan is facing severs challenges of poverty, hunger and malnutrition along with growing population. Under these conditions, horticulture governed with emerging scientific research and developments can play a vital role in order to cope up with such challenges. Tunnel farming is such kind of one development being practiced across the globe to obtain off-season crops with three folds of more production as compared to the traditional way of vegetation. In this regard the concept of Internet of Things (IoT) is a promising approach which finds its expertise in every field of life including agriculture sector. Its application in tunnel farming has been generating ambitious results in the past few years therefore, a sound architecture and model based on latest, robust and reliable technologies can change the fate of agricultural sector in Pakistan. This paper proposed a framework with hardware design which comprises of accurate sensors for data transmission to Cortex based MPU, cloud based data unit and further appropriate actuators to regulate the desired microclimatic conditions inside the tunnel to improve the productivity followed by more revenue. Proposed hardware model provides a cheap, optimal and automatic tunnel farming solution to the middle class farmer, growing off-season crops at the far ends of the country with scarcity of electricity and water resources. Furthermore it presents a reliable user friendly database and a very simple GUI that makes it easy for the farmer to monitor the climatic changes, optimal resource utilization, the production at the far site end and its healthy transportation to the nearest consumer market along with periodic reporting of location and vital microclimatic conditions inside the vehicle. To our knowledge, this is the first proposed hardware model which uses Cortex based microcontroller for Smart Tunnel Farming. By the proposed hardware model, the cost of electricity and water can be reduced by 30 to 40% and an average of 20% increment in the production and supply of targeted crops by automatic adjustment of optimal climatic conditions inside the tunnel and monitoring of crops transportation system.


Introduction
Agriculture plays a vital role in stability of a country's economy and the growth of its natives. In a country like Pakistan where 50% of the land is deployed for the agricultural purposes, it proves to be a prime requisite of the economy. It has massive contribution of 21% in the GDP of the state [1]. But food insecurity is going to be a new challenge for the third world countries, as per Unite Nations studies 900 million people are being categorized as hungry and malnourished. Growing human race is a big challenge for the world because of its exponentially increasing demands including food therefore, it is compulsory for the human to dig out such ways which can give folds to the production. Global population is going to increase up to 9.1 billion by 2050 with the consequent rise in per capita food consumption [2]. Emerging paradigms of research and development has changed every field of life including agriculture sector, its significant example is tunnel farming technique which is being used across the globe. Tunnel Farming has untagged the vegetables from being seasonal but being a natural process it requires the fulfillment of pre-condition necessary for the plants' growth and it can yield 23,300 kg vegetables per annum per acre. Furthermore the production capacity of three vegetables is mentioned in Table 1 which is indeed a promising approach. The practice has also been adopted in Pakistan in the last few years on manual basis possessing a margin of human error or illiteracy in it [3]. These conditions also vary crop to crop therefore; it becomes difficult for the farmer to periodically monitor the status of whole farm with perfect accuracy. Consequently it is need of the hour to automate this whole process in order to maintain the proper growth of the plant followed by the better production in the end. IoT finds its expertise in every field of human life especially in agriculture and particularly in tunnel farming. By creating a system of interrelated sensors and computing devices, it allows the transfer of data without any human interaction. It is done by collecting data such as temperature, rainfall, humidity, soil content etc. and is capable of taking informed decision to minimize waster and efforts for better quality. IoT bears the potential to cover all the aspects of smart tunnel farming ranging from monitoring, productivity, integrity, security and mobility of information along with transportation of finished product [4].
IoT basically facilitates in the maintenance of microclimate which is key ingredient for plant growth and it is highly dependent upon the temperature and other condition inside the greenhouse. The quality of air, the temperature inside, humidity and flow of carbon dioxide are parts of microclimate and its efficiency in greenhouse. These features of microclimate are extracted using wireless sensors which are basically collection of devices possessing sensing abilities that are connected using a form of signal i.e. radio network. It includes a simple agricultural information system, in which a relay of sensor nodes spread out in order to direct the information to Network Capable Application Processor *Corresponding author: Abeer Bashir, Sharif College of Engineering and Technology, Lahore, Punjab, Pakistan, E-mail: abeerumar2010@gmail.com

Abstract
Agriculture is the backbone of a country particularly in South Asia because of excessive agrarian land resides there. It is beneficial for human growth and the State's emerging Gross Domestic Product (GDP). South Asia particularly Pakistan is facing severs challenges of poverty, hunger and malnutrition along with growing population. Under these conditions, horticulture governed with emerging scientific research and developments can play a vital role in order to cope up with such challenges. Tunnel farming is such kind of one development being practiced across the globe to obtain off-season crops with three folds of more production as compared to the traditional way of vegetation. In this regard the concept of Internet of Things (IoT) is a promising approach which finds its expertise in every field of life including agriculture sector. Its application in tunnel farming has been generating ambitious results in the past few years therefore, a sound architecture and model based on latest, robust and reliable technologies can change the fate of agricultural sector in Pakistan. This paper proposed a framework with hardware design which comprises of accurate sensors for data transmission to Cortex based MPU, cloud based data unit and further appropriate actuators to regulate the desired microclimatic conditions inside the tunnel to improve the productivity followed by more revenue. Proposed hardware model provides a cheap, optimal and automatic tunnel farming solution to the middle class farmer, growing off-season crops at the far ends of the country with scarcity of electricity and water resources. Furthermore it presents a reliable user friendly database and a very simple GUI that makes it easy for the farmer to monitor the climatic changes, optimal resource utilization, the production at the far site end and its healthy transportation to the nearest consumer market along with periodic reporting of location and vital microclimatic conditions inside the vehicle. To our knowledge, this is the first proposed hardware model which uses Cortex based microcontroller for Smart Tunnel Farming. By the proposed hardware model, the cost of electricity and water can be reduced by 30 to 40% and an average of 20% increment in the production and supply of targeted crops by automatic adjustment of optimal climatic conditions inside the tunnel and monitoring of crops transportation system. complex system such as adaptive control methods based on fuzzy logic are the key factors of this framework. Moreover new urban agriculture system such as vertical farming, rooftop greenhouse and plant factories is elaborated. Different active & passive cooling systems containing Fans, evaporative cooling, ventilation fan & swap coolers having potential to create a low cost and cool atmosphere inside are discussed.
In [5], the author focused on recent developments in applications of Internet of things in smart farming along with a brief introduction of communication protocol of wireless sensors networks in order to improve agro-ecological resource management. A centralized system possessing Network Capable Application Processor (NCAP) facilitating sensor and network interface is discussed. Layard structure of smart agricultural monitoring system was elaborated ranging from Application to Mac layer. Data Transportation, relay, storage, visualizations and processing is discussed with reference of different platforms for each step.
In [8], a Cyber physical Systems based precision agricultural management integrated system was presented in order to maximize the productivity of potato fields. The proposed framework was the mixture of three significant branches including cyber physical system, IoT and WSN in which the focus of periphery was the multispectral view of Potato field. Multiple approaches including Multispectral Terrestrial Mechatronic System, Multispectral Autonomous Aerial Mobile Mechatronic system and Acquisition, Processing, Storage and Transmission system for spectral information are proposed in order to harness the reliable and cost efficient system of potato production.
In [9], a thermal imaging based model was proposed for the monitoring of soil moister level in order to lower the crop water stress. Keeping in view the significance of water and electricity the proposed approach was particularly fabricated for water conservation under cloud of network approach. Thermal Image were collected from the physical environment and relayed to the local processing unit in rout to Gateway internet and COT data center. Acquired image was preprocessed on different stages to figure out the region having adequate and inadequate possession of water.
An Automated Agricultural Field Analysis and Monitoring System (AAFAMS) using IOT was proposed in [10], the framework was capable of soil monitoring, pest content checking and suggesting crop suited for the soil. AAFAMS is based on a line follower robot which monitors the field status through sensor approach along with image processing tools in order to pin point the presence of pesticides. Hardware design of it consisted of Raspberry Pi, Solar panel for power efficiency, moister sensor and camera. Proposed idea was a sigh of relief for the farmers because it replaced the efforts of them with Robotic agent.
IoT architecture based precision agriculture system with distributed processes model is presented in [11] which is working on edge and fog computing paradigms. Installation process was done on the basis of decision tree which helped the farmer to replicate his design. These two approaches of Fog computing and edge computing process data with low processing power and communicates with database directly through programmable automation controller (PAC). Whole system was subdivided into small portions and each subsystem connected to the center through PACs and sensors. This five layered structure inculcated the farmer directly in smart farm planning using cloud warehouse along with physical, network and processing layers.

Proposed Methodology
The working principle of the proposed system is dealing with (NCAP). NCAP is defined as a device that provides communication between the sensor and the network. It is normally a microprocessor based of Ethernet control network. Using client server architecture, the network is connected to IPv6 of network layer. It is the most recent version of the Internet Protocol (IP), the communications protocol that routes traffic across the Internet. It provides identification and location system for computers on networks and the total number of IPv6 addresses are more than IPv4 addresses [5]. Furthermore cloud computing and Internet of things performs a generic role in agriculture modernization because both are very closely related. Productivity of rice, pork, fruit and fresh water is very important for development and cloud computing is a very safe network for the user as it provides the better sources of agriculture. Cloud computing links with Internet in order to formulate a database of information acquired from the surrounding and followed by the best way of adding and exchanging IT services in agriculture. It includes production estimation, tracing and control of farm and agro ecological environment control [6,7]. Implementation of such task under the umbrella of IoT is basically to design an adaptive system and control networks that collects prerequisite of plants' growth including all the atmospheric parameters and soil status. Where there would be a cost of increased automation but this would result in more profits and better overall yield. It is estimated that tunnel farming enhances the production by 3-5 times as compared to the open fields but the automation of this whole process will give exact five folds to the productivity. Along with these benefits it also saves water, fertilizers, space and time which conserves the capital investment of the project along with saving of natural resources as United Nations has predicted that more than 4 billion people will be under water scarcity by 2050 on global arena. This paper proposes a hardware model which is going to address the whole process of Smart agriculture farming starting from its pre-processing, growth control, production, security and healthy transportation of the product to the consumer. Later on section II elucidates the literature review of IoT based smart tunnel farms and their efficiencies. Section III is based on our proposed work elaborating the complete methodology argued based on sensor network, centralized data base and decision unit. Section IV contains results of the implemented work including statistical analysis of microclimate features and their efficient regulation. Finally the last Section V is of conclusion validating the proposed framework in terms of its proficiency, reliability, security and production.

Literature Review
IoT based smart tunnel farming is not a new approach in the research arena and it is talk of the town in the past few years with multiple architectures and frame works. This section elucidates the previous methodologies adopted by renounced researches in order to uplift the horticulture across the globe.
In [4], author discussed new methods in modern farming for sharing data of greenhouse and through Wireless Sensor Network (WSN) called MPWINodeZ (Multi-Powered Wireless Node ZigBee) to produce more accurate results. Timer based feedback model and more Cucumber  3  28,000  84,000   Capsicum  3  18,000  54,000   Tomatoes  3 24,000 72,000 factors of monitoring, productivity, integrity, security and mobility of fresh vegetables. By working on these fundamental factors, the proposed research is capable of creating such a smart farming system where the user would be able to monitor the micro-climate of the respective system, deploy actuator to the regulate micro-climate as per threshold, use a system that would hold complete integrity, security and oversee the mobility of the acquired fruit. A proper hardware model is implemented on a test site to validate the foresaid aspects of the proposed framework along with their real-time results.

Monitoring
Through various sensors, the temperature, humidity, light intensity and the moisture of the soil inside the system could be monitored by the user. The respective sensors update their values, which could be seen on the LCD module of the system along with its availability on the cloud server. The data retrieved from the sensor are sent to the Cortex-M Tiva Launchpad that acts like a server, making important decisions as per the user requirements. Real-time updates of humidity & temperature sensors values are provided on IoT based application and decision based upon several microclimate factors prompted by the microcontroller can be monitored in real time by the user. The aim of the proposed system is to enable the user in order to create an environment suitable for the respective crop and to analyze the outcome from the proposed monitoring system. ThingSpeak is the IoT based platform used in our proposed work which is an open source IoT application that allows data transfer and storage from the sensor using HTTP protocol over the internet [12,13]. The data stored on the application can be used for sensor logging, location tracking and as a social network with the frequent data status updates. ThingSpeak is also integrated with MATLAB for data analyzing through MathWorks followed by further improved analysis and visualization of the data sent to the cloud server as shown in Figure 1. The proposed system enables a web-implemented structure that collects, sends and acts on the data acquired by the sensors from the surrounding of the farms and the transporting vehicle.

Productivity
The information gathered through sensors is sent to the Cortex M4 based microcontroller unit (MCU) that controls the different actuators deployed on the field as shown in Figure 1. The user will be able to analyze the output of the farming results and create such as environment inside the tunnel that would facilitate the plants growth inside. Each sensor has its corresponding actuators inside the tunnel system that produces an action to recreate the conditions inside the tunnel as per the requirements shown in Table 2 for some crops. Thing Speak data logging application allows a detailed analysis of the data gathered from the sensor so that the user could make a smart decision that would result in a better yield. Whenever the sensor updates the values beyond the threshold set by the user, the microcontroller will power up the actuator that will work directly to maintain the sensor value within the required range for improved productivity. The increased temperature will cause the microcontroller to power up the fan stationed inside the farming system that will run until the climate inside the system cools down. Similarly, the relative humidity measured will directly report to the MCU, and automatic door fixed at the front and back of the tunnel will open with MCU signals until the relative humidity reaches below   the threshold value. The light intensity sensor measures the severity of the sunlight directed at the covered tunnel system. As soon as the light goes below the required value, the MCU will power an artificial light source fixed inside the system to make sure that the conditions inside the system are always within the required demand for the proper nourishment of the plants. Lastly, the soil of the system has to be always in the required respective condition. Too wet or too dry can directly affect the productivity of the farm. The soil moisture sensors would send a signal to the MCU as soon as the moisture of the soil is below the required point. The MCU will actuate water pump that would run until the required moisture level is reached as depicted in Figure 1. The combination of these actuators with analysis based cloud computing enables the proposed system to create a surrounding inside the tunnel that facilitates the growth of the plants and improves the overall farming productivity as compared to the traditional agriculture.

Integrity
An essential part of the proposed model is the integrity of entire network system. IOT system relies on communication between various devices therefore, it is important to ensure the integrity of it in all aspects. The devices used in the model are chosen for their high reliability and accuracy based on agriculture parameters. The choice behind choosing Tiva launch pad microcontroller was for its durable built interface that is of vital importance as the controller is acting as a server for the entire system. The microcontroller unit has high reliability in terms of its output and has extreme low chances of breaking down in any scenario. DHT11 measures temperature at range from 0 to 50 degrees Celsius with +/-2 degrees accuracy and relative humidity at a range from 20 to 80% with 5% accuracy. These measurements are ideal for a system to work within agricultural parameters in South Asian countries. Similarly, the light sensor and the soil moisture sensors also provide results that are accurate with very low chances of burning down.
The system is powered with Solar panel and lithium ion battery, which is an ideal source form semi errand location such as Pakistan. Another notable advantage of the IOT application Thing Speak is it ensures the integrity of the system. The proposed system updates the values retrieved by the sensors on the LCD screen placed outside the tunnel structure and on the cloud server too. The system will run indefinitely and continuously, until the cloud server notifies any such errors from the system which conducts a breach in the integrity of the system.

Security
The system built on the IoT platform only allows access to the individual who created the platform's channel. Privacy policy of Thing Speak does not allow any violation of the security. The account holder will have the power to allow others to access the data but it is only possible with account holder's permission. The platform also allows limited control to the users apart from the original owner and the additional users can only view the data analysis with no control over its framework. Moreover the periodic reporting is also limited to the authentic user only at the time adjusted.

Mobility
Mobility of crops: Since transportation of the fresh vegetables in the respective markets is the prime concern for the farmer especially of those belonging to remote villages of Pakistan therefore, the proposed system focuses on this aspect with proper care. Smart vehicles are very popular in IOT architecture possessing wireless sensors, which can relay data to the central system being controlled by the user sitting in the smart vehicle and at the controlling end. Another plug-in offered by ThingSpeak is to authorize the location of the channel source on the cloud server. The user can view the source of the channel that would facilitate the frequent monitoring of the system making him enable be a watchdog on the transportation making the whole system secure for mobility. It not only allows the frequent monitoring of the conditions inside the tunnel system from the IOT cloud server but also oversees the location of the source at all times and tracks its movement. The prime principle of it is based on Wi-Fi positioning system (WPS) from Google's geo location API that returns a location based on clients data from nearby Wi-Fi nodes and cell phone towers.
Using Wi-Fi module EPS8266-01, the system scans all the Wi-Fi access nodes visible and uploads it to Google's geo location API. The module works with GSM capability sends an API geo location request through HTTP communication using POST [14][15][16][17][18][19][20][21][22][23][24][25]. A successful geo location request will return a JSON-formatted response defining the user's estimated latitude and longitude, in degrees. The received data is then transmitted to ThingSpeaks, in the similar format. Figures 2 and 3 shows the samples of the generated longitude and latitude coordinates from the Wi-Fi module. An HTML file based on Google Maps API key recognition receives the last transmitted data from the Thingspeaks fields for longitude and latitude and displays the exact location on the map based on the coordinates. Figure shows the generated location received through the HTML file based on JavaScript. Figure 4 displays the last transmitting location on Thingspeak displayed on Google Maps   Mobility of data: Another vital advantage that an IOT system provides is data abundance that it monitors and collects. Such data can prove to be of great importance, when user is analyzing the present outputs and looking for improvements based on past results. The ThingSpeak server has a built in interface with MATLAB which provides an opportunity to transport the data on various MATLAB tools, in order to analyze and create even more complex actions for the system to perform in addition to its deployment for future research.

Tiva Launchpad (CORTEX M4)
The TM4C123 Tiva Launchpad is a low-cost single-board kit that is used as an evaluation board for ARM Cortex-M4F based microcontrollers. Manufactured by Texas Instruments, it features 32bit CPU that operates on 16 to 80 MHz frequency and includes USB 2.0 device interface. The microcontroller is integrated with 40 I/O pins that can be configured for multi-purpose usage. The pins can be used as digital input/output, analog input/output, UART, I2C, SPI and many various applications. The board is built to interface with different test cards and other communication protocol for different uses. Proposed framework is Cortex based with different sensors mentioned below interfaced with it.

DHT-11
DHT-11 is a basic temperature and humidity sensor that sends digital signals on its data pin. The sensor uses a thermostat and a capacitive humidity sensor to measures values of the surrounding. It measures temperature within the range of 0-50°C with ± 2°C accuracy and 20-80% relative humidity with 5% accuracy. The sensor is based an efficient 8-bit microcontroller and offers continuous fast response data with great accuracy. The sensor uses serial interface single-bus data format as a communication protocol, sending out higher data bits first. It sends out the temperature data on the first 16 bits and the humidity data on the next 16 bits. The data ends with an 8-bit checksum that would make sure that the data sent out does not contain any errors.

Ambient light sensor module
The light sensor module is a photosensitive sensor that produces a digital output. It is used to detect ambient light and can be connected directly to the microcontroller. The module produces LOW output logic when the light intensity is higher than the set value and produces HIGH when the intensity is high.

Soil moister sensor SN-13322
SN 13322 is a basic soil moisture sensor that is used to measure the amount of water in the soil. The module includes two pads that work as probes for the sensor and works as a variable resistor. As the moisture in the soil increases, the conductivity between the pads also increases those results in low resistance and a higher output.

ESP8366-01 WiFi module
The module offers Wi-Fi networking options either as a standalone SOC or as a combination with a microcontroller. It is integrated with the TCP/IP protocol that offers the capability of being a host for an application or a Wi-Fi shield. The module is preprogrammed with AT commands and could be used as a Wi-Fi network with no further processing [14].

DC fans, motors, water pump and artificial light
The farming system includes a 12-volt DC fans which are placed inside the tunnel structure. The fan is connected directly to the microcontroller that only powers it when the required temperature inside the tunnel is above the required value. A 6-volt DC motor used to control the opening of the tunnel. This is done to improve ventilation in order to lower the humidity level inside the tunnel system. A 12volt water pump is a mini submersible motor that could be used as a water control system. The pump is used to control the amount of water in the soil inside the system. It works on 9,000 RPM / 150Hz Rated Voltage with CW and CCW type rotation. The LED lighting inside the system acts as an artificial light source. LEDs are a low cost and energy  efficient light source that provides favorable temperature, ventilation, photosynthesis and light intensity conditions for the growth of plants. Each LED produces a distinct wavelength, and therefore the wavelength required could be achieved by using individual LED or group of LED to produce the effect.

Solar panel
The system includes a 12-V solar panel that is used to generate lowcost electricity to power the microcontroller and the various actuators. The panels include Polycrystalline solar cells that generate electricity in a low cost and efficient process. It is designed to provide to charge a 12-voltage battery or power a 12 volts DC load. The voltage provided by the solar panel is regulated to the required value. The microcontroller requires around 3.3 volts to operate and therefore the relevant regulator was used to maintain the required constant voltage. COM-0056 was used as a 3.3 voltage regulator to power the MCU while 6 volts voltage regulator was used to power other devices.

ThingSpeak
The analytical options provided by the integration of ThingSpeak and MATLAB allow specific notification for targeted data on the channel activity. External web service such as IFTT enables to create utility applets that respond to specific triggers set by the user. The IFTT Webhook service allows web requests to trigger actions from an incoming HTTP request to the server. These requests can be used to create notification into email and text messages [15,16]. The MATLAB analysis of the ThingSpeak data can be used to create specific web request triggers. The data could be analyzed in terms of the filtered numeric data and even precise strings results that could be used to trigger an HTTP request to IFTTT [17]. The proposed model includes a real time MATLAB analysis of the channel activity and whenever the data in terms of temperature or humidity reach beyond the set threshold value, the MATLAB analysis App triggers an HTTP request to the IFTTT server. This results an outgoing action in terms of an email message or a text message, notifying the user of the updated results. Other options such as ThingSpeak Time Control app generates results notification at certain time of the day or even at specific intervals. IFTTT also provides notification in terms of weather updates; rain forecast, temperature changes, storm predication and other weather forecast notification on email and text messages [18]. The proposed model uses the foresaid service to create a network of devices in order to receive instant hyper local weather data and microclimate updates for notifications through emails and text messages for the user and its samples are provided in Figures 5 and 6 below.

Hardware description
The proposed smart tunnel farming system consists of various sensors, actuators, modules as well as a microprocessor. Each element plays an important role in the foundation of a system that aims to improve the technical analysis of the conditions inside the tunnel and helps to create the required atmosphere through the analysis provided within the system. The complete web-enabled (ThingSpeak) IoT system integrates the different components to provide real-time data logging through interfacing, data processing and inter-connectivity within the various components. The following are the details of the components included in the proposed smart farming system. Algorithm of the formulated model is mentioned in Figure 7 and the hardware model is shown in Figures 8 and 9.

Evaluation of the Proposed Model
In the following section, we have analyzed the power, cost and crop production under the umbrella of our designed system along with its comparison to the traditional methods. Resultantly we noticed that our model maximized the crop production with the minimum use of power and capital in comparison to traditional agricultural and tunnel farming techniques.

Power analysis
The power analysis part has been evaluated in two different aspects including the energy consumption of the sensor deployed in the network and the efficient use of solar panel as a power source to the network.
Power dissipation of the sensor network: Each of deployed sensors requires 3.3 volts to operate, so we considered load current as our power analysis parameter. Apart from the Tiva Launch pad microcontroller that requires a constant voltage supply of 3.3 Volts and 300 mA current, rest of the model components have different power requirements at different operations. Current consumption depends on sensor's mode of operation like transmission mode, receive mode and sleep mode. Every sensor is active, only the DHT-11-tempreture & humidity sensor transmits data periodically after every 100 seconds interval while rest of the model follows the set threshold. Furthermore ESP8266 WIFI module is set in deep sleep draws 10 uA after 15 minutes to transmit the required data from the DHT-11 to the Internet platform. The Table 2 mentions the detailed current consumption from the sensor  network. Total current being drawn from the model is 350mA which is easily manageable by Lithium-Ion battery of 1900mAh.

Solar panel as a power source:
The semi-arid climate of the Pakistan provides ideal conditions for inclination towards solar energy. Average solar radiation intensities across the Punjab are 5Kwm2/day which is adequate enough to meet the electricity requirements of agricultural sector [19]. The use of solar panels is a highly efficient way to power the smart farming system. Periodic activation of the sensor network in our model justifies its power efficiency and operability through Solar Energy. Moreover we are using a lithium ion battery due to its consistent power flow, long life and lower power losses. As per our tunnel requirements we used a 19000-mAh lithium ion battery that is ideal for the model. In order to approximate the life of the battery without solar power we apply a simple method. The total charge of the battery that is 19000-mAh is divided by our system nominal load, which has been calculated in Table 3.
So even without the solar power, the battery would be able to last around 2.5 days when the system is working at its maximum capacity.

Cost analysis
Overall the designed Smart Farming model consists of 5 core components and some actuators. The components include the microcontroller, 3 sensors and a Wi-Fi module adding the total costs to through interfacing, data processing and interconnectivity within the various components. The following are the details of the components included in the proposed smart farming system. Algorithm of the formulated model is mentioned in figure 5 and the hardware model is shown in figure 6 and 7.    32 USD and around 3500 PKR. Our calculation validates the aim of our model which provides efficient and smart data monitoring system with a cheap approach. Table 4 includes the cost of each device used in our smart model. The actuators inclusion in the system will be dependent upon the farm size and its tunnel parameters, the components used as actuators in a basic farm facility will not exceed 250 USD accumulatively.
Further the model cuts the cost of full time farm manager and other labors that incurs the excess expense to the land lord. According to detail feasibility report by Pakistan agriculture research council, Islamabad presented in [20] labors required to manage a basic tunnel farm casts 528000 PKR. In addition to it, Tunnel farming research report by NBP in [21] shows that apart from the basic employees to manage the farming system, a technical farm manager would be require annually salary of Rs. 120,000, who will be responsible to control the basic parameters of the tunnel as per the requirements of the tunnel in different seasons. In addition to it the adequate manpower is still there to administrative the farm incurring an overhead costs of 1% of the total revenue annually [21]. Apart from these expenses crops wastage that is around 15% in Punjab also contributes in term of cost along with other factors such as fixed electricity, fixed water, water wastages, unnecessary transportation expenses and other miscellaneous. All expenses mentioned above would rise with annual growth rates [21].
By deploying a smart automated system with remote administrative regulation, the expense due to production, wastages and other inefficient strategies will significantly decrease. The system monitoring will enable careful inspection of crops and precise use of farm resources without any human intervention. Our proposed model will require two farm managers for monitoring in place of 8 workers that will explicit significant difference in cost. Further through the automation process it is possible to lower the electricity cost by 15-30% as the actuators would only have to work at the precise threshold value of the different crops [22,23]. The optimal use resources and real-time monitoring will decrease the crop and resource wastages in order to enhance the revenue. Moreover, the proposed model is deployable in any traditional tunnel farming system with no other additional expense. Table 3 compares the annual per acre operational cost of the proposed model in comparison with traditional tunnel farming [20].
The data from our proposed model not only showed improvement in terms of production costs in off-season but operational expenses also lowered by around 50%. Lesser manpower and more precise use of farm resources showed cutting down of the wastages and the expenses significantly. While, the overhead cost can be more than the traditional farming system make our smart tunnel farm run time cost efficient and rich in production.

Crop production analysis
The proposed model insures the provision of cost efficient tunnel forming solution followed by the maximized productivity and revenue. Sensors based actuation inside the tunnel will lower the power and resource dissipation heading towards cost improvement and more yield. Analysis of the proposed model crop production showed significant improvement in crop yield in comparison to the traditional tunnel farming practices.
Graph1 present the expected annual production of the proposed model based on the initial assessment with the production from tunnel farming and traditional farming in Pakistan [21,24]. The production assessment from the proposed system showed 22% increase for cucumber, 25% for tomato and 28% increase for capsicum when compared to data of production from traditional tunnel farming. This proposed comparison is made on the data provided by Punjab Government Agriculture department for traditional tunnel farming but our model showed significant improvement in it due to the subtraction of damaged crops, extravagant resource utilization and precise adjustment of tunnel parameters along with extension of the season for the vegetable (Figure 10).

Results
This section deals with the results acquired from the proposed framework. In our proposed model the focus of periphery was the foresaid five parameters including Monitoring, Productivity, Integrity, Security and Mobility resulting low cost and more revenue from tunnel farming. In this context Cloud based centralized system extracted information for its suburbs containing above discussed blocks through sensor nodes and relayed it to the ThingSpeak platform through which the user became able to create a watchdog environment for its farms. Although the whole model was self-regulating without any interference     of user yet the visual and reporting platform was created in order to meet the satisfaction level of the owner. The complete model was implemented in real-time environment and the results were monitored and regulated for all the discussed aspects. Monitoring and productivity was the totally dependent of the sensor values and the regulated values of it is shown in Figures 11 and 12. While the integrity and security was achieved through the reliable environment of ThingSpeak which demands specific key for the data acquisition and processing apart from the fact that every individual can see it. Finally the step of mobility was catered through location identification of the transported fruit in compliance with the surrounding of the vehicle carrying it. This task was accomplished through IoT based ThingSpeak environment which also locates the position of the communication channel through ESP 8366-01 Wifi Module as provided in Figure 7. Further the ThingSpeak platform was drawn under practice to report periodically to the user through e-mail and test massage which is indeed a new addition in traditional networks. Accumulatively the whole system proved to be a cheap, energy efficient, resource proficient and promising in the context of revenue generation. Cost analysis of the model has revealed that it saves 50% cost of the farmer using manual tunnel farming in the past. Further the resource utilization is optimal cutting the electricity and water cost by 30 to 40%. Above all is the production analysis that justifies the viability of our proposed model. Table 5 show that there is on average 20% increment in the production and supply of targeted crops by automatic adjustment of optimal climatic conditions inside the tunnel and monitoring of crops transportation system ( Figure 13).

Conclusion
Proposed model proved much more effective in its working and its validity was tested in a tunnel of 3 acres in Lahore Pakistan. Results of the framework were up to the mark and IoT based platform remained user friendly in the context of farmers. Consequently the proposed frame work proved its significance in the domain of productivity and proper transportation of the vegetables followed by the increment in revenue of the farmer. Every aspect of the framework was tested individually through sensor node values, location parameters, integrity and reliability of the system by cross validating the acquired parameters. It was also observed that such framework can pay a lot in the remote regions of Pakistan where people are handicap in the matter of energy and water resources. Such low cost, resource saving and energy efficient model can curb the issues of those regions with maximum productivity. The only constraint there could be of internet which is very vital to shift the data on IoT based GUI and this problem is marginable too, because telecommunication companies have spread their infrastructure across the globe and users can be facilitated by mobile phone to access ThingSpeak like platform. Furthermore Kitchen Gardening is also an area of interest particularly in the backward regions where the people finds it hard to manage their food. It is getting prevalent in the Thar and dessert of Bahawalpur where the people faces scarcity of water and other resources. IoT based infrastructure can facilitate them too because it is low powered architecture and easily manageable through solar panel. In this way the proposed design is also applicable there with