GreenHouse Monitor Program

From OpenCircuits
Jump to navigation Jump to search

What

This is an arduino program intended to monitor the environment in a green house. It has a simple command driven interface. It is designed to run with Python Smart Terminal Documentation on the construction of a Smart Terminal extension to support the green house monitor and save its data to a csv file are also part of this project and the documentation here.

Source Code

Still working on where I will keep the source. It is open source, email me in the meantime: User:Russ_hensel The code is pretty straight forward, the heavy lifting is all left to the Python Smart Terminal. There is nothing very fancy or special about the arduino program, get the source, read it. Email me if there are issuses. Also look at this wiki's category SmartTerminal (link at bottom of this page).

Commands

Commands are single letter strings, in some cases followed by numbers. All end with a <cr>. All envoke responses all of which also end with <cr>

Command Purpose Send Response Comment
Get version of arduino software v GreenHouse Monitor v3 2017 01 24.01 Of course exact string changes with version. This string is used by the SmartTerminal to verify the arduino connection.
Aquire Data a ok Data is held in arduino memory, access with further commands.
Get the Temperature t 33.0 60.0 In this version there are 2 sensors.


Smart Terminal Extension

In general when you want to make an extension you should find one that is similar to the one you want, copy it, then tweak the code. This description will not quite do that because the extension ( and arduino program ) are already written.

Copy Some Code

All the extensions that are written are in modules with names of the form xxx_processing. Look at the file headers .... and pick one to copy. If you run this copy it should start up without too much trouble. But how do you get the code to execute? Say your module ( file ) is my_processing.py and the class name ( which you will probably change when you make the copy ) is MyProcessing. You do not run your module, you run SmartTerminal. The trick is to first make some changes to the parameter file. What you need is to make sure that at the end of creating a Parameter class the final setting reflect something like:

     self.ext_processing_module      = "my_processing"
     self.ext_processing_class       = "MYProcessing"

are the setting that are made last. More documentation the on the parameters is found in Smart Terminal Parameter Examples.

SmartTerminal Code Explanation

I will explain the green house code, use this explanation to build your own code. This code is gh_csv_processing.py The really fine details are in the code comments, this documentation is at a higher level. To activate the code have your parameter file ( this is automatic in the intermediate file by setting mode = "GreenHouseCSV" )

    self.ext_processing_module      = "gh_csv_processing"
    self.ext_processing_class       = "GHCSVProcessing"

What Is the Point

It is always nice to know when code is being explained what the code is supposed to do. So here it is.

The idea is that the arduino will be set up in an environment like a green house and its job is to measure and report on variables like temperature and humidity. The job of the smart terminal is to control that data acquisition and log it to a csv file.

Details

The smart terminal need not be smart, it can still work as a dumb terminal and let you issue commands to the arduino and inspect the results. In addition the smart function include: