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.

 

 

 

 

 

 

 

 

Raspberry Pi Aquarium Build Update

We started connecting all the individual pieces today.  We upgraded the unit to handle an additional Raspberry Pi.  That’s right!  Dual Raspberry Pi(s).  We also added a 4-port network switch so the the Colossus and Guardian could talk to one another.  Next step was to connect the aquarium light relays to the main electronics board, followed by hooking up the LCDs.

After running a few tests, we used masking tape and cardboard to mask out the areas of light coming from around the LCDs.  Once the plexiglass is in place, the tape won’t show.  The plexiglass will hold the LCDs firmly in place.

The canopy base got several coats of black latex and once it’s dry,  it’ll be installed around the aquarium.

Controlling the aquarium light with a Raspberry Pi

In this post, we are going to talk about controlling the aquarium light with a Raspberry Pi.   The light we are going to modify is the Odyssea T5 Quad Timer Aquarium Light.  We chose this light for it’s mod-ability.  The aluminum channel allows for easy access to the ballast and wiring.

Our initial plans for this light was to bypass the built in timer, and control the light with the pi by using relays to turn on each of the three sets of lights.  We also knew that we would require an additional cooling fan due to the way we are mounting the light.  We have also had to move the power cord due to canopy restraints.

The first step was to open up the light and remove the timer.  After removing the end cap, we slid out the small front panel piece to access the main wiring.

I drilled a set of holes into the casing and used led holders to protect the wires.  I also added one hole in the center of the unit for a fan.

Using disconnect pairs connectors to hook into the existing wiring, we ran the wires up through the led holders and into the power box.  We recycled an old seagate hard drive enclosure to house the relay and power connections for the aquarium light.  We used Cat-5 cable to connect to the Raspberry Pi.

 

Got mood lighting? Yup!

Spent a little time this after noon stringing multi-colored Christmas lights around the ceiling of the office.  No, we are not celebrating Christmas in July.

A couple of strands of lights brings a really nice low wattage light and atmosphere to the office.  I will eventually tie them into the motion detector at our office door.  When motion is detected, flash the lights.  Functional mood lighting for those times you don’t want to sit in absolute darkness. 🙂

I’ll post better videos later once we fix all the droppy spots and clean the office.

The Colossus Control Panel Part 1

Cool computers have cool control panels, am i right? Colossus will not be any different, and since we had already cut the plexiglass to size, it was time to move to the next step – applying the mirrored window tint.

We are undecided whether we want to go with a silver mirror or a smoky black mirror.   Since we are going to test several control panel ideas,  and have a roll of Gila Silver Mirror Adhesive Window Film, I cut off a 4 foot section to apply to the plexiglass.

This was my second attempt at applying the window film.  A word of advice, don’t try to apply a large piece of film by yourself.  It was an epic fail and we will never mention it again.

Ignoring my own advice, I decided to be a little smarter this time while applying the film.  After cutting the film, I peeled back the liner an inch on each corner and secured it to the counter with scotch tape.  I removed the rest of the liner and applied the adhesive spray to the film.  Next, I simply laid the plexiglass down on top of the film and trimmed to size.

Flipping the control panel over, I proceeded to smooth out the film per the instructions on the box.  The results are a little rough, but exactly what I expected.  I applied the mirror film directly to protective cover on the plexiglass, so I could easily remove it and not ruin another sheet of plexiglass.

Overall this was a successful test and very educational.

 

I need to call our vinyl graphics guy and see what options are available and have it decal wrapped like a car.  It would be the most professional looking solution.