The Computer Module

This module is DEPRICATED -- meaning that the information is available for reference, but will not be included in future development. 

This module makes it possible to use an Arduino board to log data to the web without the use of Ethernet or WiFi. So a plain old Arduino Uno (etc.)  with a USB cable connected to your computer (with an internet connection) can communicate with a web server via Processing. The reason this module is depricated is that the current direction in the development community is toward the "internet of things". The device (in our case the Arduino board) communicates directly with the web server which makes this module obsolete.


Computer module overview

Since this module is really just a collection of different programs and files on your computer, we're going to talk about the different parts as sub-modules.

It starts with the brain module (the Arduino board). The brain is always running, and keeping track of the most current sensor readings. The computer local-connection sub-module sends a message to the brain requesting the current sensor readings. The brain responds with a message containing all the values of the various sensors (separated by commas). The local-connection sub-module then records this data by writing it to a text file (CSV) and by sending it to the visualization sub-module. Then, the visualization module takes that data and uses it to display the pretty charts that make it easy to see what's really going on in your garden.

NOTE: Before you begin, you will need to download the GardenBot software package from the parts page.

Computer Sub-module: Local Connection

Currently GardenBot uses a language called Processing (a flavor of C++) as the method for communicating with Arduino, which is great because Processing is powerful enough to do everything the local connection module needs. Actually, Processing could also do all the visualization as well, but we currently only use it for this local connection stuff.

To get this module up and running, you will need to begin by installing Processing. Then you will open the script (in Processing) and run it.

A window pops up and displays levels for soil moisture, soil temp, and light level -- just to let you know that it's working. You can also see the progress as it logs the readings it gets every 15 minutes down in the terminal display down at the bottom of the Processing window.

When it is running, the Local Connection module will communicate with the Arduino board, record the sensor readings to a text file on your hard drive, and will send data to the visualization module.

Note: you will need to provide the URL to your chart folder. There is a place near the top of the script where you can enter a list of URLs that you want the script to send data to. See the visualization module below for details on how to get your URL.

How can I see the sensor data?

The best way to do it is to use the visualization sub-module described below.

In the event you don't have access to a web server, or you just want to use the data another way, the Processing script also automatically saves the data out into a text file that is in a format called CSV or Comma Separated Value. This just means that each line in the file is a row in a table, and the cells for each column are separated by commas. The handy thing about CSV is that it is such an old format that nearly any program that can import data for charting will be able to use this format.

This means that if you don't want to set up the visualization sub-module because you don't have access to a web-server, you can just use the CSV file provided by the Processing app.

The file is called "sensorData.csv" and it will appear right next to the Processing script file once you run the scrip. To create a chart for this data you can open the CSV file in Excel or OpenOffice and use the chart wizard to create simple charts of the data.

Computer Sub-module: Visualisation

 The Visualization module is currently only available in an online form. The upside is that once you get this module setup you will be able to view the current conditions from your garden from anywhere you have online access. The downside, is that you currently must have access to a web host to be able to use the Visualization module.

To see an example of the charts in action, see my case study.

This is a sample of GardenBot readings taken over 3 days (i.e. tthe standard view). The hay-stack like humps represent the light sensor showing us each day. The blue line that is gently sloping down as it heads to the right is the soil moisture sensor. On the left, you can see an uptick in the moisture sensor that corresponds with a dip in the daylight -- yes, this was a brief rain storm.

What's my URL?

Getting this module to work is pretty simple. In the download package, there is a folder called "GardenBot_Computer_Visualization_WEB". You will need to upload the contents of this folder to a web server.

Once you have uploaded the files, you will need to copy the URL to that folder and paste it into the Processing script (see above) so it knows where to send the data.

Your URL should look something like this:

Notice that the path ends in "convertSensorData.php". This is the script that does the work on the web end, so be sure to keep that name on the end of the URL.

Now, if you visit that URL, you will see the charts being updated with your data (thanks to the "index.html" file).

Other notes

As with the Arduino code, please remember I am sort of a hack programmer. And being self-taught there are many a bad habit and messy spots. And on that note, anyone interested in helping clean any of this up, or add cool sub-modules, please contact me.

For charting, OpenFlashChart was chosen because it had the most complete functionallity. There are other charting libraries out there. If you are looking for something OpenSource (i.e. not Flash) you should check out Flot.

about how-to parts contact GardenBot home