More build pictures

Here’s some more photos from the final stretch of this project.  We decided to  adjust the center trim piece which sadly means some more painting.  lol

Final Canopy Build Stage

Paintbrushes, screwdrivers, and drills.  Yup, we have moved into the final stages of building the canopy.  We are installing the mirrored plexiglass, putting on the trim pieces, and performing cable management where needed.

Colossus WordPress plugin is now GPL

That’s right.  Code commit 715b677  officially made the Colossus WordPress plugin 100% GPL liscensed.  Here at Geekaquarium.com we LOVE free and open source software.

/*
“Colossus Aquarium Plugin” Copyright (C) 2017 GeekAquarium.com

This file is part of Colossus WordPress Plugin for WordPress.

Colossus WordPress Plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Colossus WordPress Plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Contact Form to Database Extension.
If not, see http://www.gnu.org/licenses/gpl-3.0.html
*/

Relay Status Display

Growing up as a kid, I was obsessed with all things space.  TV shows like Battlestar Galactica, Buck Rogers , Space 1999, and others just helped to fuel that obsession.  As a kid, I knew that stuff I saw on TV wasn’t real.  For the real stuff you needed to pay attention to NASA.

S-IB Networks control panel. This panel monitored the state of the electrical bus communications within the Apollo S-IB rocket. Photo credit: Jonathan H. Ward

Rockets and spacewalks are cool, but the earliest impression of NASA that I have is Mission Control.  The rows of consoles with the CRT screens and status panels filled with blinking lights really stuck with me.  As such, I’ve always enjoyed a good control panel.

My original idea for Colossus was to have a section of the canopy to display relay status in this fashion. One of the MCP23017 I2C chips is reserved for driving an LED status panel.  Since we expanded Colossus and added a second Raspberry Pi (Guardian), we decided to do a virtual control panel instead.

Following the design inspirations of NASA, we created the following Relay Power Status Panel.

Relay Power Status Panel

This relay status panel displays highlighted status for powered on devices along with a spinning gear icon.  Relays that are off are not highlighted and display a power button icon.  Clicking a relay status will run the colossuscontrol.py script and toggle the relay state off and on.  We are still working on the final color scheme.  On our wish list is replacing one of the 17″ LCD displays with a touchscreen.    We can dream.

How it works

[colossus-relay-status]

This shortcode works by calling the colossuscontrol.py script with the webstatus option.  The webstatus option returns a single line of status output in a comma separated key/value list.  Key value pairs consist of command name, and relay power status.  Example output is listed below.

heater,0,Mood,0,Air,1,Filter,1,Light1,0,PartyBall,0,Floor,0,Game,0,Moonlight,
1,Powerhead,0,Light2,0,UV,0

The shortcode reads this output,  sorts the key/values alphabetically and generates the status panel display.  There is no hard coding of commands or relay names in the plug.  All commands are passed to the shortcode from the colossuscontrol.py.  Changes to channel command or gpio pin numbers will not affect the functionality of this shortcode.

WARNING!

This script uses PHP’s exec and system functions to run the colossuscontrol.py script. Certain aspects of the colossus control script require it to be run as root. In order to function properly, Apache must have root privileges. This creates MAJOR security holes. Our aquarium is not publicly accessible from the internet, otherwise we would not have done it. WE DO NOT ADVISE RUNNING APACHE AS ROOT!  DO SO AT YOUR OWN RISK!

Colossus WordPress Plugin

We are big fans of WordPress, so it’s no surprise that we are using it for Colossus.  While designing the web based control panel, I decided that it would be easier if I just incorporated all the individual scripts into a plugin.  I used Michael Simpson’s excellent WordPress Plugin Template to get started, and the Colossus Aquarium Plugin was born.    You can get git the code  at our BItBucket repository.

Important Note

For the on/off feature of the relay status panel to work, you must create docommand.php and install in Colossus’ www folder.  Please see this link for more details.

Shortcodes

The following shortcodes are available:

