Sie sind auf Seite 1von 13

RTOS

Green house intelligent control system :

Green house intelligent control system is designed to protect the plants from more cool
and hot weather and additional control system is included to save power by making fans and
lights automatically turn on and off with the help of intelligent control system. In this project,
the intelligent control system is developed using microcontroller and sensors. Green house
system has a very important use now a days in the agriculture field.Some plants need the specific
amount of water for their proper growth and more productivity, therefore farmer should provide
them the proper quantity of water. But its difficult for the farmer to get a estimation for quantity
of moisture in soil. But in this project moisture sensor is used to to provide this facility with
a intelligent control system

Main functionality of project

Block diagram below shows the main functionality of green house intelligent control
system. Four sensors are used to measure different parameters of green house system which
includes temperature sensor, light sensor, humidity sensor, moisture sensor.

LM35 Temperature sensor :

When temperature becomes greater than 25 degree, respective relay


become energize to operate the fan and when temperature becomes lower
than 20-degreerelay turn off the fan by getting control signals from
microcontroller. PIC16F877 Amicrocontroller analog to digital converter
module is used to read temperature value and to operate relay which in turn
operate the fan.

1 Walchand College of Engineering,Sangli


RTOS

Light sensor :

Light dependent resistor is used as a light sensor. LDR is kind of variable resistor which
resistance changes with the change in light intensity. So LDR resistance is converted into
intensity of light by using LDR resistance and intensity of light formula. LPC2148
microcontroller is used to measure intensity of light. When intensity of light fall under a certain
limit, microcontroller provide signal to relay to turn on light and when intensity of light raise
upto a certain limit , microcontroller provide signal to relay to turn off fan. So light sensor is
used to add automatic light switching functionality in the green house system, if you dont have
much money to afford a gardener, then you can use green house intelligent control system to
make your green house self-operating.

HS1101 Humidity sensor :

Humidity sensor is used to check level of moisture in air Because


greater or less humidity level in air can also effect growth of plants. Humidity
sensor HS1101 is used to measure level of moisture in air. HS1101 is a
capacitative type humidity sensor, So additional circuit is used to convert
change in capacitance of humidity sensor into frequency and frequency is
measured with the help of microcontroller. Measured frequency is converted
back into humidity using a algorithm in microcontroller programming.

If humidity becomes greater than a specified


limit, microcontroller gives a signal to respective relay to turn on sprinter
which is used to maintain a humidity level in the air and when humidity level
comes back to a normal limit, microcontroller gives a signal to respective
relay to turn off sprinter.

2 Walchand College of Engineering,Sangli


RTOS

Moisture sensor :

Moisture sensor is used to measure level in soil. A wire strip is used to


measure moisture of soil. Wire strip has a specific resistance at specific
moisture, but when moisture increases, the resistance of wire strip starts
decreasing and similarly when moisture decreases, resistance become
higher. LPC2148 used to measure moisture level and to turn on and off
water pump with the help of relay.

Block Diagram

3 Walchand College of Engineering,Sangli


RTOS

Simulation

4 Walchand College of Engineering,Sangli


RTOS

Source Code and Output

#include "config.h"

#include "stdlib.h"

#include <stdio.h>

#include <LPC214X.H>

#define TaskStkLengh 64 //Define the Task0 stack


length

OS_STK TaskStk0 [TaskStkLengh]; //Define the Task stack

OS_STK TaskStk1 [TaskStkLengh]; //Define the Task stack

OS_STK TaskStk2 [TaskStkLengh]; //Define the Task stack

OS_STK TaskStk3 [TaskStkLengh]; //Define the Task stack

OS_STK TaskStk4 [TaskStkLengh];

void Control_Room(void *pdata);

void Temp_sensor(void *pdata);

void Light_sensor(void *pdata);

void Moisture_sensor(void *pdata);

void Humidity_sensor(void *pdata);

OS_EVENT * Rmailbox;

OS_EVENT * ADCsem;

unsigned char err;

5 Walchand College of Engineering,Sangli


RTOS

char buffer[25];

int main (void)

PINSEL0 &= 0xFFFFF00FF; // P0.4,P0.5,P0.6 as output

