View Single Post
Unread 09/16/2013, 10:13 PM   #1
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
My Neptune Apex web interface compatible DIY reef controller

I'm starting this thread to document and share the progress of my controller build. I have been working on this for 1.5 years now and is still a work in progress. I have been using this on my tank since April 2013. I initially planned on getting an Apex controller, but it does not contain some features I need. Apex feed mode cannot be run on a schedule, it only has input lines (no output), no water level sensor, and no built it support for auto feeder (I think they are coming out with one for $99).

Objective:
To build a reliable, compact, simple, low cost, web based interface aquarium controller.

Description/Features:
Base Features:
8 outlet aquarium controller using Chauvet SR-08 relay packs.
Web based user interface optimized for mobile browser (Neptune Apex compatible).
Water level sensor using SR04 ultrasonic sensor (for top off water).
http://reefcentral.com/forums/showthread.php?t=2328819
Auto Feeder using hacked Aqua Chef feeder.
http://reefcentral.com/forums/showthread.php?t=2327962
Can run a Feed cycle on schedule.
Time is synchronized with NTP server and DS1307 RTC module.
Automatic daylight savings time adjustment of time.
ph sensor.
Temp sensor.
Two ATO switches.
Sound and Email alert.
Outlets, Sensors and Web access logging.

Mobile Client app features:
View and control outlets.
View chart of sensor data for last 24 hours.
View logs for any day since logging started.
Modify controller program schedule.
Calibrate ph probe.
Manage SD card files (currently supports file delete only).

Optional Features:
Can be expanded with another unmodified Chauvet SR-08 to add another 8 outlets.
Two channel PWM 0-10v variable output. (hardware implemented, no software yet).
LCD display. (implemented)

The original design includes an X10 interface so I can use my old AC jr DC-8, but had since dropped that feature. The PWM I originally intended for controlling LED lights, but I have since bought a Maxspect Razor so PWM is currently unused. I may use it someday when I get a controllable pump.


Main Parts Needed:
Chauvet SR-08 Relay pack.
8 channel 5v relay module.
Arduino Mega2560.
Ethernet Shield.
Atlas ph stamp.
DS1307 RTC module.
DS18B20 Temp sensor.
ph probe.
BNC connector.
Aqua Chef feeder.
BC327 PNP transistor and 4.7k, and 47K resistors and 1N914 diode.
12v 1A power adapter.
5v 1A power adapter (USB charger).
5mm LED and 220ohm resistor.
Piezo buzzer.
micro SD card. (4GB will store your logs forever).
assorted jumper wires, pin connectors male and female , stereo and 4 pole plugs and jacks, prototype board, soldering equipment, switches, etc.

Optional Additional Parts:
For 8 outlet expansion
Another Chauvet SR-08.
DB-9 breakout module (Sparkfun 8552)
ULN2803 Transistor Array.
DB9 cable (male to female).

For PWM output
LM358 and 4 10k resistors. For 0-10v variable DC output.

For LCD Display
1602 LCD with I2C backpack. You can display a lot of stuff on 16x2 if you get creative.

Depending on where you source your parts, the base unit will cost around $150 and definitely under $250 with the optional parts. I got all my parts from Ebay, Tayda Eletronics, and Sparkfun.


Software Features:
The software consists of the arduino code, and an html5/javascript code that runs on mobile web browser. The outlet schedule processing is done via timer interrupts. Each outlet is updated once per second, guaranteed. I use a very simple, efficient and compact algorithm to define the outlet schedule programming.

The main loop executes less time critical tasks at 60 hz (60x per second or once every 16ms) like logging outlet switch events to SD file, updates LCD, update ph, temp and sonar readings. The ph, temp and sonar readings use an 8 reading rolling average to smooth out the values.

Input lines use pin change interrupts. Ultrasonic sensor echo pulse, Feeder home position indicator (to stop feeder rotation), generic IO open and close all use pin change interrupt. ATO uses timer interrupt to poll once per second.

I also have a timer interrupt based audio beep code for the controller to provide an audio confirmation when commands are received by the controller from the mobile app.

The web server code is based on TinyWebserver. I modified it to use SdFat library and to read and write faster (using buffered reads and writes). I also added basic web authentication code to prompt web connections for a username and password. TinyWebserver is nice that it has code for uploading your files to the SD card.

The mobile web interface is compatible with Neptune's Apex controller. This means, my htm file will work with Neptune Apex controllers. See http://reefcentral.com/forums/showthread.php?t=2306409. Someday when I get an Apex, I will have a nice mobile html app to use. The web page also displays live video stream from a Foscam compatible camera. It is a single htm file written in html5 and javascript using jquery mobile library.

Files for this project are available on github at
https://github.com/d0ughb0y/Chauvet16


d0ughb0y is offline   Reply With Quote