The greenhouse projectProject history |
|||||||||||
|
|
|||||||||||
|
Content Links
|
This is the story of how my and my wife's interests were combined, i.e. electronics and gardening. And as this is my side of the story, don't expect to find anything about growing plants in this text. You can click on any picture for more information. Happy reading!
The startIt all started when I read about the Basic Stamp. It seemed so simple and fun to build with it, so I wanted to take up electronics as a hobby again, even though I don't have much spare time. Anyway with Basic Stamp I wouldn't have to design a "full" computer again. I could focus on the interface part. I thought a data logger would be a cool thing to build, and it could be rather useful as well.
I designed/prototyped it using a Veroboard and I wanted it to handle AD, Digital inputs and temperature to start with. It should be able to work online, connected to a PC, and off-line logging the data itself for later retrieval. So I also needed an EEPROM. A clock would also be needed as I wanted to define start date/time and interval for the logging, and also to be able to log the log-time. To save space and to simplify interfacing I wanted to use I2C communication to the peripheral circuits. I found 8kB EEPROM in 24FC65, a clock in DS1307 and a thermometer in DS1621, all using I2C. Unfortunate I couldn't find any good AD converter, so I had to use the MAX186 (8 ch, 12 bit) using SPI (wasting another three IO-lines). I also added a MAX232 to get a proper RS232 interface for the PC. Finally I had it working. I could program the logging, retrieving data etc. through a command prompt. But it was only possible using a 'shoehorn' to get it in. RAM was the big issue. It would be quite difficult to finish the project exactly as I wanted. BasicX-24Then I came across the BX-24 in a news group and decided it would give me more power to do a bit more. I got a couple of these and moved the whole project to it. And true, it gave me much more power. Program space was no more an issue, it was enough memory to use it for the logging data as well. Program code is only about 10kB. Still RAM will be an issue. I had to skip multitasking the way I wanted to use it, and only use it where it was absolutely necessary. RAM is an issue and I don't like not to have full control of its usage, specially counting each byte in a project. Some occasional stops are likely due to stack overflow. Now I don't have to use the external EEPROM. I will also get rid of the MAX186, freeing three IO-lines. I don't like the MAX186 anyway. I found that it draws quite a lot of current through its inputs when powered down, draining my NiMH used for the clock circuit. I can't find anything about input impedance in its documentation. Also the MAX232 isn't needed any more. Radio
The next parts I came across were radio TX and RX modules on 433MHz. They should be able to give 100m connection. In that case I could place the logger in my wife's green house some 30m away and receive its data inside. These radio modules wasn't to easy to manage, as the receiver spits out data all the time. Data when I'm transmitting and garbage the rest of the time. As the loggers RAM didn't allow me to have a two-way communication, I have to transmit each packet of data several times, hoping that at least one packet arrives correctly. Right now I send each package three times at 2400bps. Most packages arrives correctly but sometimes it will miss all three of them. Receiving data
The data is received by another BX-24 powered module. It receives the packages and verifies the checksums to validate the content. Then it interprets the data (hardcoded for the time being) and outputs it at the RS232 port in a readable format. The interface is connected to my Linux server. A small C-program receives the data and puts it into a MySQL database. A cron-job will run every hour to calculate averages for different intervals and store these values back into the database. Finally a web-page will generate graphics based on values in the database for different intervals, depending of which graph is displayed. I also have a very similar interface module to which I can connect a 2x16 LCD, showing the latest readings sent from the logger. Because of that, the data is measured every two seconds. The statistical database doesn't need such frequent readings, but when you look at the display you want to have the actual value right now. What's measured
The most important reading is the temperature, as it should not exceed 30 degrees C. The next thing that is fun to see on the net, is if and how much the vent doors in the roof are open. There are six of them, four is automatically driven by the sun. Right now I can monitor two of them, one automatic and one manual. As there is no power available in the greenhouse, I measure the voltage of the accpack powering the logger. I can also measure the voltage of the NiMH battery feeding the clock circuit, but I don't do it now as the MAX186 draws to much current. Probably I will change the NiMH for a standard Lithium cell so I don't have to worry about it in the next ten years.
Later I will add a sensor to measure the moister in the earth and one sensor to measure the water level in the barrel feeding the automatic irrigation. Power considerationAs I mentioned there is no power available in the greenhouse so I run it from 6 or 8 standard NiMH R6 (AA) cells. I do turn off the transmitter when it doesn't send any data but I haven't implemented any power down mode of the CPU yet. I have a 1Hz signal connected from the clock to pin 11 (interrupt) which I will use to wake the CPU up once every second. I would like to use some kind of solar panel. I have a small one on the shelf, which can't drive the logger but may help to give a little charge to the batteries. In that case I would like to measure how much power that goes in or out from the batteries.
FeedbackAny feedback is welcome. Mail to Ingvar Esk
|
||||||||||
|
|
|||||||||||
|
Design by Ingvar Esk
|