Project: GAC (Greenhouse Automation Controller) Design Process and Discussion
I have been assigned to build a new project; the Greenhouse Automation Controller (GAC, for short). In a nutshell, it reads both temperature and humidity from both greenhouses using two Sensirion modules and turns on fans or the sprinklers to correct the values. The core processor is the Propeller microcontroller. I talked to tech support, and they said it was fine to mount a Sensirion module up to six feet away from the Propeller. I will be mounting a Propeller Proto Board in one greenhouse, and run some wire to the other greenhouse, where the other Sensirion will be mounted.The entire project will be powered by solar panels previously mounted on the greenhouse. I will be getting the voltage rating on those panels soon. If you have any questions, comments, or suggestions, please reply. I will be getting a schematic out there soon, this project is still in the planning stage.
Comments
The basic monitoring functions requested are for interior temperature, soil moiture, and humidity. Secondary requirements are external temp, humidity, and ambient light (night, sunny day, cloudy day). The basic control functions are for fans, heat, humidity, water, and lights.
The above can be readily controled using spin. There may even be objects for particular sensors already in the OBEX, but I didn't get that far.
The following functions might not be so easy in spin, but should be fairly straight forward in propforth:
Display monitoring and control information on a PC using a browser via ethernet (on internal network).
Remote display and control of system over the internet.
Remote debugging and support over ethernet.
Support for more than 32 IO lines.
All the above should be fairly easy in PF 5.0.
We did not yet decide any particulars for the devices connected to the prop.
Good luck on the project!
Be my guest!
i find this project very interesting as i am working on a project that very similarly controls a system based on temperature readings and other stuff as well but is very much alike except i am using the digital i/o board to control the functions. i have a problem with my code that i see possibly here as well when using your "if, then" statements with the readings from the sensor they do not work. i am very new to spin language, but i know this is not working in my code and i have tried a few different ways including your way - which makes tempA an i/o if i am correct, not a value to reference
jamie
if (tempC > tempA)
outa[fanA] := 1
(i have a similar code to yours based on "sensirion_full_demo". i used temp1 instead of tempC so i can use tempA,tempB,tempC, etc. as over/under values.)
tempC is a huge value that the float to format makes into a displayable value. my problem is how do i get temp1 or another named variable to a usable number to use the if/then statement.
jamie
temperature is 24.18C at time of test. this should mean OUT_REG:= 10000000 but it is 01000000 this is a copy of the teminal
parallax serial terminal:
-- INPUT --- 00000000
-- OUTPUT --- 01000000
Temperature 24.19, 24.19°C
to:
I don't think you can make direct comparisons with non-integers like this in SPIN. I think you will need to use the comparison operations, FCmp, in the Float Math object.
if then pst (parallax serial terminal)
-- INPUT --- 00000000
-- OUTPUT --- 01000000
Temperature 24.27, 24.27°C
if
pst is
-- INPUT --- 00000000
-- OUTPUT --- 10000000
Temperature 24.46, 24.46°C
which would be correct except
-- INPUT --- 00000000
-- OUTPUT --- 10000000
Temperature 33.12, 33.12°C
when i change the 28 to 28.00 or 28.0 for that matter, it changes the outcome. but in either outcome the if/then statement does not work
I really think you need to look at how comparisons are properly done with FloatMath operations. EDIT: oops, maybe the FCmp(a,b) is only in Float32. I'm away from my normal computer, so I can't check that out.
Anyway, also take a look at these:
http://forums.parallax.com/showthread.php?113354-How-to-compare-values-that-are-floats-when-using-FloatMath&
http://forums.parallax.com/showthread.php?102784-Floating-point-compare&p=721138&viewfull=1#post721138
http://forums.parallax.com/showthread.php?108103-Floating-point-(-Greater-than-and-Less-than-)
i am doing it the stamp basic way and trying to make it work i am learning spin now and i understand what you mean. i am not writing it right at all!
i will wwork on it and submit new code and results soon.
this update makes led's turn on or off depending on temo readings as well as output to the i/o board. this makes it easier to diagnose as i only need the demo board to mess with code.
here is the terminal
-- INPUT --- 00000000
-- OUTPUT --- 10000000
Temperature 20.68, 20.68°C
as you can see, the if /then says if temp1 > 29 then 10000000
but temp1 is 20.68 and it is 10000000
so here was my initial thought. force it to see every part of if then as a float then when it compares it should make sense but if statement still won't work
as you will see, i did have to use the f.fcmp to make if statement work properly. but i was converting values too much i discovered that by using tempB = 20.00 as ElectricAye suggested it did the conversions i needed but i was comparing it to the wrong variable. i was using then comparing temp1 to tempB
when all i needed was to compare temp1 to read1
so simple as to be blinded by it