[colossus-tank-status] • Display Tank Info
[colossus-relay-status] • Display Relay Status
[colossus-temperature-status] • Display Temperature
[colossus-display-last-event] • Display Last Event from database
[colossus-display-last-ph] • Display Last pH reading from database
[colossus-display-last-waterchange] • Display Last Waterchange from database
[colossus-graph-water-change] • Display graph of water changes
[colossus-graph-temperature] • Display graph of temperature readings at 12:00pm
[colossus-graph-ph] • Display graph of pH readings
[colossus-show-camera] • Display RelOptic Camera Feed
[colossus-filterchange-add] • Data entry for filter media change
[colossus-] • 
[colossus-] • 

ColossusControl docommand.php

I needed a way to call the colossuscontrol.py script from a php script.  The script docommand.php allows you to call colossus control and pass command line options to it as a url.

Download

You can download the code respository at BitBucket.

WARNING!

This script uses PHP’s exec and system functions to run the colossuscontrol.py script. Certain aspects of the colossus control script require it to be run as root. In order to function properly, Apache must have root privileges. This creates MAJOR security holes. Our aquarium is not publicly accessible from the internet, otherwise we would not have done it. WE DO NOT ADVISE RUNNING APACHE AS ROOT!  DO SO AT YOUR OWN RISK!

http://colossus.local/docommand.php?cmd=webstatus

http://colossus.local/docommand.php?cmd=status&action=html

 

Aqeuon 300 Watt Heater Added

My last heater was a 200 watt Aqeuon.  When I reset up Colossus this summer, I was suspicious that the heater wasn’t working properly. During the summer, the heater was not a priority as the tank stayed close to normal due to room temperature.  With cooler temperatures approaching,  I ordered a 300 watt model from Amazon.

We set the temperature dial, and installed it into the tank.  After waiting a hour for the temperature to adjust, we turned on the heater.  A short time later, my suspicions were confirmed,  the other heater just wasn’t doing the job anymore.  After some time the tank warmed up and held at 79 degrees.

I them modified the colossus control program to auto turn the heater relay on or off depending on the temperature.  See commit for more code.

An additional commit to the code added an emergency overheat feature.  When the temperature reaches a certain level, Colossus Control double checks that the heater is off and will blink the mood lights until the situation is resolved.

 

Colossus Crontab Settings


#Every minute get temperature readings
* * * * * /usr/bin/python /root/colossus-control/colossuscontrol.py temp

#Evey day at 5pm turn on party ball mode
00 17 * * * /bin/sh /root/colossus-control/bin/partyball.sh

#Every day from Midnight to 6am turn on the floor light
#59 23 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py floorlight
#00 06 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py floorlight

#Every day from 7pm to 3am turn on Mood Lights
00 19 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py moodlight on
00 03 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py moodlight off

#Every day from 10 am to 10 pm Turn on Light 1
#Remember light channel is reversed (off = on)
00 10 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Light1 off
00 22 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Light1 on

#Eevery day from 11 am to 9 pm Turn on Light 2
#Remember light channel is reversed (off = on)
00 11 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Light2 off
00 21 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Light2 on

#Every day from 10pm to 4am Turn on Moonlight
#Remember light channel is reversed (off = on)
00 22 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Moonlight off
00 04 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Moonlight on

#Every day turn Air on from Midnight to 11am
00 00 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Air on
00 11 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Air off

#every day turn air on from 6pm to 8pm
00 18 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Air on
00 20 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Air off

#Every day at 3 am turn on UV
00 03 * * * sudo /bin/sh /root/colossus-control/uv.sh &

#Every day from 11pm to 9am turn on Powerhead
00 23 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Powerhead on
00 09 * * * /usr/bin/python /root/colossus-control/colossuscontrol.py Powerhead off

Colossus Hardware Specifications

Current Hardware Configuration

The current hardware specifications as of August 3, 2017.

1 – Raspberry Pi Model 3
1 – Raspberry Pi Model 2b
1 – Seagate 4tb Backup Plus Hub USB Hard Drive
2 – Sainsmart 8 Channel Solid State Relays
1 – Sainsmart 4 Channel Relay
2 – VSDispaly HDMI LCD Driver Boards
2 – 17.3″ LCD Replacement Laptop Screen
2 – Power Adapters 12 volt – 3 amp (Laptop Screens)
2 – Power Adapters 5 volt – 2 amp (Raspberry Pi)
1 – 4 Port 10/100 Switch
1 – Odyssea T5 Aquarium Light
3 – MCP23017 I2C Expansion Chips
2 – Waterproof DS18B20 Temperature Probes
1 – DS18B20 Temperature Sensor (Non-Waterproof)
1 – DHT11 Temperature/Humidity Sensor
4 – RJ45 Jack Sockets
1 – Cover plate for 4 port RJ45 outlet
1 – PIR Motion IR Sensor
1 – GFCI Outlet
6 – Always On Power Outlets
16 – Relay Controlled Power Outlets

 

Colossus Control Software

Colossus – The Raspberry Pi Aquarium Controller uses custom software by RBA Marketing.  Since we are using Raspberry Pi SBCs, it only made sense to write the software in Python.

The Colossus Control Software was developed using the DietPi OS.  DietPi makes installing common apps easy and has a very small footprint when booting.  Hand’s down, this is our favorite operating system for the Raspberry Pi.  The software will run on any Raspberry Pi operating system available.

Colossus Control Software Features

This python scripts handles the all of the relay switching, event logging, temperature monitoring, and system notifications.

Software Requirements

The following system applications are required for the Colossus Control Software to operate.

  • RPi.GPIO – GPIO Interface Library
  • WiringPi – GPIO Interface Library
  • I2c – I2c Support
  • LAMP Webserver Stack – Apache2/MySQL/PHP
  • phpMyAdmin – Php Mysql Manager
  • Python – Python Programming Language
  • mySQL Python Connector

You can find out how to install the above applications with easy google searches for your particular OS.  One of the reasons we use DietPi is that installing these applications is a part of the initial install process.  Once again, DietPi is highly recommended.

Miscellaneous Software

Espeak – Voice Program

Get The Software

Important note:

This software was designed to be used with three (3) MCP23017 I2C Expansion Chips. If you use less than three, you will have to modify the source code.

You can check out and download our software by visiting our GIT repository at Bitbucket.  Follow the quick setup steps below after downloading the code.

Quick Setup Guide

  1.  Create mysql database for the software using phpMyAdmin.
  2. Import config/colossus.sql into database.
  3. Edit config/colossus.confEnter your mysql information into the appropriate sectionsChange any other appropriate config options.
  4. Edit colossuscontrol.py and change the following informationChange channel list to assign your own commands to a particular pin numberChange the expansionaddr[1-3] variables under #Global Placeholders.

Command Syntax

You can pass an optional on/off setting for the command if you like.  This is helpful for initialization and shutdown scripts.  If on or off is not specified, the software will flip the bit from 0 to 1 if off, or 1 to 0 if on.  Simple bit flipping with no current status checks.  If you need to know for sure that a relay is on or off, use the optional on/off

Sample Command Syntax

python colossuscontrol.py Light1

python colossuscontrol.py Light1  on

python colossuscontrol.py Light1  off

Getting the Temperature

python colossuscontrol.py temp

This command will read all DS18B20 probes defined in the config/colossus.conf file.

Miscellaneous Commands

python colossuscontrol.py halt – Turn all i2c expanders to their “off” positions determined by the halt() routine located in the script.

python colossuscontrol.py help – List all commands and pin numbers

python colossuscontrol.py status [html] – Displays the current status of the relays.  Use the optional html to return the output as html instead of plain text.

python colossuscontrol.py webstatus – Returns a single line of output as a comma seperated list contain relay name, pin number, and status.  This is used for the Colossus WordPress Plugin.

python colossuscontrol.py phtest x.xx – Log result of manual pH testing into the database.

python colossuscontrol.py waterchange xx -Log number of gallons of water changed into the database.

python colossuscontrol.py log sensor data – Command line input feature to record miscellaneous sensor data to eventlog.