ReefSome Forums

Quick Search

Go Advanced

Member Login

Remember Me? Not registered? | Forgot Password
 
Register
Welcome
 
ReefSome Forums > Aquarium Setup > Lighting and Electrical » Arduino Reef Controller build
Reply
Old 04-20-2010   #1
ludnix
ludnix's Avatar
 
Administrator
Join Date: Apr 2009
Location: Eureka CA
Posts: 88
Send a message via AIM to ludnix Send a message via MSN to ludnix
Default Arduino Reef Controller build

Arduino Controller Project
I've been wanting a controller for my aquarium for a while. I'm not a fan of the 6 timers I need and no ability for basic logic control, so a controller seemed like an ideal upgrade.

I shopped around and found the Reef Keeper lite was probably the best option for my price range, but was quickly disappointed by the ridiculously high price of their modules. In order to have ethernet control, 8 outlets and the controller I would be running close to $300!

I've been taking an electronics course at my college and decided that maybe I could build a controller myself. I've seen several projects utilizing the Arduino board before so I explored that option and found there are a few other people who have written about it. The arduino board is just an open source prototyping board that has a ATMEGA328 chip on it to do basic logic control of the serveral input and output pins on the board. You can upload programs to it using a USB cable and doesn't require very much knowledge of electronics.



I want to control some outlets using the controller, so I'll be using some heavy duty solid state relays to turn the outlets on and off via the arduino board. A relay is just a device that switches a connection open or closed depending on whether or not it's getting any voltage. The solid state relays I'm using will completely the connection of the outlet to the 120v power from the wall when I apply a small amount of voltage to the relay using the arduino. If you're familiar with an Auto Top Off device, they typically have a mechanical relay to switch your dosing pump on and off. This is similar except i'm using a solid state relay rather than a mechanical one. The benefit is that solid state relay is totally silent whereas the mechanical relays have a distinct clicking sound when they switch on or off. Solid State Relays are also much faster than mechanical relays.



In this picture I'm turning on an outlet using the arduino to switch the relay on and off.

In order to use the controller without my computer I will need a LCD screen to display information and menu options. I'm using a 4x20 character LCD.


In this picture you can see the LCD wired directly to the arduino and a Real Time Clock breakout board. The Real Time Clock will keep the time so the arduino knows when to turn certain relays on and off.

I also want to monitor temperatures of my tank and frag tank, so I have connected 2 temperature probes to the arduino:



With the temperature probes I can monitor the tank temperature as well as setup scenarios for the controller to maintain the temperature. I can easily have it turn fans on or off depending on temperature, or control a heater with it.

More to come:
I'm awaiting shipment for a few items:
  • Ethernet shield - Control unit through internet web server.
  • 16 button keypad - Input data into controller as well as control menu options.
  • Integrated Circuit for controlling LCD - Reduce number of input/output pins going to arduino to leave more room for probes and relay control.
  • Acrylic Box for unit and power strip.

I'll be updating this thread as I continue with the project. I'll try to post a clear and concise walkthrough of the project and a price sheet as well. I'd be happy to answer any questions about the project!
__________________
Aquariums: 120 gallon with 40 gallon sump.
ludnix is offline   Reply With Quote
Old 04-20-2010   #2
TitusvilleSurfer
TitusvilleSurfer's Avatar
 
Administrator
Join Date: Jun 2009
Posts: 86
Default

This is shaping up to be a great project, I'm very interested to see what you save.
__________________
Aquariums: 55g fresh, salt and marine biology degree in research phase.
TitusvilleSurfer is offline   Reply With Quote
Old 04-21-2010   #3
ludnix
Threadstarter
ludnix's Avatar
 
Administrator
Join Date: Apr 2009
Location: Eureka CA
Posts: 88
Send a message via AIM to ludnix Send a message via MSN to ludnix
Default

It's hard to say exactly, I'll be able to make a closer estimate once the project is finished, but here's a the price of what my end product should be similar to when I'm done if I had bought a reef keeper:

RKL: $99 (main module + 4 outlets)
SL1: $79.99 (second temperature probe)
NET: $119.99 (ethernet)
PC4: $89.99 (total of 8 outlets)
MLC: $69.99 (LED moon like controller)
Temperature Probe: $19.99
------------------------------------
Total: ~$480

