Aquarium Controller Help

Hello all first time poster here on the forums.Am currently looking to get back into Reef Aquariums since my 3yr old is getting into the saltwater fish.I have been following various threads at different places but unfortunately most of them use the UNO or compatible.I did however find one very promising thread that uses the MEGA instead and a touch screen.I have 3-4 questions for those of you willing to help this noob out.

  1. Is it as simple as cut and paste the code provided you change the pins?As i'd like to add a wave maker to the sketch.
    The Stilo v2.1 Sketch

  2. Would the following code copied and pasted work with it,two parts?

What i'd like to add....
PT1

/*|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  S I M P L E   O N   A N D   O F F   F E A T U R E |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/



const int ledPin1 =  A2;          // pin number for relay 1 was digital pin 2
const int ledPin2 =  A3;          // pin number for relay 2 was digital pin 8


int ledState1 = LOW;             
int ledState2 = LOW; 
long previousMillis1 = 0;        
long previousMillis2 = 0;
long interval1 = 30000;          // interval at which to blink (milliseconds) for RELAY1
long interval2 = 50000;         // interval at which to blink (milliseconds) for RELAY2

PT2

/*|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  D E F I N E  :  R E L A Y 1 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/




void relay1()  //FUNCTION TO TURN ON AND OFF RELAY 1.
{ 
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis1 > interval1) 
  { 
    previousMillis1 = currentMillis;   
    if (ledState1 == LOW)
      ledState1 = HIGH;
    else
      ledState1 = LOW;
    digitalWrite(ledPin1, ledState1);
  }
}



/*|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  D E F I N E  :  R E L A Y 2 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/




void relay2()
{
  unsigned long currentMillis2 = millis();

  if(currentMillis2 - previousMillis2 > interval2) 
  {
    previousMillis2 = currentMillis2;   
    if (ledState2 == LOW)
      ledState2 = HIGH;
    else
      ledState2 = LOW;
    digitalWrite(ledPin2, ledState2);
  }
}

Hi,
Like to see your aquarium!

I guess the reason Silo uses the Mega is so many pins for that Touch Screen LCD (Which is the most complex part of the whole thing!)..

If you already have a Mega that's fine...

I think you can cut and paste (you mean ADD to the Stilo code, right??) OK... That approach to timing (Using the millis variable) does not block other code from running.

Comments:
(1) I have a waterproof DS18B20 temperature sensor here: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=151
(2) The Stilo circuit has two transistors driven from a single resistor. This is a bad idea because if the transistors are not closely matched they will get uneven input base current. Better to use 2 resistors from the same Arduino output, one to each transistor.

Relays: I also have some :slight_smile: here: http:?.ws/relays

Let us know how your project goes...

Hi Terry,

I haven't set up my system yet but am planning on either a 30 or 40 breeder running between 36-48 LED's and possibly 6-8 moonlight LED's that will simulate the moon phases.

As far as the Transistors go I may just end up doing the two resistor as you suggested or just run a bigger fan and eliminate 1 of them.....good catch as i'm rusty still.

Placement of the code needs to be at the beginning for PT1 and somewhere in between for PT2 then correct?

Thanks

Have your shop book-marked for future purchases for a smaller build.