AquaStats - Aquatronica Controller Software

A couple of days ago I purchased an Aquatronica Ethernet module as it only recently became available in South African LFS shops. I also have a Serial Interface , but therein lies a couple of problems. The first is that it uses RS232 serial port for connecting to a PC - the second problem. This means the PC has to be in close proximity to the controller (couple of meters). Furthermore, the software - although very nice for configuring programs/devices - is not really useful as a remote monitoring system.

It does not allow the definition of alert actions - one can only configure a sound on an alert but I never managed to get my laptop to produce a sound via the software. This is in any case not useful as the controller itself can already produce a sound on an alert condition. It cannot send emails, and it cannot log any data from the device - which is stupid.

See, the controller has a limited buffer to store either a month, week or day's worth of logging data per sensor. The longer period, the further apart the sample interval. For instance, if set to a week's buffer, the sample interval is once every 4 hours. For a month the sample interval is something like 16 hours - useless. Since the program displays real-time data, it would be easy for the developers to have added this feature, but as to this date the feature is still not implemented.

Since the protocol over the wire is proprietary and binary, and since I have neither the time nor the inclination to decode it, I settled for the inferior solution. Until a couple of days ago when I purchased the Ethernet Module.

Apart from the fact that one can configure it to send alerts via email,it provides a simple web portal for querying the status of the system. This is implemented using AJAX, which means it was trivial for me to write a program that interacted with the controller via TCP/IP (my ethernet network at home).

This is how my new baby was born - I started two days ago to write the software, and as I got time during my various other projects I managed to get this completed:


Main screen

Main screen after launching application

Application preferences

Application preferences. Notice that both an embedded as well as a remote database are supported.

Visual way of starting the sampling process.

Visual way of starting the sampling process.

Exporting of sensor and plug data to Excel is supported.

Exporting of sensor and plug data to Excel is supported.

Graphing and exporting

Graphing and exporting allows you to select your sensor or plug.

high resolution graphs

It is possible to generate very high resolution graphs of any sensor data. It is clear from this picture that the probe has some "jitter" in the data - i.e. this is where resolution and accuracy is visualized.

Graphing of power plug status.

Most probably one of the most unique features of this application is the ability to graph your power unit's plug statuses. If you are wondering why this is a good idea - just think how you can detect whether your heaters or chillers come on excessively or whether the CO2 solenoid is turned on and off too rapidly. In a future release the total duration of time any given device was turned on will also be displayed, allowing you to calculate power consumption etc.

Graphing of power plug status.

Another unique feature is the ability to overlay multiple graphs to see the relationship between various things - a feature requested by RobbyG @ ReefCentral.

It can clearly be seen how the metal halide lights encourage photosynthesis in the coral and algae, raising dissolved oxygen and ultimately raising pH. The rise in temperature also corresponds quite well with the lighting period - however this is only a contributing factor as the major factor is most certainly the heat from the passing daylight.

The effect of the chiller can also clearly be seen. I now know for the first time my chiller is not on excessively and the temperature curve I programmed in to my Aquatronica is a good representation of the natural heating/cooling process.

Graph Annotations

Another unique feature of this application is the ability to plot annotations on the graph itself of any major water chemistry affecting event. This picture explains the benefits well enough.


To support the annotations on the graph above, a tank and tank maintenance log facility was added. This allows you to define your tanks and the sensors applicable to them.

Tank Log

Once the tanks are defined, actual events can be captured on an exact time (down to the minute), and associated with a tank. The system will then automatically plot these log entries as annotations on the graphs, at the correct point in time.


Overlay graphs can combine any set of sensor and plug combinations you desire. Common groupings can not be saved as a preset in order to recall it quickly.


The new alert module allows you to select an alert monitor per sensor - unlike the Ethernet controller that limits you to a type of sensor.

Manual Water Params

Another new module - manual water parameters. Ideally we would have electronic sensors connected to the Aquatronica for all the water parameters we need to monitor. Unfortunately most water parameters are not practical or possible to monitor electronically, such as Alkalinity, Nitrite etc. This is why I have added a module where one can specify all these parameters you do not monitor using the Aquatronica. These parameters can be exported and graphed just like any other parameter.

If you are interested in this application, feel free to download it from the links below.

Important Information

