circuit himidity sensor
Hi Dr Patel,
Sorry, my mistake, since no subs were used, the returns must be goto
mainloop.
So here is the correct version.
This is very much like the hysteresis topic discussed a few days ago.
The main program loop could be something as
drylimit con 5000 'example values
wetlimit con 25000
pin_relay con 2 'relay controlled by P2
hum var word
Mainloop:
gosub readhumidity 'get reading from humiditysensor into variable hum
if hum < drylimit then relay_on 'turn realy on to start watering plants
if hum > wetlimit then relay_off 'turn relay off to stop watering plants
goto mainloop 'keep checking hymidity while relay is on or off
readhumidity:
hum = input from sensor 'code depends on sensor
return
relay_on
out pin_relay,1
goto mainloop
relay_off:
out pin_relay,0
goto mainloop
end
This is just a global layout. You could also use a single limit value (too
dry) and
then start watering for a fixed amount of time. In that case a simpler
sensor may be
used (if available).
For sensors take a look at http://www.smartec.nl/index.htm?/smart3.htm
It describes a Univeral Transducer Interface (called UTI) with RS232 in/out
and connects
to all kinds of sensors, including temperature and humidity.
Or download their application note directly
http://www.smartec.nl/pdf/apputi01.pdf
Hope this helps.
Success.
Greetings peter
Sorry, my mistake, since no subs were used, the returns must be goto
mainloop.
So here is the correct version.
This is very much like the hysteresis topic discussed a few days ago.
The main program loop could be something as
drylimit con 5000 'example values
wetlimit con 25000
pin_relay con 2 'relay controlled by P2
hum var word
Mainloop:
gosub readhumidity 'get reading from humiditysensor into variable hum
if hum < drylimit then relay_on 'turn realy on to start watering plants
if hum > wetlimit then relay_off 'turn relay off to stop watering plants
goto mainloop 'keep checking hymidity while relay is on or off
readhumidity:
hum = input from sensor 'code depends on sensor
return
relay_on
out pin_relay,1
goto mainloop
relay_off:
out pin_relay,0
goto mainloop
end
This is just a global layout. You could also use a single limit value (too
dry) and
then start watering for a fixed amount of time. In that case a simpler
sensor may be
used (if available).
For sensors take a look at http://www.smartec.nl/index.htm?/smart3.htm
It describes a Univeral Transducer Interface (called UTI) with RS232 in/out
and connects
to all kinds of sensors, including temperature and humidity.
Or download their application note directly
http://www.smartec.nl/pdf/apputi01.pdf
Hope this helps.
Success.
Greetings peter