IODIR0 |= 0x000000F0; // Set the port direction (P0.4-P0.7 port pins output)

adc_init();

UART0_Init();

LED_init();

TargetInit();

OSInit ();

Rmailbox= OSMboxCreate((void *)0);

ADCsem=OSSemCreate(1);

OSTaskCreate (Control_Room,(void *)0, &TaskStk0[TaskStkLengh - 1], 6);

OSTaskCreate (Temp_sensor,(void *)0, &TaskStk1[TaskStkLengh - 1], 7);

OSTaskCreate (Light_sensor,(void *)0, &TaskStk2[TaskStkLengh - 1], 8);

OSTaskCreate (Moisture_sensor,(void *)0, &TaskStk3[TaskStkLengh - 1], 9);

OSTaskCreate (Humidity_sensor,(void *)0, &TaskStk4[TaskStkLengh - 1], 10);

6 Walchand College of Engineering,Sangli


RTOS

OSStart();

return 0;

void Control_Room (void *pdata)

unsigned char *Svalue, fno;

pdata = pdata;

while(1)

Svalue=OSMboxPend(Rmailbox,50,&err);

if(err==10)

{}

else

fno=*Svalue;

switch(fno)

case 1:

IOSET0=0x00000010; //LED_on(0);

OSTimeDly(10);

IOCLR0=0x00000010;

7 Walchand College of Engineering,Sangli


RTOS

break;

case 2:

IOSET0=0x00000020;//LED_on(1);

OSTimeDly(8);

IOCLR0=0x00000020;

break;

case 3:

IOSET0=0x00000040; //LED_on(2);

OSTimeDly(4);

IOCLR0=0x00000040;

break;

case 4:

IOSET0=0x00000080; //LED_on(3);

OSTimeDly(2);

IOCLR0=0x00000080;

break;

void Temp_sensor (void *pdata)

8 Walchand College of Engineering,Sangli


RTOS

int value,c,d;

c=1;

d=0;

pdata = pdata;

while(1)

OSSemPend(ADCsem,0,&err);

value=adc_get_val(1);

OSSemPost(ADCsem);

if(value*3/1023 < 2)

OSMboxPost(Rmailbox, &c);

else if(value*3/1023 > 2.5)

OSMboxPost(Rmailbox, &d);

OSTimeDly(20);

void Light_sensor (void *pdata)

int value,c,d;

c=2;

d=0;

pdata = pdata;

9 Walchand College of Engineering,Sangli


RTOS

while(1)

OSSemPend(ADCsem,0,&err);

value=adc_get_val(2);

OSSemPost(ADCsem);

if(value*3/1023 <2)

OSMboxPost(Rmailbox, &c);

else if(value*3/1023 >2.8)

OSMboxPost(Rmailbox, &d);

OSTimeDly(15);

void Moisture_sensor (void *pdata)

int value,c,d;

c=3;

d=0;

pdata = pdata;

while(1)

OSSemPend(ADCsem,0,&err);

value=adc_get_val(3);

10 Walchand College of Engineering,Sangli


RTOS

OSSemPost(ADCsem);

if(value*3/1023 <2)

OSMboxPost(Rmailbox, &c);

else if(value*3/1023 > 2.5)

OSMboxPost(Rmailbox, &d);

OSTimeDly(11);

void Humidity_sensor (void *pdata)

int value,c,d;

c=4;

d=0;

pdata = pdata;

while(1)

OSSemPend(ADCsem,0,&err);

value=adc_get_val(4);

OSSemPost(ADCsem);

if(value*3/1023 <2)

11 Walchand College of Engineering,Sangli


RTOS

OSMboxPost(Rmailbox, &c);

else if(value*3/1023 > 2.5)

OSMboxPost(Rmailbox, &d);

OSTimeDly(4);

12 Walchand College of Engineering,Sangli


RTOS

Applications and future advancements :

So this project can be easily used in any green house system to make to self-operated and
automatic control of devices. You can also add extra functionality in this project by adding
wireless communication to send values of sensors and status of devices to someone which is not
at remote location.

13 Walchand College of Engineering,Sangli

Das könnte Ihnen auch gefallen