New Installation Instructions

  1. Make sure to download and install the latest Sun Java JRE for your operating system.  You will typically need Java 1.5 (Java 5) or Java 1.6 (Java 6). Fetch it here if you do not already have it installed.  To see whether your computer already has it installed, launch Command Prompt (usually located in the Accessories sub menu of the Start Menu), and type: 
    C:\Users\waldo>java -version
    'java' is not recognized as an internal or external command,
    operable program or batch file.
    If you see the message above you do not have java installed. If you see a simmilar message to the one below, and it mentions version 1.5 or 1.6 or higher, it should be all good to go:
    C:\Users\waldo>java -version
    java version "1.6.0_14"
    Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
    Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)
  2. Download from the table below (right at the bottom).  This is your blank embedded database for use in the embedded Derby database mode.
  3. Download the latest file from the table below (right at the top).  Always download the latest release as this is usually the most stable and reliable build.
  4. On your computer, make a new folder (directory) anywhere where you have full read/write access.  Note that on Vista and Windows 7 I strongly recommend *against* the C:\Program Files\ directory.  Rather use your home (documents) directory.
  5. Extract the contents of the file inside this directory. Your directory structure must look like this (abbreviated for presentation):
        |   activation.jar
        |   AquaStats.jar
        |   commons-codec-1.3.jar
        |   dblayer.jar
        |   derby.jar
        |   dom4j-full.jar
        |   forms.jar
        |   javaconfig.jar
        |   jcalendar-1.3.2.jar
        |   jcommon-1.0.10.jar
        |   jfreechart-1.0.6.jar
        |   log4j-1.2.15.jar
        |   LogMonClientAPI.jar
        |   looks-1.2.2.jar
        |   mail.jar
        |   postgresql-8.1-407.jdbc3.jar
        |   xercesImpl.jar
        |   |
        |   |
        |   +---log
        |   |       log.ctrl
        |   |       log1.dat
        |   |       logmirror.ctrl
        |   |
        |   \---seg0
        |           c10.dat
        |           c101.dat
        |           c111.dat
        ...         ...
        |           cf0.dat
    It is extremely important that the "aquatronica" folder inside the file be in the *same* directory as the AquaStats.jar file, as per above. The aquatronica folder contains the embedded Derby database files and should not be manipulated in any way.
  6. Double click AquaStats.jar file.  If all is well, it should start up after a couple of seconds. You can then go to File | Preferences and configure the system.


File Date Version Change Log 13 Nov '10 16:30 PST 1.2.5c GPL
  • Released source code under the GPL license.  All I ask is that any useful modifications be submitted back to me with a short description of what the change is about, who made it and when.  I unfortunately do not have the time or equipment anymore to continue development on this application, but know a lot of people are using it and this way the growth of the product will not be restricted by my availability.
    Have fun! 27 May '09 12:11 PST 1.2.5c
  • Fixed a display problem where plug bars with more than 6 plugs would not display properly if it was not the first plug bar defined in the system.
  • Fixed a bug where the system would not always save the last position of the main window.
  • Fixed some contact details 16 Oct '08 21:40 CDT 1.2.5b
  • Due to the huge number of people having trouble upgrading from a pre 1.2.0 version to a 1.2.5 or later version, I fixed the code that you *should* now be able to upgrade from any version to 1.2.5b without any issues. Hopefully this will make things easier for all of you. Note that if you are already using 1.2.5a then it does not make sense to download 1.2.5b as no functionality was added. 23 Jun '08 14:09 1.2.5a
  • Fixed a bug caused by a redox probe with a negative value (not tested since I do not have a redox probe). Thanks to Adnaan Talibhusein for reporting this. 3 Jun '08 23:57 1.2.5p1
  • Enhanced the Bug Report screen to behave more correctly.
  • Enhanced the whole sensor definition logic to now allow for deleted/removed probes/devices. One can now either physically (permanently) delete all old data for a missing device, or one can archive it. Archived data can be queried with AquaStats by using the new Archived query option.
  • Added a feature where one can request notifications on device disconnects
  • Added a feature where one can get notifications when AquaStats has been disconnected from the ethernet controller
  • Rewrote the UI for the alarm module - it should work more intuitively now.
  • Most child windows should be centered properly now.
  • Added option All to date ranges 30 Mar '08 15:40 1.2.4a
  • A user request was to show the name of the db in the title bar to help identify which instance points to which controller. 30 Mar '08 10:12 1.2.4
  • Added option to specify PostgreSQL DB's name in the configuration - this now allows you to use multiple instances of AquaStats pointing to different PostgreSQL databases - one for each aquatronica controller to be monitored. 16 Mar '08 11:41 1.2.3d
  • The bug reporting system had one major flaw - it did not allow an email address to be supplied, with the consequence that I could never reply to these reports. Now - if you want to be contacted regarding your report, you will be granted the opportunity to specify your email address to be contacted by when submitting a trouble report. 27 Jan '08 18:08 1.2.3c
  • Added support for submitting errors to PWN Consulting directly from the error screen. Should work fine in most internet connected networks as it works via HTTP, however some Proxies might not be supported. 22 Jan '08 15:46 1.2.3b
  • Fixed a bug where daily notification emails were not sent out properly. This feature has not properly been tested so feedback is appreciated. I am out of time :( 20 Jan '08 11:18 1.2.3a
  • Fixed a problem where the application could not patch a clean postgresql database to the current level. 17 Jan '08 09:00 1.2.3
  • Added username/password support for PostgreSQL databases
  • Fixed a graph problem where sometimes an error was shown stating no datapoints was available, when there was points
  • Fixed a bug where in very rare scenarios the poller would hang on a TCP read, never logging samples again. The default timeout is now 1 minute. 31 Dec '07 16:00 1.2.2
  • Fixed graph module to look at the defined value for discrete sensors instead of looking at the data values.
  • Enhanced the patching algorithm so that it will never again leave the DB in an inconsistent state in case of a failure to patch properly.
  • Application will now quit if patching failed. 22 Dec '07 11:23 1.2.1
  • Fixed a bug where for discrete sensor changes, the sampling process would not save the state change (bug introduced in v1.2.0)
  • Added support for templates (variables) in the alarm subject and body definitions.  It is now possible to add time information by adding a specially formatted variable in the form $ {} with the date/time format inside the braces, e.g. $ {yyyy-MM-dd HH-mm}.
  • Enhanced the notification engine so that it now has a dead time for alarm notification, during which all subsequent status changes will be ignored.  Say the dead time was specified as 300 seconds (5 minutes).  If an alarm condition is detected, a notification will be sent.  Any further state changes (in alarm/out of alarm) will be ignored for the next 5 minutes (the dead time).  After that time any state changes will be picked up and a notification will be sent again.  Even if no state changes occur, the default polling mechanism ensures that an updated state notification will be sent soon after the dead time elapsed. 13 Dec '07 01:13 1.2.0
  • Architectural upgrade to the way sample data is stored.  This has the consequence that there will never be a delay in showing any dialog that prompts for user input due to the sensor/plug list being retrieved.
  • Fixed a gross mistake in the iQM calculation in statistics module.
  • Added support to explicitly (hence reliably) mark sensors as discrete or not.  
  • Added Aquatronica Device Manager tool that allows you to handle device renames, additions and removals properly.  Note that deleting devices is not yet supported if there is data associated with the device.  Prior to this update, when adding a new sensor the application would not recognise it as an available sensor in some parts of the program.  Renaming a sensor or plug had devastating effects on history.  This has all been resolved.  Take note that renaming a sensor is tricky - you need to use the link/delink facility.
  • System will automatically upgrade the DB to support these new features.  But you MUST read the startup instructions thoroughly.  If patching failed, then you need to contact me for assistance and revert back to your backup.
  • Changed order of some menu entries. 7 Nov '07 10:17 1.1.5
  • Support adding of tanks without any associated sensors
  • Added some rudimentary data validation in the Preferences form
  • Added a statistics module that allows for some basic sensor and plug statistics to be calculated.  Note that discrete sensors are NOT currently supported and will produce an error when selected!
  • Couple of other small changes that I cannot remember :( 18 Oct '07 10:47 1.1.4
  • Added setting to remember last window position and size. 17 Oct '07 21:27 1.1.3
  • Added preference setting for automatically starting Real Time Monitoring - as requested by reefislife
  • Added preference setting for automatically starting Sampling - as requested by reefislife (this time done right ;) )
  • Made some windows modeless and some others resizable 16 Oct '07 16:41 1.1.2
  • Added SMTP authentication for email notifications - as requested by dbond
  • Added data markers - hover your mouse over a data point on the analogue sensor graph and a tooltip will appear with the data point's exact values.
  • Added icon for Windows users 14 Oct '07 13:53 1.1.1
  • Added a new alert module that works similar to the alert module built in to the ethernet module, however it is a bit more flexible. This allows email alerts to be sent whenever a sensor goes in to alarm condition. It uses the predefined "normal" ranges as defined in the Aquatronica.
  • Added a new manual water parameter module. This is useful to capture chemically and non-aquatronica sampled water parameters. These parameters can be graphed and exported just like other parameters.
  • Added command line option called STATUS to dump a textual report of the current status of the unit. This is useful over SSH or Telnet connections where it is not possible to launch a full GUI.
  • A separate graph interval threshold was added to allow one to change the sampling interval to a smaller value but still be able to draw the graphs. Previously if say you sampled at 15 minute intervals, then changed that to 5 minutes, you would not see a graph as the system would have believed there to be missing data points as the gaps are larger than the (current) sampling interval. Now you can set the graph interval threshold to 15 minutes and the graphs will still work.
  • Level sensors and other "discrete" sensors are now supported. Note that in this release a status change is only detected IF the sensor has an alarm associated with it as defined in the Aquatronica unit. The system does not parse the actual status message - it looks at whether the sensor is in alarm or not.
  • Fixed a bug where it was possible to define multiple tanks with the same name.
  • Also in the alert module is a summary status feature. This allows you to have the program send hourly or daily summaries of the sensor and plug statuses.
  • The DB size (approximation) is now shown in the About request - a user requested feature.
  • Fixed a couple of small bugs 11 Oct '07 00:47 1.1.0
  • Added new name and branding - application is now called AquaStats. To run, double click AquaStats.jar. Delete Aquatronica.jar from your hard drive.
  • Added Realtime Monitoring
  • Added plug names to plug status table
  • Added ability to change plug status by right clicking on a plug just like in the web software
  • Added (end-user) PostgreSQL support. If you are interested, please email the support address then I'll send you a DB schema.
  • Added blue colouring when a sensor's value changed from the previous poll.
  • Added status bar status messages for most operations
  • Made most potentially long running tasks (such as starting the database, polling the ethernet module etc) asynchronous and added status feedback via the status bar
  • Fixed a couple of bugs - but note that I have not done any defensive coding yet. This will come later
  • Added much better handling for database issues.
  • Fixed a bug where it might seem the application never starts if the database is missing
  • Added support to show the tank maintenance log annotations on the sensor graphs (this is WAY cool)
  • Tank annotations can be turned off if so desired
  • Added capability to have the main window always on top
  • Added minimise capability (user requested feature)
  • DB Patching mechanism was enhanced. Users will not never have to worry about having the latest DB.
  • Presets are now available for overlay graphs. I got tired of selecting all the sensors and plugs when I wanted to see everything for one tank only - so I added the ability to define presets that contains a list of grouped sensors and plugs.
  • Tank and Tank Maintenance Log windows have been enhanced considerably. 9 Oct '07 00:48 1.0.5
  • Added better handling for missing data for plugbars. Missing data is indicated by a grey half-height bar.
  • Added tank and tank maintenance log utilities. The idea is that you can associate sensors with your tanks, and then when you capture tank maintenance logs such as "Dosed baking soda" or "Performed water change", the system will annotate these events on the graph at the exact time it occurred - explaining any deviations from normal trends. The annotation part is not yet written, however you can start capturing maintenance tasks so that it will appear when I add the graphing code.
  • The database will now be automatically upgraded to the latest patch level - no more command line fiddling.
  • Graphs are interactive - you can draw cross hairs (left click) or zoom, and you can print the graphs by right clicking on them.
  • Time scale is much better now
  • Graphs and exports can now be date filtered.
  • Added support for changing database types - though as discussed earlier remote DB support is still not publically available. 8 Oct '07 00:17 1.0.4
  • Fixed missing data handling in the graph module. Sensor data is now not drawn if the data is missing, and plugbar data is shown with a value of 0.5 if the status is unknown.
  • Removed x-axis resolution setting in preferences. This will now always be Minutes.
  • Limited the polling interval to the range [1,30]
  • Fixed a bug where the program would not close if monitoring was active.
  • Added command line option to upgrade the DB to the new format (v1.0.3).

6 Oct '07 23:40 1.0.2
  • Added overlay graphs
  • Added about box
  • Fixed various small error handling issues

6 Oct '07 21:20 1.0.1
  • Added date markers on graph
  • Added better date descriptions on x-axis
  • Added plug status real time display