There are some issues with that estimate, for instance, it would be impossible to actually use those all together on a reef keeper lite, which has a limit of 4 modules. You would need to upgrade to a Reef Keeper elite, but I went ahead and ignored that for the price since I would ignore the MLC if I was actually buying it (but since I'm making it I might as well make realistic moon light leds since I already know how easy it will be).

So here's the price estimate for my project, shipping is not included as it wasn't with the reef keeper estimate and I should be pretty insignificant in comparison to entire project cost. I end up spending more on the project than necessary because I didn't order everything all at once or shop around very much. If you had to purchase a soldering iron or solder it would also add to the project cost (about $20), but I had some stuff laying around.

Arduino starter kit: $42 (arduino, jumper wires, half bread-board)
Temperature sensors 2x: $7.90 (Maxim will send you some samples for free which would be fine to use)
20x4 LCD: $15.95
Potentiometer: $1.95 (controls LCD contrast)
Magnet: $.95 (trigger reed switch)
Reed Switch: $1.65 (turn stand light on and off)
I2C board for LCD: $13.95 (reduce wires to LCD)
RTC: $7.95 (Real Time Clock, keep track of time)
SSR (8x): $50 (Solid State Relays, Power outlets on and off)
DJ power center: $30
Keypad: $7
Ethernet shield: $24
-------------------------
Total: ~$154

While you can't really compare these two on equal grounds, for what I want my controller to do that is a good price difference. The reef keeper has an advantage of supporting a pH module because of the SL1, I have little interest in monitoring pH at this time so I haven't started working on that in my build, but the cost for that would be very minimal.

I will at some point have to build a a housing for my device (planning on black acrylic) so that will add to the cost a bit.
__________________
Aquariums: 120 gallon with 40 gallon sump.
ludnix is offline   Reply With Quote
Old 04-22-2010   #4
TitusvilleSurfer
TitusvilleSurfer's Avatar
 
Administrator
Join Date: Jun 2009
Posts: 86
Default

It seems you have a lot of elbow room before you hit the 50% off mark so I wouldn't sweat the cost of the case too much. Keep up the great work!
__________________
Aquariums: 55g fresh, salt and marine biology degree in research phase.
TitusvilleSurfer is offline   Reply With Quote
Old 05-16-2010   #5
ludnix
Threadstarter
ludnix's Avatar
 
Administrator
Join Date: Apr 2009
Location: Eureka CA
Posts: 88
Send a message via AIM to ludnix Send a message via MSN to ludnix
Default

I've expanded my project to control 16 outlets and utilize an arduino mega instead of the smaller arduino duemilanove. There difference between the two is processing power and memory (thought neither are a concern for this project) and most importantly the number of I/O ports on the board. The original arduino had 11 I/O ports, the mega has 54. That means I can control either 54 relays, sensors, leds, etc.

With so many more I/O ports I'm able to monitor and control much more than previously. So i've decided to control 16 outlets rather than 8 as previously planned.

I also got my keypad working with the controller, and LCD. Here's a picture of them all playing together with the new arduino mega:


I already painted and applied the vinyl decals to my keypad as planned, but I need to get a picture of it still. So far it's all coming along nicely though.
__________________
Aquariums: 120 gallon with 40 gallon sump.
ludnix is offline   Reply With Quote
Old 1 Week Ago   #6
ludnix
Threadstarter
ludnix's Avatar
 
Administrator
Join Date: Apr 2009
Location: Eureka CA
Posts: 88
Send a message via AIM to ludnix Send a message via MSN to ludnix
Default Posting pictures of my controller later today!

Here's the code I'm using for using both temperature probes on one wire.

PHP Code:
#include <LCDI2C.h>
#include <WProgram.h>
#include <Wire.h>
#include <OneWire.h>
#include <DS1307.h>
#include <DallasTemperature.h>
#include <pitches.h>

//LCD
LCDI2C lcd LCDI2C(4,20,0x4C,1);

//CLOCK
int ampm// variable for AM or PM
int hour;

//KEYPAD
int keyInput;

//TEMPERATURE
#define ONE_WIRE_BUS 23                 //data wire for temperature probes.
#define TEMPERATURE_PRECISION 9
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress insideThermometeroutsideThermometer;

//MODES
int mode;

//BUZZER
int melody[] = {
  
NOTE_G7NOTE_F7,NOTE_E7NOTE_E7NOTE_F7,00NOTE_A6,NOTE_G7,NOTE_F7,NOTE_E7,NOTE_E7,NOTE_E7,NOTE_F7,0,NOTE_D7,NOTE_E7,NOTE_A6,NOTE_A6};
int noteDurations[] = {
  
44444,4,4,4,4,4,4,4,4,4,4,4,4,4,};

void setup()
{
  
//CLOCK
  /* set the time
  RTC.stop();
  RTC.set(DS1307_SEC,0);        //set the seconds
  RTC.set(DS1307_MIN,32);     //set the minutes
  RTC.set(DS1307_HR,2);       //set the hours
  RTC.set(DS1307_DOW,6);       //set the day of the week
  RTC.set(DS1307_DATE,16);       //set the date
  RTC.set(DS1307_MTH,4);        //set the month
  RTC.set(DS1307_YR,10);         //set the year
  RTC.start();
  */
  
   //TEMPERATURE PROBES
  
Serial.begin(9600);
  
sensors.begin();
  if (!
sensors.getAddress(insideThermometer0));
  if (!
sensors.getAddress(outsideThermometer1));
  
sensors.setResolution(insideThermometer9);
  
sensors.setResolution(outsideThermometer9);  

   
  
//LCD
  
lcd.init();
  
lcd.clear();
  
BackLight(150);
  
}

//FUNCTIONS

//TEMPERATURE
void printAddress(DeviceAddress deviceAddress)
{
  for (
uint8_t i 08i++)
  {
    
// zero pad the address if necessary
    
if (deviceAddress[i] < 16Serial.print("0");
    
Serial.print(deviceAddress[i], HEX);
  }
}
void printTemperature(DeviceAddress deviceAddress)
{
  
float tempC sensors.getTempC(deviceAddress);
  
lcd.print(DallasTemperature::toFahrenheit(tempC));
}
void printData(DeviceAddress deviceAddress)
{
  
Serial.print(" ");
  
printTemperature(deviceAddress);
  
Serial.println();
}

void loop()
{
  
//KEYPAD
  
keyInput=lcd.keypad();
  
  
//MODES
  
mode lcd.keypad();
  
  
//TEMPERATURE PROBES
 
sensors.requestTemperatures();
 
 
//LCD
 
lcd.setCursor(0,0);
 
lcd.print("Aquarium Controller");
 
lcd.setCursor(1,0);
 
lcd.print("Main: ");
 
printData(outsideThermometer);
 
lcd.print((char)223); //print degree symbol °
 
lcd.print("F");
 
lcd.setCursor(2,0);
 
lcd.print("Frag: ");
 
printData(insideThermometer);
 
lcd.print((char)223); // print degree symbol °
 
lcd.print("F");
 
lcd.setCursor(3,0);
 if(
RTC.get(DS1307_HR,true) > 12){
 
hour RTC.get(DS1307_HRtrue) - 12;
 
ampm 2;
 
lcd.print(hour);
 }else{
 
ampm 1;
 
lcd.print(RTC.get(DS1307_HR,true));
 }
 
lcd.print(":");
 if(
RTC.get(DS1307_MIN,false) < 10){
   
lcd.print("0");
 }
 
lcd.print(RTC.get(DS1307_MIN,false));
 if(
ampm == 2){
 
lcd.print("PM ");
 }else{
 
lcd.print("AM ");
 }
 
lcd.setCursor(3,16);
 
lcd.print(keyInput,DEC);
 
lcd.print(" ");

 if(
RTC.get(DS1307_HR,true) > 21 || RTC.get(DS1307_HR,true) < 6){
   
BackLight(50);
 }else{
   
BackLight(150);
 }

if (
mode==101){
 
lcd.clear();
 
lcd.setCursor(0,0);
 
lcd.print("Page 2");
}
}

//MORE FUNCTIONS
void BackLight(uint8_t bright){
  if(
bright 150)
      
bright 150;
  
Wire.beginTransmission(0x4C);
  
Wire.send(0xFE);
  
Wire.send(0x03);
  
Wire.send(bright);
  
Wire.endTransmission();
  
delay(50);
  
}
//  Default 15
void Contrast(uint8_t SetTo)

  if(
SetTo 100){
      
SetTo 100;
  }
  
Wire.beginTransmission(0x4C);
  
Wire.send(0xFE);
  
Wire.send(0x04);
  
Wire.send(SetTo);
  
Wire.endTransmission();
  
delay(50);

__________________
Aquariums: 120 gallon with 40 gallon sump.
ludnix is offline   Reply With Quote
Old 1 Week Ago   #7
ludnix
Threadstarter
ludnix's Avatar
 
Administrator
Join Date: Apr 2009
Location: Eureka CA
Posts: 88
Send a message via AIM to ludnix Send a message via MSN to ludnix
Default

As for an update as to where the project stand, I finished building the first relay box with power outlets. I am planning to use ethernet cable to signal the relays on and off and will need to install an ethernet port in the arduino box before I can test it out. I am concerned about running 5v through ethernet cable though.
__________________
Aquariums: 120 gallon with 40 gallon sump.
ludnix is offline   Reply With Quote
Old 1 Day Ago   #8
TitusvilleSurfer
TitusvilleSurfer's Avatar
 
Administrator
Join Date: Jun 2009
Posts: 86
Default

I would be very concerned with 5v running through Ethernet. It is intended for microvolts! Why can't you use standard wire?

P.S. You have done and incredible job so far. Really pushing the bar.
__________________
Aquariums: 55g fresh, salt and marine biology degree in research phase.
TitusvilleSurfer is offline   Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump