Arduino Forum

Forum 2005-2010 (read only) => Software => Interfacing => Topic started by: Harlequin on Mar 30, 2010, 05:14 pm

Title: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Mar 30, 2010, 05:14 pm
Hello Folks, New to both Arduino and the forum so please be nice.

firstly alittle bit about this project: I'm an avid marine/reef keeper, and always love dabbling with 1 DIY project or another. My last project was building a DIY LED rig (you've probably seen tonnes of them). Now the next step up from this is to add an Arduino to control it via PWM. It was researching the LED build that brought my attention to ardiuno's and everything else possible with them. after spending many an hour googling, it looks like theres a few Arduino based controllers and decided i wanted to build my own.
Intial plans is to build a controller which controls the LED's and the light cycle and display them via a LC. Then from here include temp probes, and other things vaguely interesting.

Alittle bit about myself: as i mentioned above im an avid reef keeper, Im also 20, Male, British, love getting my hands in and always been the kind of person to rip something apart jsut to see how it ticks.

Im currently studying Biology and Computer Science at University and am in my first year. as part of my computer course im learning the programming language JAVA, which was another reason why i picked up an arduino because i thought it might be an interesting self teaching exercise. Im aware that arduinos are programmed in C/C++ but as you probably know, java came out of C++ and is very similar in some respects. so i have "some" consept of Object orientated programing and pick new stuff up pretty easy.

I currently have an Arduino Mega and 2 LCD with 5 button keypad shields (though 1 is broken and can only be used as a "3" button keypad)

Right still with me?


good.

because i've had limited time recently i havent had a chance to do much hardware work on the arduino (i.e. intergrating the buckpuck's) and have instead turned my attention to trying to create  and menu and try and link the keypad coding with the LCD display coding.

my main issue is ... well everything  :-/ ok not quite.

firstly i put most of my coding inside of Loop() method calling various methods etc but the big issue i have is the code is cycling through the code adn telling the LCD to rewrite itself over adn over, which gives an awful looking program which flickers constantly as the LCD rewrites itself.

now one way i managed to get past that was to run the cycle first then put a Delay() at the end. Issue with this is, if your stuck in a delay period (say 5 second) you cant input any data (i'll get onto the keypad programming later) the second option was to use a While loop and a boolean to run it once then only run it if the boolean value has been "reset" at another point.

before people shout, yes i have done some googling, on menu tutorials but cant really find much help. Also this is going to be a big ongoing project so i thought it was worth creating its own thread.


Well i think that covers everythign for the moment.  hope that wasnt too much and i appricate any help or suggestions people offer.

Im new to arduinos, the program language C++ and i've only been doing java for a semester.

cheers

Luke
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Mar 30, 2010, 05:15 pm
(sorry for the double post, but i wasnt able to post links without posting atleast 1 message)

for those interested here is the LCD+keypad shield i have, on retrospect i think it might have been easier to buy a seperate LCD and keypad, for coding. and if it is i might buy a seperate one anyhow.

(http://www.ekitszone.com/images/thumbs/0000013_300.jpg)
http://www.ekitszone.com/Products/3-lcd-keypad-shield-for-arduino.aspx

one imeidate issue i can see with this shield as it covers all the PWM ports, so i'd have to use jump leads etc anyhow to connect it in the final project and while prototyping.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: cjparish on Mar 30, 2010, 05:27 pm
If the LCD is visibly flickering then the chances are that you are clearing the LCD screen on each loop. Simply removing the clear statement and just overwriting will get rid of the flicker.

Also, if the sheild is blocking the pins then just make yourself some leads to connect it instead of plugging it straight in on top of the arduino.

What are you hoping to achive with the Aquarium Reef Controller?

Can't really do much more without seeing your code; any chance you could post it?

Chris
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Mar 30, 2010, 05:45 pm
hello Chris thank you for your qucik reply, where to begin..



unfortunatly i dont have my coding to hand, it wasnt anyhting special as its on my old pc (i got a new laptop a few days a go) but when i get a moment i'll pull it off the old pc.

I'll write sone new coding now to show you some of the things i've been thinking. it wont take me that long and i'll post it up once i have it, so far all teh coding ive done todate has just been messign around to see if i can get different ideas to work. so i dont really have much todate. but like i said i'll load some up once i've wrote "as far" as i can get .. if that vaguely makes sense.

the first thing i'd like it to control is all the lighting, (i copied and pasted this off my tank thread on anothe forum)


Lighting:-

Fade in
Fade out
enable user to input the photo period
enable user to set max light intensity
possibly simulate lunar cycle
possibly simulate varying weather conditions (i.e. cloud cover, stormy, you get the idea)
possibly have an Acclimatization mode which reduces the lights and then slowly ramps them back up.

i want the user to be able to enter values via the keypad so i dont have to plug the thing into a computer i want to make it "stand alone" if that makes sense.

other ideas i have floating around once ive got the lighting down.

Monitoring:-

Monitor Tank temperature.
Monitor LED lighting unit temperature.
possibly monitor PH
possibly monitor salinity
do retrievable data logging.

and possibly build my own power bar using relays etc to control pumps on and off etc.

hope that vaguely makes sense, i know its alot and its very ambitious but hey it keeps me out of trouble  :P.

i'll creat some mock ups and stuff now and post them, up.

some of the better/more complete controllers are this one :

http://delicathdesigns.com/LED/?p=1

and

http://reefprojects.com/wiki/Main_Page

Luke

(oh i also know at some point i'll need to order a RTC for the time inputs, but for now i was just going to use delay() ... maybe )

Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: cjparish on Mar 30, 2010, 05:54 pm
Hi Luke,

That look like an interesting project. I have a freshwater tank myself and you have got me thinking about the automation possabilities.

All the temperature monitoring should be really easy, the difficult point is deciding which of about ten million methods to use! :D

I look forward to seeing your code, and I hope I can help you with your project.

Keep us posted!

Chris
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Mar 30, 2010, 06:08 pm
example of the menu system i'd like to do

Start up:-
                         [   REEF MINDER  ]
                         [  VERSION  1.00 ]

Idle screen:-
                        [TEMP:25*C  12:30]
                        [WHT:100  BLU:100]

Menu Screen:-
                        [1. SET LIGHTS   ]
                        [2. VIEW PERAMS  ]

                        [3.DO OTHER STUFF]
                        [4.DO OTHER STUFF]

then if the user "selected" set lights/option 1 it would lead to these screens:-

                      [1. SET INTENSITY]
                      [2. SET TIMEPEROD]

if the user then selected set intensity :

                     [ SET BLUE MAX   ]
                     [         XXX %  ]
                                      |
                                      | user then presses select/next
                                      |
                                     \ /
                    [ SET WHITE MAX  ]
                    [         XXX %  ]
                                      |
                                      | user then presses select/next
                                      |
                                     \ /
                   [   LIGHTS SET   ]
                   [                ]
                                      |
                                      |  
                                      |
                                     \ /
                short delay then back to menu
                   




Thats sort of what im aiming for, in my "mock" screen i was going to use a switch statement/ while loop, then depending on what key is pressed at what time in the program it sets the variable/case to the corisponding menu screen which gets loaded,

anything highlighted in red, would need to be constantly updated. the temp from a temp probe, the time from the RTC, the light intensitys on the LCD screen would be a variable which would change when the user pressed up or down when in the "set blue max" etc...

that make sense?
;D :o



edit: just sene your reply chris, thats brilliant someone who actually vaguely understands what i plan to do ! i know temp measurement should be relatively easy, wait till i get to dosing pumps and Auto top off devices XD. like i said though i dont have much codea s i dont really know where to begin, i assume my first step would be to get a "scrollable/interactive" menu system adn go from there?

(and for the record i have a 125ltr Fresh water at my mums, a 4ft Full reef 300 ltr system at my dads and my hose, and a 20 ltr marine pico, which this controllers for, if it gets goign i'll build one for the other reef tank)





Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Imahilus on Mar 30, 2010, 06:30 pm
The technique you're looking for is called a "state machine".
While the arduino supports some object orientated programming, you're still mostly doing procedural programming.

A state machine is the thing to use in these situations.
Essentially, your menu would have 3 or 4 states.
1. (default) display data
if button is pressed, go to state 2
2. display the basic menu options
if button is pressed, either change the selection or go to the state of the selected item
3. light intensity was chosen, button up raises the intensity displayed, button down lowers it. the select button changes the output, has a delay, and returns to state 1.

Now I won't do your work for you and put it into actual code, but I hope you get the idea now  :)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Mar 30, 2010, 07:12 pm
sounds about right to me Imahilus, i shall do some googling/reading up. thank you.

it sounds vaguely what i had in mind with my While statements or more should i say thats what i wanted to do. thanks.

just writing some coding and see where im at, you were right Chris, i was clearing the menu at the start of the loop which caused the flickering. Just writing up a new piece of code tonight and i'll post it once im done

Luke
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Mar 30, 2010, 10:48 pm
Ok so heres some rough coding i knocket together this evening, Its not pretty, its probably not effiecent but its what first came to mind for me that worked.

its just the various "menu" screens or cases, i need to somehow interface the button pad coding into this exisiting coding.

oh and if your wondering why theres 2 of everything its because one has an asterix "*" at the end, this is the way i decided to show which option is "selected".

i looked at the Display blink tutorial in the arduino folders and would like to have a blinking cursor at the end instead of using a asterix but i figured if i used the delay method it used then i could see problems with how the program runs.

its not much but you get the idea.

next step is implimenting the actual keypad. i wrote psudo code in each method sawing what i want to happen when each butten is pressed.

Code: [Select]
#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);//delares the LCD Pins for the liquidCrystal library methods.
int x = 0;//Used for testing purposes to show the LED strength
int menuOption = 3;//used for the Switch statement, each menu has its own value,
int tankTemp = 25;//used for testing purposes, in real build this value with come from a temp probe
int timeHour = 12;//used for testing purposes, in real build RTC wil give this value
int timeMinute = 30;//used for testing purposes, in real build RTC wil give this value
//-----------------------------------------------------
void setup() {//ran once AKA welcome screen
 lcd.begin(16, 2);//sets the LCD screen dimentions up
 lcd.print(" Reef Minder ");
 lcd.setCursor(0,1);
 lcd.print("by Luke V1.00");
 delay(5000);
 lcd.clear();
}
//-----------------------------------------------------
void loop() {
 switch(menuOption){//loads each menu depending on what value "menuOption" has at the start of the loop.
   
   case 1:  mainMenuOneOne();break;
   case 2:  mainMenuOneTwo();break;
   
   case 3:  mainMenuTwoOne();break;
   case 4:  mainMenuTwoTwo();break;
   
   case 5:  setIntensityOne();break;
   case 6:  setIntensityTwo();break;
   case 7:  setIntensityThree();break;
   
   case 8:  setLightsOne();break;
   case 9:  setLightsTwo();break;
   
   case 10: setTimePeriodOne();break;
   case 11: setTimePeriodTwo();break;
   
   default: idleMenu();break;
 }  
}
//-----------------------------------------------------
void idleMenu(){//case 0
 //this is the idle screen which will be the ran as default, when the user hasnt pressed anything, after X amount of time if the user hasnt pressed anything load this menuOption
 lcd.setCursor(0,0);
 lcd.print("Temp:"); lcd.print(tankTemp);  lcd.print("*C ");//temp half, top line
 lcd.print(timeHour); lcd.print(":"); lcd.print(timeMinute);// time half, top line
 lcd.setCursor(0,1);
 lcd.print("WHT:");lcd.print(x);lcd.print(" BLU:");lcd.print(x);
 if(x <100){//used in testing, real value will come from the led's/set by the user in the SET intensity menu option
   x++;
   delay(5000);
   lcd.clear();
 }
 //If any button pressed, load mainMenuOne()/ menuOption = 1;
}
//-----------------------------------------------------

void mainMenuOneOne(){ //case 1
 //main menu,
 lcd.setCursor(0,0);
 lcd.print("1.SET LIGHTS   *");
 lcd.setCursor(0,1);
 lcd.print("2.VIEW PERAMS");
 lcd.setCursor(0,0);
   
   
 /*if V pressed load menuOptionOneTwo();
   if ^ pressed do nothing
   if < pressed load idleMenu()/ menuOption = 0;
   if > pressed load setLightsOne();/ menuOption = 8;
   if * pressed load setLightsOne();/ menuOption = 9;
 */
}
void mainMenuOneTwo(){ //case 2
 //main menu,
 lcd.setCursor(0,0);
 lcd.print("1.SET LIGHTS");
 lcd.setCursor(0,1);
 lcd.print("2.VIEW PERAMS  *");
 lcd.setCursor(0,0);
 
   
 /*if V pressed load menuOptionTwoOne()/menuOption = 3;
   if ^ pressed load menuOptionOneOne()/menuOption = 2;
   if < pressed load idleMenu()/menuOption = 0;
   if > pressed load viewPerams(); not coded yet
   if * pressed load viewPerams(); not coded yet
 */
}
void mainMenuTwoOne(){// case 3
 lcd.setCursor(0,0);
 lcd.print("3.BLANK        *");
 //flashing pixel
 lcd.setCursor(0,1);
 lcd.print("4.BLANK");
 lcd.setCursor(0,0);


 /*if V pressed load menuOptionTwoTwo()/menuOption = 4;
   if ^ pressed load menuOptionOneTwo()/menuOption = 2;
   if < pressed load idleMenu()/menuOption = 0;
   if > pressed load 3rd menu;/not coded yet
   if * pressed load 3rd menu()/not coded yet
 */
}

void mainMenuTwoTwo(){// case 4
 lcd.setCursor(0,0);
 lcd.print("3.BLANK");
 lcd.setCursor(0,1);
 lcd.print("4.BLANK        *");
 //flashing pixel
 lcd.setCursor(0,0);


 /*if V pressed do nothing;
   if ^ pressed load menuOptionTwoOne()/menuOption = 3;
   if < pressed load idleMenu()/menuOption = 0;
   if > pressed load 4rd menu;/not coded yet
   if * pressed load 4th menu();/not coded yet
 */
}

//----------------------------------------------------

void setLightsOne(){// case 8
 lcd.setCursor(0,0);
 lcd.print("1.SET INTENSITY*");
 lcd.setCursor(0,1);
 lcd.print("2.SET TIMES");
 lcd.setCursor(0,0);


/*if V pressed load setLightsTwo()/menuOption = 9;
   if ^ pressed do nothing
   if < pressed load idleMenu()//menuOption = 0;
   if > pressed load setintensityOne()/menuOption = 5;
   if * pressed load setLightsTwo()/menuOption = 9;
 */
}


void setLightsTwo(){//case 9
 lcd.setCursor(0,0);
 lcd.print("1.SET INTENSITY");
 lcd.setCursor(0,1);
 lcd.print("2.SET TIMES    *");
 //flash pixel
 lcd.setCursor(0,0);


/*if V pressed do nothing;
   if ^ pressed load setLightsOne()/menuOption = 8;
   if < pressed load mainMenuOneOne()/menuOption = 1;
   if > pressed load setTimeOne()/menuOption = 10;
   if * pressed load setTimeOne()/menuOption = 10;
 */
}

//----------------------------------------------------
void setIntensityOne(){// case 5
 lcd.setCursor(0,0);
 lcd.print("1. SET BLUE MAX");
 lcd.setCursor(0,1);
 lcd.print("   100%");
 lcd.setCursor(0,0);
 
 
  /*if V pressed value-- While => 0;
   if ^ pressed value++ while <= 100;
   if < pressed do nothing;
   if > pressed load setIntenistyTwo()//menuOption = 6;
   if * pressed load setIntenistyTwo()/menuOption = 6;
 */
}

void setIntensityTwo(){//case 6
 lcd.setCursor(0,0);
 lcd.print("1. SET WHITE MAX");
 lcd.setCursor(0,1);
 lcd.print("   100%");
 lcd.setCursor(0,0);
 
 
 /*if V pressed value-- While => 0;
   if ^ pressed value++ while <= 100;
   if < pressed do nothing;
   if > pressed load setIntenistyThree()/menuOption = 7;
   if * pressed load setIntenistyThree()//menuOption = 7;
 */
}

void setIntensityThree(){//case 7
 lcd.setCursor(0,0);
 lcd.print("LIGHTS SET");
 lcd.setCursor(0,1);
 delay(5000);
 lcd.setCursor(0,0);
 menuOption = 1;


 /*if V pressed do nothing;
   if ^ pressed do nothing;
   if < pressed do nothing;
   if > pressed load mainMenuOne()/menuOption = 1;
   if * pressed load mainMenuOne()/menuOption = 1;
 */
}
//-------------------------------------------------  
void setTimePeriodOne(){//case 10
 lcd.setCursor(0,0);
 lcd.print("1.SET START    *");
 lcd.setCursor(0,1);
 lcd.print("2.SET END");
 lcd.setCursor(0,0);
 
 /*if V pressed load setTimePeriodTwo()/menuOption = 11;
   if ^ pressed do nothing;
   if < pressed load setLightsTwo()/menuOption = 9;
   if > pressed load setStartTime/not coded yet;
   if * pressed load setStartTime)/not coded yet
 */
}

void setTimePeriodTwo(){//case 11
 lcd.setCursor(0,0);
 lcd.print("1.SET START");
 lcd.setCursor(0,1);
 lcd.print("2.SET END      *");
 lcd.setCursor(0,0);

  /*if V pressed do nothing;
   if ^ pressed load setTimePeriodOne/menuOption = 10;
   if < pressed load setLightsTwo()/menuOption = 9;
   if > pressed load setEndTime/not coded yet
   if * pressed load setEndTime)/not coded yet
 */
}
//-------------------------------------------------

Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 12, 2010, 01:08 pm
Hi Harlequin, I'm undergoing the same project as you so I'd thought I'd drop by. I'm still playing around with with the LCD and temperature probes at this point, so I'm still in the beginning. I'm currently working on getting a reading from two dallas temperature probes (DS18B20 in Parasite Mode) from the same pin using the onewire library.

I'm awaiting a real time clock and serial i2c for my 20x4 LCD screen. The clock will let me set the times for turning my lights on and off and the i2c will prevent the LCD from taking up so many of my precious i/o ports. I also need to buy a keypad to control it, but I haven't found one that I was particularly enthusiastic about yet.

I'm implementing mine into a running 120g tank. I'm using solid state relays to power on the lights or pumps which is where my project will vary a bit from your LED controlling.

I'll be looking forward to seeing how you go about the project, it's reassuring to see other's attempting the same project.

Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 12, 2010, 03:16 pm
Hello Ludnix,

thanks for swinging by, this project hasnt gone any further since i last posted code wise as i've been too busy, Infact i was just about to sitdown and try and do some more coding. hense why i checked here.

looks like your further along then i am Ludnix as i've just started my project really, I've yet to order my RTC and also some Temp probes etc.

And then if i get that far, to work on solid state relays =]

you'll have to excuse my ignorance but whats "parasite mode" this is all completely new technology to me =].

about 3 hours later.....
-------------------------------------------------------------------------------

Well i just had a rather sucessful few hours coding, managed to synq my keypressed recognition coding with my menu coding.

just need to write it up and i'll post some coding later tonight.


Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 12, 2010, 05:42 pm
pretty awful video can be seen here:
http://s290.photobucket.com/albums/ll272/jarvophoenix/?action=view&current=VID00036-20100412-1613.flv

(note, play it quietly as the sound quality is pretty awful and i had music playing int he background)

its no where near finished but atleast i've got over the huge hurdle that was interfacing the menu and the keypad input, i was struggling with calling the menus at the right time and when to "listen" for a keypress and what to do, got it sorted now though.

And for the record "phoenix" is the user name i go by on some of the fish forums i frequent.


all in all im pretty pleased with my progress, i kinda had a "if i did it this way.... OMG Im so stupid why didnt i think of that earlier" moment ^^.

Going to place an order for a few bits and bobs soon ish i think.

looking at RTC module and a few temp probes for now.

there seems to be a few RTC's out there and also a few different temp probes, does anyone have any idea's suggestions on which to order? the temp probes will be wrapped in heatshrink probably and a dab of glue/silicone at the end to encapsulate it, unless you can think of a better idea?.

also on a semi serious thought.

i've been tinkering with the idea of data recording actually. I know you can buy SD card shields but is there a way of using one of those few hundred small USB sticks people have knocking around? like those small 128 mb ones?

looks like i need to do some googling.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 13, 2010, 01:07 pm
I assume you're familiar with this site, but it's where I'm basing my project off:
http://reefprojects.com/wiki/Main_Page

Parasite mode allows you to control several of the DS18B20 temperature probes using a single wire to the arduino (very valuable when there are so few ports!). I haven't gotten it to display the two probes I have connected separately yet, but that's really a matter of taking the time to learn the code used in the examples.

For my probes, you need a 4.7k resistor on the +5v lead, so I wired it all up and heat shrunk it. I then put it in a tube you can get at the pet store. It's like rigid air line tubing only slightly larger, then epoxied the ends closed.

I have all my relays now, but I'm still waiting on the RTC to arrive and the serial connector for the LCD.

How do you intend to control your other component with the LCD shield on the arduino? Can you control the relays and LCD on the same I/O ports? I have seen port doublers for sale, but I have no idea how the coding works or circuitry.

Here's a picture of my LCD running. I'm planning on building a black acrylic box to put the LCD and keypad in. I haven't picked the keypad out yet but I'm not sure what my options are for interfacing with the arduino.

(http://www.reefsome.com/gallery/u/ludnix/arduino//thumbs/lcd-screen-800x600.jpg) (http://www.reefsome.com/gallery/focus/v/ludnix/arduino/lcd-screen.jpg)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 13, 2010, 09:44 pm
Evening Ludnix, Yes i have seen the reefproject controller before,

Firstly the use of parasite mode sounds interesting especially if its possible to isolate each sensor as i was planning of having two sensors, 1 for the light rig 1 for the display tank ( inhonesty i dont need the light rig but i might as well, they only cost a few pounds or so per sensor,

As far as the use of relays is controlled, in honesty im not sure what im going to do, Im currently using an Arduino Mega so im hoping i have enough ports. if not i'll look at other ideas,

Im just about to place an order for 5x DS18B20 sensors ( its £3.60 for 2 or £7.60 for 5)  and also place an order for a RTC module.

one thing that im alittle confused about is rewiring my LCD shield to different pins, Currenly i have it "bolted on" to the arduino ( like a true shield) but the problem is it uses up All my PWM pins, and im not entirely sure if each pin actually does something.

the LCD schematic can be found here http://www.ekitszone.com/download/lcd-keypad-schematic.pdf

could someone tell me which if any pins i can reposition to free up my PWM pins, and if any dont actually do anything... if that makes sense.

(and each time i see a blue 20 x 4 the more i think i want one)


as far as i can tell.....

the 5 pushbuttons go to the analog pin 0-4, the "reset button" and other stuff that i cant tell (led for one) takes up the 5 pins to the left of the analog pins (Reset,3v3,5v,gnd and vin)  

these are fine (for now as they arent in the way)

but the 16 pins used for the LCD display use PWM pins 0-13,gnd and AREF, now from as far as i can tell on the schematics (though im rubbish at reading them) LCD pins 7-10 which fit to ardiunio PWM pins 6-9 are blanks? so if i used jumper leads on the others but didnt conect those 4 pins that frees up 4 PWM pins for my led rig?

....
please tell me that makes any sense lol,

what i want to do is rewire the shield using protoboards and jump leads/jumpers to free up as many ports as possible.

i'm currently not using any of my Digital pins which i assume i can use if i change my code correctly?

help would be appriciated
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 13, 2010, 11:46 pm
Are you sure your LCD isn't using any digital pins? Mine is only using the +5v on the analog side of the board, otherwise it's all connected to my digital pins (2-5, 9-13).
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 14, 2010, 12:28 am
yeah My current shield uses none of the standard digital pins, but slots into all of the digital PWM pins.

I assume the input doesnt need PWM.


(http://i290.photobucket.com/albums/ll272/jarvophoenix/DSC_0724-1.jpg)
shield and arduino mega top down,

(http://i290.photobucket.com/albums/ll272/jarvophoenix/DSC_0725.jpg)

looking at the mega with the USB port to the left, analog pins facing you.

from left to right the pins that are used are as follows:-

reset
3V3
5V
GND
VIN

Anaglog IN pins 0-5

(http://i290.photobucket.com/albums/ll272/jarvophoenix/DSC_0726.jpg)

looking at the mega with the Digital PWM and Communication ports to you with the USB port to the right.

pins right to left pins used are:

AREF
GRD
PWM 13 - 8

PWM 7-0

could i simply use jumper leads to rewire all the current pins that are in the PWM to digital pins,

then rewrite the:
LiquidCrystal lcd(8, 9, 4, 5, 6, 7)

to what ever digital pins i used.

see what i mean?


now that im looking at it IF LiquidCrystal lcd(8, 9, 4, 5, 6, 7) variables are used to define the LCD, and 2 pins stick in the AREF and GND....what does pin 0-3 and 13-10?  i need to sit and read the schematic again.. but not now tomorrow when i can think straight lol
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 14, 2010, 01:29 pm
I imagine the LCD is communicating with the arduino over i2c then. I think your idea would work, but looking at the schematic should clear it up.

They do sell a pin doubler at liquid ware which would allow the shield to go over the arduino but duplicate the pins so you can actually use them. It's about $18. It might be worth considering depending on how you want to do the wiring, but it would be the same as if you just ran jumpers out to a breadboard.
http://www.liquidware.com/shop/show/DWX/DoubleWide+ExtenderShield

I got a i2c board to interface with the LCD and communicate with my arduino today. it only requires 4 wires go to the arduino, but there isn't an existing library to work with the controller yet. I'm waiting for the lcd and keypad controller to come from web4robot.com, which has a working library, but it's already been 2 weeks with no response from them.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 14, 2010, 04:26 pm
Quotes "I imagine the LCD is communicating with the arduino over i2c then."

i'll take your word for it :P, after a quick google, i ended up alittle confused and just took it at face value, my lcd is i2C haha, if anyone has a laymans explaination id appriciate it.

I had my physics/techie friend come round for lunch today and showed him my progress with the arduino which he was pretty impressed, he's pretty good at reading schematics etc and he's coming over for dinner this sunday so im sure i can pick his brains a bit more about it then, i plan to move it to some protoboards and hopefully connect up some LED's to mimic my LED rig. ( i need to steal his/my electronics bits box, most of the DIY projects i've done have been at his house so i just left all my electronics at his, resitors, led's, proto boards wire, solder etc...)

Put a bid on some DS18B20 chips (x5) earlier today so i'll probably win them, if not i'll jsut bid on the next lot until i get some. £7.60 intotal but the postage is a bit of a b***h and can take anywhere between 10-20 days, hopefully sooner. I looked around to see if there were any stockpiles in the UK i could order from but they were hellishly exspensive compaired to these ones from HK. I dont want them that badly to warent the cost.

Going to order my RTC clock in a moment as well, hopefully this will come sooner as theres a few suppliers in the uk that sell them for around £12.  just trying to think if i want anything else while i order.

Think thats about it.... wondering if i can justify buying a 20x4 plus a key...  ;D

out of interest how easy is it to make a RTC module by scrach?
I can buy the Chip and crystal for 1/3rd of the price of a prefabricated module?

I'd have to get a cell battery and holder as well but that would be no more then a few Pounds?

I wonder how difficult would it be to program/build? or should i just go ahead and buy a pre made one and save myself some trouble?

anyone got a decent DIY tutorial etc?

edit: RTC schematics from sparkfun
http://www.sparkfun.com/datasheets/Components/RTC-Module-Schematic.pdf

as long as i get these bits and bobs and have a pre programmed DS1307 chip i should be on a winner no? just seems alittle expensive for something that looks like it could be done with a few hours DIY'ing...

second edit: I dont even need a pre programmed chip... i could set the variables myself, the chip does the auto calibrate/configure for me... thats the whole point.

third edit some hours later: Won the DS18B20 chips, so i have 5 of those on the way sometime this side of 20 days the wait begins  :-?
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 15, 2010, 01:50 am
You can definitely build your own RTC, I just wanted one that was on a PCB for compact size.
I ordered mine from Futurlec, but they take a very long time to ship as well. web4robot contacted me and told me my i2c controller for my LCD will ship Monday, so at least there's progress.

I don't know if I had asked this yet, but do you have an plans for enclosing the controller? I'm thinking about using black acrylic and building my own box, but I don't have the best tools for cutting. I checked out a lot of project boxes locally, but didn't find anything appropriately sized.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 16, 2010, 11:24 am
I saw this and thought it seemed like what you were talking about:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235070596
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 16, 2010, 03:40 pm
Thanks Ludnix, that thread you posted below is perfect for what i need, going to place an order for some parts probably in a moment. as far as soldering it and keeping it compact, that shouldnt be a problem, i bet you could get it down to about the size of 1" x 2" square if not smaller, (depends how confident you are to solder on 2 sides of some curcuit board) i've done enough soldering to be prett confident on getting it down to a minimum.

Secondly, i havent given much thought to encasing it, obviously i want it as small as possible im tempted to do it in 2 boxes, 1 with the controller and the electronics, the second with just the LCD screen and keypad etc, with a short cable linking the two (which i'll make desconectable) i could then mount the LCD into my stand/cupboard what ever and have the box hidden.

failing that theres some bigish project boxes i can get locally. infact some are huge, i'd like to do it in a custom built package but again i think id struggle getting the plastic cut to size, do you have any shops local that could cut it for you? i mean i thi nk its safe to say we're both pretty far off from that stage but still  :P.

I got told my DS18B20's got shipped yesterday and should be with me in 2-3 weeks. so thats good news.

well after spending about 1 hour or so trawling through electronic sites to try adn find a supplier who sells everything i need i finally found one and the cost was pretty good.

For £8.51(that includes P&P first class) i got all the little bits and bobs i needed for a RTC module,

the cheapest supplier of "arduino" parts wanted £5 plus P&P for the DS1307 chip and 32.7 kHZ crystal.

the cheapest supplier of a prefabricated PCB RTC was £13+ P&P,

i got:-

DS1307 Chip
IC 8 pin Chip holder (its an extra £0.08, saves me ruining a chip...)
CR2032 coin cell battery
CR2032 batter holder (we'll see on this one depends how big it is etc there was no photo, i might swap it out for a "slim line" one if its no good, it was only £0.40 so at the end of the world its not desasterous.)
32.768 kHZ watch crystal

plus because as i was ordering, i threw in a few led's for kicks/proto typing, i never have any spare led's and maplins my closest electronics store charges £1.23 for a 5mm .... i got 1 of each, red,yellow,green,blue, ultra bright white and pink (yeah they did a pink one.... havent seen one of those often...)

and i should hopefully have those by next week if all goes to plan, it will keep me out of trouble till i get my temp Chips  ;D

Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 17, 2010, 12:15 am
I just got my RTC from futurlec, I haven't wired it up yet, but you're right about the size. It's much bigger than I imagined and making it yourself should actually save space. The printed board they use has a lot of wasted space.

I'm going to play with the clock and see about writing some code to turn a relay on and off based on time, but other than that, I'm just waiting for my controller for the lcd and keypad, and the actual keypad itself and I should have all my components.  
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 17, 2010, 01:42 am
man thats unlucky with your prefabed one, ah well least you have it to play with, although i havnet really looked at the RTC coding i would have thought it would be a pretty simple task to code it to turn on a relay and off at a certain point.

i did a quick search at probes today looks like i can pick up a PH probe for about £15-20 but trying to find any other types were pretty difficult.

but then i knew that really from looking at other projects.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 17, 2010, 02:32 am
It looked like they were having difficulty making a pH probe circuit that didn't require 2x 9v batteries, but I didn't look to far into it. I'm not going to be building a pH probe as it's never been an issue or concern for me. I have a nice hand held probe that I use for the occasional testing.

I played with the clock library and got it to display the set time on the screen, I'm not sure how I keep the clock set, it doesn't seem to work if I take out the code to set the time, but obviously I wouldn't it want it to set to the same exact time everytime it powers up since that will change.
(http://www.reefsome.com/gallery/u/ludnix/arduino//thumbs/arduino_with_clock-800x600.jpg) (http://www.reefsome.com/gallery/focus/v/ludnix/arduino/arduino_with_clock.jpg)

Here's the code I'm using if anyone has any input on reading the clock's date. It seems like I should be able to set the clock once, and have it remember the time until the battery runs out right?
Code: [Select]
#include <LiquidCrystal.h>
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13;    // pin 13 will control the backlight

void setup()
{
 //CLOCK
 RTC.stop();
 RTC.set(DS1307_SEC,1);        //set the seconds
 RTC.set(DS1307_MIN,55);     //set the minutes
 RTC.set(DS1307_HR,3);       //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();
 //LCD
 pinMode(backLight, OUTPUT);
 digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
 lcd.begin(4,20);              // rows, columns.  use 2,16 for a 2x16 LCD, etc.
 lcd.clear();                  // start with a blank screen
 lcd.setCursor(0,0);           // set cursor to column 0, row 0 (the first row)
 lcd.print("Aquarium Controller");    // change this text to whatever you like. keep it clean.
 lcd.setCursor(7,1);           // set cursor to column 0, row 1
 lcd.print("Ludnix");
 delay(3000);
}

void loop()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Aquarium Controller");
lcd.setCursor(0,1);
lcd.print("");
lcd.setCursor(0,2);
lcd.print("");
lcd.setCursor(0,3);
lcd.print(RTC.get(DS1307_HR,true));
lcd.print(":");
lcd.print(RTC.get(DS1307_MIN,false));
lcd.print(":");
lcd.print(RTC.get(DS1307_SEC,false));
delay(1000);
}


EDIT:

Nevermind, removing that section that sets the time in the setup does work for keeping time. I just happened to look when the time was 0 and thought it wasn't working!
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 17, 2010, 08:57 pm
I got the two temperature probes working and modified the clock to display in a 12hr style instead of military. I also ordered the Ethernet shield they sell at the website you linked where you got the LCD shield. Should be fun to play around with the networking side of it.

(http://www.reefsome.com/gallery/u/ludnix/arduino//thumbs/arduino_with_temp-800x600.jpg) (http://www.reefsome.com/gallery/focus/v/ludnix/arduino/arduino_with_temp.jpg)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 17, 2010, 11:28 pm
looking excellent and wow i just noticed how big your RTC module is, even by most thats pretty big considering the size of the components, what are those 3 yellow bars though they look almost like jumpers? if thats the case i might need to order some more bits *d'oh*

i'll most likely be pestering you questions on the temp probes and the Real time clock module once i get my bits, but it looks like we are pretty level regarding our progress (ok your alittle ahead).

now see the ethernet shield was something i personnally didnt really see much purpose to in this perticular build, what do you plan to network it to? another controller/Hub a proper pc? etc....

you thought about doign anyform of data logging? i'd like to use a standard USB stick for memory failing that an SD card.

Oh its exciting where to go next XD


also noticed your using a Duelamore(probable horribly butchered spelling mistake but im tired and CBA to check...you know what i mean) Looks like you might need to upgrade to a mega soon its looking pretty cramped  ;)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 18, 2010, 12:06 am
The yellow bits are jumpers to switch the SDA, SCL and INT from ENA to DIS. I have no idea what that means but that's what the board says! The board is like 2/3 the size of the arduino and is at least 60% wasted space. I guess it's probably some standard size that fits some specific purpose, but if I did it again i'd probably make my own to save space. I ordered it quite a while ago, before I knew all the components were for sale and easily assembled.

I'm planning on using the Ethernet shield for datalogging. I'll have to work on some way to interface it with a web server, but I'm hoping to store data in a mySQL database, from there it would be very easy to make graphs and display information from my computer. It would also be neat to setup email alerts for certain events.

The integrated circuit for the LCD and keypad will interface through i2c which uses 4 of the analog pins, but can be shared with the clock, keypad and LCD all on the same pins (I think), which will free up all of my digital pins except for the one wire for temperature probes. This should leave me with 11 pins free (2-13) minus the temperature probes. I'm going to control 8 outlets requiring 8 pins so I think I should be okay end up with an extra pin or two in the end for some indicator leds or peizo buzzer for an alarm.

I think using the i2c interface you can get a chip to add extra i/o ports to the arduino. I'm still learning about the process but hopefully that would be another means of expanding the board without having to get a new one. I imagine there are cases where even the mega doesn't have enough pins so there much be a way to expand it elsewhere.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 20, 2010, 12:49 pm
Well my RTC parts came today (which im pretty excited about, the Watch crystal is smaller then i thought ( its about 2-3mm long and the legs are about 3mm long so i'll have to do a decent solder job on it, i really like the battery holder they sent as well its perfect, not massive or stupidly designed, just small and low profile.

hopefully have it set up on a bread board by tonight. (and those "jumpers" are pull up resistors i think, after doing some googling... soem people seem to use them others dont and use the internal Arduino ones...

im in two minds, im seeing my spark mate at 2 to pick up aload of prototype stuff, wire, resistors,boards etc so i'll ask him to have a look at the schematics if he feels up to it. (he's been pretty ill).

got aload more coral yesterday for the pico tank too ^^
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 20, 2010, 01:03 pm
It should be fun to wire up, I'm not familiar with how the crystal and circuit work so I'll have to do some research to satiate my curiosity. There are 3 resistors right next to the yellow jumpers so I think you're right.

How much do you think you spent on the clock by doing it yourself? You had initially said the breakout was pretty expensive for the components involved, but you may have been looking at the sparkfun breakout which is $20. The huge one I'm using was $7, so the price isn't that high, but it's definitely a lot bigger than it should be.

Also how was shipping on your LCD+button shield? I ordered the ethernet shield from the same website a week ago, but they still haven't shipped it yet.

I'm also rethinking my 16 button keypad that I was going to originally use. The keypad has the advantage of being able to connect to the integrated circuit I ordered for my LCD, but it might be cooler to use specifically designed buttons for the controller. Since I really only need a few buttons for feed mode, cleaning mode, and arrow and select keys the 16 button keypad isn't really designed for that. Those buttons would need a integrated circuit to control them so I don't waste I/O ports, so I guess I'll have to research to see if I have know-how to do that.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 20, 2010, 01:32 pm
Firstly Ludnix, im UK side so i dont have access to anywhere near the number of arduino parts as you do, the cheapest i could find a complete made module was £13+£5 for postage.

another side wanted £5+ £2.50 postage for JUST the DS1307 chip and a 32.7Khz crystal.

i got

Chip, crystal, battery, battery holder, 5 different 5mm LED's for £8.60 in total. so i got the compoents for about £5 not including postage, if i were to make a few of these i'd save more money, depending on how it goes i might make a few and sell them off, just seems a bit excessive price wise for the components but then this is the UK T_T,

postage from that company took about 10 days for me which i was alittle supprised usualyl it takes a few weeks for stuff from hong kong.

build quality wise though, the LCD looks fine (abiet the first one didnt work, but that was because they put the wrong resistance value buttons in (so i actually gained a "3" button 2x16 screen for free to use in another project.)


and although i could be completely wrong but i think i read somewhere that the Crystal vibrates at 32.678 kHz (or what ever it was) and the chip knows how many vibrations it can process in 1 second, it simply just counts the number of vibrations and counts up.

Its alittle more complex then that because it has internal memory to process the date and the month and when to "incriment" to the next month etc ( i.e. not to have more days then the month)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: daveg360 on Apr 20, 2010, 05:27 pm
I have the same LCD Module.  It uses the following:

Code: [Select]
//RS, RW and Enable can be set to whatever you like
int RS = 8;
int RW = 11;
int Enable = 9;
//DB should be an unseparated group of pins  - because of lazy coding in pushNibble()
int DB[] = {4, 5, 6, 7};  //wire these to DB4~7 on LCD.


Plus it uses AD0 for the 5 button keypad - you see varying values on AD0 for the 5 different buttons.

I switched to the liquid crystal library and made a cable to take it off the board.  It is relatively straight forward with the above info.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 20, 2010, 05:45 pm
moved my LCD shield to some breadboards, freed up 4 Anolog pins and 8 digital pins which was pretty good,

annoyingly the Arduino shield is ever so slightly larger then a standard breadboard so i have to use jumpers on one side.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: robot797 on Apr 21, 2010, 12:30 pm
waht is your scematic on the back up batery?

i want to use it in a turbine engine
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 21, 2010, 04:32 pm
Firstly Robot, Im not using any back up battery for the main controller though you can pick them up i think. only a back up battery on the RTC chip to keep the time and date,

Daveg, I sort of see what your codes doing but its incomplete, without knowing what you did with the integers RW and RS  :-?

anyhow just about to give wiring the RTC chip together onto a breadboard and see what happens from there.

i need to get larger breadboard/stick my current breadboards down as its getting a bit messy now lol.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: daveg360 on Apr 22, 2010, 04:12 pm
I grabbed the code from the example code given out with your LCD - I got it from the URL you posted.  All I was using it for was to illustrate which pins are used.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 22, 2010, 06:24 pm
Ludnix / Anyone, could you please post your RTC code, the code on that tutorial is very haphazard. (including any librarys)

i cant really see which is the DS1307 library? and which is the code that goes into my main methods.

Cheers

(gave up on trying to use 18 Guage single core wiring for jumpers and gave in and brought 150 varying length jumper leads from ebay, for £7 which i thought was pretty good.)

so to do something constructive i just wired my led's up and played around with the battery ofr 10 minutes, the pink led looks pretty cool considering you dont see them very often.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 23, 2010, 05:40 pm
Right, Well this is going to sound stupid butttt...... i cant for the life of me get this Arduino to import my new librarys?!

after some googling, i managed to find the .H, .CPP and keywords file for the DS1307 librarys and i was under the impression i should just copy and paste the files into a folder called DS1307, (once i had created them in a text/code editor), in my librarys subfolder.....

and then use the Inport library option in the Arduino Compiler.... well why cant it see the folder?

And another thing i've noticed, its "lost" the pathway for my other imported library (LCD_4BITMOD, i dont use it anymore) its there in my subfolders just the compiler wont view them....

C:\Program Files (x86)\Arduino\arduino-0018\libraries\DS1307

What am i doing wrong? lol

this worked before and what i was told to do previously and i had no problems.

HELP!

(my new jump leads should be here by monday/tuesday =))


EDIT: never mind, for some reason it just didnt like me using a shortcut to load the Arduino.exe application.... strange but sorted now, it was opening a "clean" new version (i..e like for the very first time) but its fixed now.

on to placing with my RTC =D
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: pwillard on Apr 24, 2010, 02:32 am
Version 18 seemed to have changed how libraries worked a bit since they have a different directory now.  It's tossed me a few curve balls.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 24, 2010, 12:32 pm
Here is the RTC library with some examples. The folder should be in arduino/libraries, so one of your included files would be arduino/libraries/DS1307.h

http://code.google.com/p/ds1307/downloads/list

It is then included in my code as #include <DS1307.h>, arduino automatically finds it, but you must restart arduino before trying out the new library or else it won't find it. That might have been your problem with the new libraries you tried. I think the arduino software scans the libraries folder on startup, so anything added after the software is running it doesn't know about.

Here is the code in action for my setup:
Code: [Select]
if(RTC.get(DS1307_HR,true) > 12){
hour = RTC.get(DS1307_HR, true) - 12;
ampm = 2;
lcd.print(hour);
}else if(RTC.get(DS1307_HR, true) >= 12){
  ampm = 2;
  lcd.print(RTC.get(DS1307_HR,true));
}else{
ampm = 1;
lcd.print(RTC.get(DS1307_HR,true));
}
if (RTC.get(DS1307_HR,true) == 0){
lcd.print("12");
}
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  ");
}


That's in my loop, it's just checking what the RTC says the hour is, converting it 12 hour time (RTC values for the hour are 0-23, so I subtract 12 if it's over 12 to get the 12 hour version).

If you haven't set the clock yet you can use this code, I just run it once to set the time and then commented it out.

Code: [Select]
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();
 
}


I got my ethernet controller today. I discovered it uses pins 10-13 though, leaving them unavailable. That only leaves me with 8 digital pins which is too few for my needs. If I want to continue with the ethernet shield I will likely need to either upgrade to the mega, or expand my number of I/O ports using a chip and i2c interface. I also found the ekitszone ethernet shield doesn't use the ethernet library that the arduino made ethernet shield does. If I decide to continue with the ethernet shield I might just buy the arduino version which is $40 opposed to the $24 I spent at ekitszone.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 26, 2010, 12:31 am
Hello Guys, (and any Girls) Hope everyone one is well.

Spent the last few hours redoing and neatening up my Menu's (im now on version 1.03 ha) And hopefully my jumper wires will be here tomorrow.

Im just about to start looking at the software "half" of the RTC but im too tired at the moment and shall pick it up tomorrow no doubt.

Hopefully i'll have something more constructive to add in a few days.

Luke
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 26, 2010, 02:59 am
I ended up ordering an arduino mega this weekend for $32 shipped of ebay. I was originally going to do the integrated chip route to expand if necessary, but since the mega has 54 digital i/o ports that's more than I could ever need and would be much easier to just use that than rig my own setup. I still might buy a new ethernet adapter though, the code for the ekitszone.com ethernet shield is pretty ugly and hard to use compared to the actual arduino shield library code.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 27, 2010, 10:44 am
I've been running some lunar link moon lights on my tank for a long time now, but some of the leds are pretty dim and seem to be burning out. I am planning on replacing them, but figured it would be cool to make them dimmable via arduino at the same time. I'm thinking of using the PWM on the arduino to transistor to control the power to the LEDS. They need 6vdc according the transformer so I suspect the arduino can't power them on it's own, thus the transistor connected to the transformer.

Is that similar to what you're going to be doing for your leds? I know you'll be working with a higher wattage since you're controlling the main leds and not just moon lights, but I was curious to hear how you planned to dim them with the arduino.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 27, 2010, 02:19 pm
My led set up is different Ludnix, Im using 10 3 watt leds, over a 15"x10"x8" tank (its the test pico, i have twin 250's over the 4ft marine)

And i have 5 Cree X-RE Royal blues and 5 Cree X-RE "R2" (whites), each string is regulated by a luxdrive BuckPuck (Each buck puck has a pot on it to dim the lights, but you can snip this off and supply a PWM signal to dim them) if you were desperate, you could wire up to 1-18(maybe a few more)  1 Watt led's to a buck puck and just supply a PWM signal if you cant get any further. but i bet you could wire them up and power them off an Arduino, even if they require 6 v , you could ether drop a few leds or use transistor (think thats the one) to beef up the voltage, failing that you could always salvage the Led's out of it, heat shrink them and just create a new 5V chain.

got my jump leads, and my Temperature probes in the post today, the RTC coding is giving me a bit of a head ache so i mgiht try and work on the Temp chips now they are here.

i desperately need to order some new bread boards but i cant bring myself to buy one of those large 2.5K point boards (like oyu have) that £20 could go to a complete new module/component :P
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 27, 2010, 06:42 pm
Well Im having Tonnes of trouble putting my RTC chip module together and to get it to work with my controller.

I assemble my RTC in the following way:



   Crystal leg---------[1      8] ----------5V(shared on a rail that has a
   Crystal leg---------[2      7]                   a pin to the LCD on as well)
       ------------------[3      6] --------- Pin 20 SDA
      |           ---------[4      5] --------- Pin 21 SCL
      |          |
      |          |  
      |          |
      -- +/- ----------------------Ground (shared with other pins from the LCD that need to go into the ground)


*note im using an Arduino mega, the SDA and SCL are located at pin 20 and 21, not pin 4 and 5 as in the previous/smaller models. im assuming that the wire.h library has the ability to distiqunish which board is in use (i.e. if its a mega and therefore use pin 20 and 21) this is the case as far as i can tell researching. Ludnix, your going to come across this problem i think as well, hopefully you'll jsut have to change your wire locations.

In the Duelmore models pin 4 and 5 had Pull up resistors built in again im assuming this is the case in the mega, but i could be wrong.
i need to go pick some 4.7K resistors up anyhow at some point. for my DS20BS18 chips.

can anyone see anything painfully obvious? with my hardware layout?

Secondly coding wise, for testing purposes i just used one fo the generic testing cases knocking on the net

When i run the code it doesnt set the RTC values to the values i set
i.e. RTC.set(DS1307_SEC,32);

but instead prints out

0:0:0 0/0/2007 DOW:0

and doesnt "incriment up" as time goes by, i can see the screen flickering as the screen is refreshed via the loop(); but the seconds just stay at 0, its not something stupid like me resetting the values to 0 each loop.

i even tried your code Ludnix (modified for my 16x2).

Anyone got any ideas?

a step by step would be nice if anyone has one in building a DIY RTC ;D (again i've looked at that one you posted ludnix time and time again and cant see what im doing differently...)

Help would be appriciated.

(next week we have Temp probes to work through XD (they came today))
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: pwillard on Apr 27, 2010, 09:33 pm
With I2C, you need to use use external pullup resistors, I have seen anything from 1k8 (1800 ohms) to 47k (47000 ohms) used.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 28, 2010, 12:15 am
Ok so after about 7 hours of battering my head against code and hardware im getting somewhere, I've managed to write a small piece of code which set and displays the correct time And it incriments correctly.


I do it by having some RTC.set code, which i run once, i then // this code in the set up, and upload the new code which is missing the set up and just use the RTC.get method to display the time. so far so good it keeps its time and doenst do anyhting funny etc.

But for some reason when i Pull the power to simulate a power cut(which is via usb, not a wall power supply so this may have something to do with it) the DS chip resets and looses the data stored for the time (AKA the back up battery isnt kicking in)

Anybody got any suggestions or reasons why?

Now i HAVENT included any pull up resistors ether, and am assuming that pin 20 and 21 have internal pull up resistors like the previous models.

(and because i only have 1K and 20K resistors to hand...) could this be a reason why?

basically Why isnt my back up battery kicking in?

Ah well each day i get one small step closer.

Night all,
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: andrew1056 on Apr 28, 2010, 03:05 am
Cool project! I started a similar one several months ago (ongoing).

Just figured I'd let you know that a bunch of the code you're trying to write I've done already. It's not commented that great, but you can check it out:

http://www.diy-labs.com/projects/arduarium-controller

Which pin do you have the battery hooked up to the DS1307? IIRC positive goes to the pin and the battery gets grounded. (may not be right since it's been a really long time since I've setup the rtc).
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 30, 2010, 05:43 pm
Hello,

I actually came across your site a few days a go before you posted and was very interested, Thank you for the offer but half te fun is compiling my own coding and figuring things out by myself, but this RTC has got me stumped lol.

I have probably found my issue tho witht he battery back up. i think the brand new battery is Dead... i couldnt even light an 3 or 5mm led up with it?! where as last week i was able to, so i think i've somehow fried the battery (that or it had the tiniest amount of power in it) so i need to go to the shop and pick a new one up, which is annoying

soldered up  my RTC module on some copper board, tbh i could have done a neater job but it works. and ive managed to make it relatively compact its 1" x 2" (about 1/4 of the arduino board size).

For some reason when i go to include the RTC code to my controller code i keep geting an error message (well 3)

"c:/program files (x86)/arduino/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'

c:/program files (x86)/arduino/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

c:/program files (x86)/arduino/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

Bad error line: -7
"

and the error line contains no code just // out comments, i can delete these adn the error line changes....

any ideas?

i might just re write the menu code around the RTC not the other way around, and try adn debug what ever problem im having.

its not conflicting with the LCD code, because i've been able to write code that displays the RTC value on my LCD etc.

i'll look at it later.

in the mean while i might start having a stab at the DS20B18 temperature probes. I havent got any 4.7K resistors to hand would 5 1K resistors put in series or 1x20K resistors work instead?

never mind if not l'll pick some 4.7 ks up at some point.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: andrew1056 on Apr 30, 2010, 06:32 pm
I remember running into that error before. Took me hours to figure it out.

In the rtc code you may be missing a closing bracket which is throwing the error.

If you could post the code that would help.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on Apr 30, 2010, 08:33 pm
You should be able to 4.7k resistors at an Electronics shop. I was able to 5 for a dollar at radioshack here and they have an extremely limted selection of components
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Apr 30, 2010, 10:16 pm
oh i can pick them up cheap enough, its just finding the time to get them, i have 1K and 20K resistors to hand that was all. I'll try and pick some up on tuesday, im working 8-8 for the next 3 days, then back to uni tuesday-friday but im sure i'll find some time to get some
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 04, 2010, 06:33 pm
well it took me embarisngly long to figure out whats wrong with the battery back up on the RTC..... i wired the Battery holder in the wrong way round, wired all the wires correctly just got the two pins of the battery holder mixed up,  flipped the battery cell "upside down" and volia it works.

For some reason i keep getting that error message though when i try to add the RTC code to my currently made controller program, so i've started to re write the menus etc into a new file, so far so good it compiles etc.

Also brought some 4.7 K resistors i got 10 for £1.40 o once i've got my menu's re created i'll try the temperature probes. anyone got any good tutorials/info on those.


Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 04, 2010, 09:05 pm
I'm assuming you'll be wanting to wire the temp probes in parasite mode. I will post my code when I get home tonight, displaying a single temp probe reading was pretty simple but I initially had a hard time doing multiple readings so I'll post code and some commentary as well.

Do you know how many probes you plan to use? I currently had two working and ordered a third so I'll have to modify my code for that as well.

I unfortunately ruined the connectors on my LCD and can't get it to display data anymore so I can't test my code out with the LCD until the new one arrives tomorrow or Thursday. I did order a bunch of other components though which will help my project along nicely. I ordered a piezo buzzer for alarms and confirmation noises, some RGB LEDs for moonlights and some vinyl lettering for my keypad so I can have custom symbols on it.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 04, 2010, 11:04 pm
Here's how my code looks, you will have to modify it to fit your system but the temperature code part should be the same.

Code: [Select]
#include <LiquidCrystal.h>
#include <WProgram.h>
#include <Wire.h>
#include <OneWire.h>
#include <DS1307.h>
#include <DallasTemperature.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 9;    // pin 13 will control the backlight

//TEMPERATURE
#define ONE_WIRE_BUS 13  //Where the temperature probe data pin is connected to arduino (pin 13 in this case)
#define TEMPERATURE_PRECISION 9
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
DeviceAddress insideThermometer, outsideThermometer; //arrays to hold device addresses

void setup()
{
  //TEMPERATURE PROBES
 Serial.begin(9600);
 sensors.begin();
 if (!sensors.getAddress(insideThermometer, 0));
 if (!sensors.getAddress(outsideThermometer, 1));
 sensors.setResolution(insideThermometer, 9);
 sensors.setResolution(outsideThermometer, 9);  

 //LCD
 analogWrite(backLight, 10); // turn backlight on.
 lcd.begin(4,20);              // rows, columns
 lcd.clear();                  // start with a blank screen
 lcd.setCursor(0,0);          
 lcd.print("Aquarium Controller");
 delay(1000);
}
//FUNCTIONS

//TEMPERATURE
void printAddress(DeviceAddress deviceAddress)
{
 for (uint8_t i = 0; i < 8; i++)
 {
   // zero pad the address if necessary
   if (deviceAddress[i] < 16) Serial.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()
{
//TEMPERATURE PROBES
sensors.requestTemperatures();
//LCD
lcd.setCursor(0,0);
lcd.print("Aquarium Controller");
lcd.setCursor(0,1);
lcd.print("Temp1: ");
printData(outsideThermometer);
lcd.print((char)223); // print degree symbol °
lcd.print("F");
lcd.setCursor(0,2);
lcd.print("Temp2: ");
printData(insideThermometer);
lcd.print((char)223); // print degree symbol °
lcd.print("F");
 delay(1000);
}


This should just display 2 temperature probes on individual lines of the LCD. the probes are named outsideThermometer and insideThermometer, when I get my third probe I'll see about making the code for that and giving them some proper names.  
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 04, 2010, 11:28 pm
what a pain on breaking your LCD shield, ther no way you could salvage it with some clever soldering?


ah well least you have have a few goodies to keep you entertained, Ive spent most my afternoon working on my coding today trying different things adn where to go, Playing with gettting my LEDs to night up at a set time now. but i might give your Temp probe coding a bit of go now and see if i get anywhere with it.

Thanks
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 04, 2010, 11:58 pm
Well with clever soldering I was able to get the backlight working on the LCD, but I have no idea what to do for the data. Right now the LCD lights up and rows 1 and 3 are filled with white blocks while 2 and 4 are empty.

The lcd is only $15 at least so while disappointing, not a major setback.

My arduino mega just arrived in the mail so I'll be able to play around with that atleast!
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 05, 2010, 12:35 am
thats great news, you'll love the extra ports of the Mega, Just remember the main difference is the possition of the SDA and SCL (for oyur RTC module) they are in a different place, (on the mega they are digital pin 20 and 21) other then that slight change in wiring everythign else should be directly transferable. you wont need to change your coding as the wire.h library compensates for the change in SDA and SCL pin locations.

i love my mega, every time i look at it i "discover" a new pin or something, i found 2 ground pins which i werent aware of.

how did you wire up your temp probes?


wire the Grd to pin 1 of the DS2018s
wire 5V to pin 3 of the DS2018s
wire all the pins 2 of the DS2018 to a single spare Analog pin
wire a 4.7K resistor between pin 2 and 3 (one each or 1 per Analog line?) thinking of making my own bridge board

something like a small board of 3 rows, 1 row for the Ground, 1 row for the 5V, 1 row for the Arduino pin. then just have 1 resistor bridging the 5v to the pin row? with a bank of header pins spanning each row

does that make vague sense? its not because im tight fisted, i just want to do a neater end job and thought that be a pretty cool way to do it if i got some Header pins for quick "connect and disconnect"

i'll do a drawing if that didnt make enough sense

im actually going to make a guess and say id only need 1 resistor at the start... because its just to act a a pull up wait now that i think about it id need resistors on each .... pah i just like to solder things... lol anyhow my brains to fried to think straight now so im off for a bit, hopefully have my temperature probes adn menu rewritten soon
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 05, 2010, 03:55 am
Thanks for the tip on the clock pins!

I have 4.7k resistors connected to each probe. , I wired the resistor and probe within the case for each probe.

Here's the diagram I used:

(http://reefprojects.com/w/images/c/c2/DS18B20b.jpg)

I don't have any photos of the probe itself because already sealed up in the case, but I just have them going to a breadboard with common 5v, ground, and data going to the arduino (on pin 13 in my example).

I'll try to get a nice photo of the stuff wired and show how I did my probe capsules as well.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 05, 2010, 02:40 pm
thats perfect information Ludnix, and after i sat down and thought about it i came to teh same conclusion more or less on how to do it. how did you encapsulate/seal yours? did you notice any loss in precission (i vaguely remember you saying something about encasing yours in some rubber syphon/similar tubing, or was it a case once the probe had been placed in solution ~(i.e. in tank) the heat transfered through to the sensor with no problems.

Thanks anyhow

edit: Ah haa i thought you could do it this way

(http://milesburton.com/images/e/e5/Schematic-dallas-18s20.gif)

thats the image from the Arduino dellasTemp.h wiki library page

they connected 1 resistor to turn the whole +5 line into a pull up line (if that makes sense) and used 1 resistor per line, not 1 resistor per probe.

goign to get me some fancy quick connect adn disconnect ends and make a little "temp Board".

lol

edit agian:http://milesburton.com/wiki/index.php?title=Dallas_Temperature_Control_Library#Introduction
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 05, 2010, 03:51 pm
Hmm Well I've hit yet another wall it seems, I quickly wired up my DS18B20 chips up as singles and varying chain lengths and my Arduino cant "find them/locate them" on any of the DallasTemp.h library examples....

any ideas?

i've litterally downloaded the DallasTemperature.h librarys and pulled there examples across just to see if i get anywhere.

Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 06, 2010, 07:24 am
I'm not sure why you're having the problem, I would double check that you didn't wire the IC backwards, pins 1, 2, and 3 from left to right applies when the flat side of the probe is sticking up like in the picture I posted.

I would try wiring a single probe and resistor like my picture had done and see if it works then if you haven't.

Here's a picture of just plugging my probes in and testing it out.  You can see the two probes on the right of the breadboard. They are pretty ugly as is, but water tight. They are in rigid 1/4" tubing which I got the LFS. I don't know what it's normally used for, but it was next to the 1/16" tubing that is commonly used for undergravel filters and air stones. I just wired my probe and resistor up, with the 3 wires coming out, I plugged the tubes with aquarium epoxy putty. They should work fine for water temperature monitoring, they take longer to update compared to exposed probes, but that obviously is not an option. After a few minutes they air temperature inside the tube equalizes with the outside temperature though and they seem accurate compared to my IR temperature laser and aquarium temperature probes.

(http://www.reefsome.com/gallery/u/ludnix/arduino//thumbs/probes-800x600.jpg) (http://www.reefsome.com/gallery/focus/v/ludnix/arduino/probes.jpg)

I'm using the "Multiple" example in the dallas temperature probe library, I haven't modified the code at all, the data wire is connected to port 3 as the code indicates, and +5v and ground respectively.

Here's hacktronics intructions on the probe, you are right that you could just use roughly 5kohm resistors, it apparently doesn't matter.
http://www.hacktronics.com/Tutorials/arduino-digital-temperature-sensor-tutorial.html

Here's what my serial monitor shows when I run the code:
(http://www.reefsome.com/gallery/u/ludnix/arduino//thumbs/serial_monitor-800x600.jpg) (http://www.reefsome.com/gallery/focus/v/ludnix/arduino/serial_monitor.jpg)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 06, 2010, 04:29 pm
yeah i tried that but i'll give it a nother shot now see what happens.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 06, 2010, 05:05 pm
Got it sorted now, for some reason the Chips wouldnt work then i put them on my shared ground, put them on their own ground adn they worked fine.

right now to solder some of these up =]
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Vini on May 06, 2010, 09:10 pm
Nice! I'll study it!
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 06, 2010, 11:20 pm
well seeing as I've seen your build i thought it was fair to throw a picture up or two of mine,

here it is in all its glory

(http://sphotos.ak.fbcdn.net/hphotos-ak-sjc1/hs356.snc3/29403_394453801606_532811606_4546477_3595668_n.jpg)

poor Blackberry photo as my brother has my camera. we have the LCD shield with keypad at the top, Arduino mega, RTC module underneath, 1 grey breadboard (which is actually empty, im just using it for the shared Ground and shared 5V) and to the right, on the white breadboard is 3 DS18B20's (which now work)

I just need to work on the coding and compile my temperature code with my controller code.


(http://www.facebook.com/photo.php?pid=3508326&id=532811606)
RTC module, after far too long i realised i soldered the battery holder in upside down, so i just flipped the battery and volia it worked.

(yes i soldered jump leads in, but they can easly be removed/soldered in the finished build, Blue is Ground, Red is 5V, Green is SDA and orange is SCL)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 07, 2010, 06:38 am
I spoke with my oceanography teacher today regarding moonlight and coral sexual reproduction. He was able to explain to me how to emulate the moon light in that one would not only want to gradually increase and then decrease the light intensity over the 29.5 day period, but also the duration. I think the typical moonlight controllers sold just adjust the intensity over that period, but for the most realistic results you would also want to shorten duration depending on current phase. The moon is not constantly overhead at night, so I would want to take that into consideration with it.

On the other hand, tides really probably have a lot more to do with coral sexual reproduction, so the whole moonlight thing might be moot anyways.

Anyways, my order from hacktronics came today, it had my new LCD and bigger breadboard, as well as some transistors and another DS18B20 probe. I haven't wired up the third probe yet, but I got the LCD wired up with the I2C board and keypad. The I2C reduces the number of wires to the arduino, which no longer necessary, but I probably go ahead and use it anyways.

(http://www.reefsome.com/gallery/u/ludnix/arduino//thumbs/controller_and_keypad-800x600.jpg) (http://www.reefsome.com/gallery/focus/v/ludnix/arduino/controller_and_keypad.jpg)

On the weekend I'll spray paint the keypad black and apply my own numbers and symbols. I'll probably also get to work on the wiring up the third temperature probe to see how difficult that is to program. So far everything is running smoothly though.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 07, 2010, 06:57 pm
looking great Ludnix, Yes i was aware of the duration changes etc and intenisitys, i was planing to do a bit of googling and find some statistics on moon lighting strengths and durations etc and use those as a basis,

also contemplating maybe one of those 8x8 led matrix cubes you can pick up and individually control the leds on.. still not made my mind up yet.

made a basic temp probe today (1 meter length, just soldered together and heatshrinked at the probe, but not encapsualted.

although this works the cables alittle messy, i'll probably go to my local maplins store (electronics specialist/exstortionist) and pick some 3 wired wire use that. get a better finish at the end i reacon.

Things to do :

Work out coding to worked out an LED photoperiod etc

Write soem code that lets the user set up which probe is which, at the minute the probe alocation is on Hex code not user choice etc.



Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ludnix on May 15, 2010, 07:11 am
I ordered 3x float sensors today, they should be super easy to hook up the arduino. I plan to use one in my top off container to indicate when I need to refill it, one in the sump to trigger the actual top off pump, and one in my display tank to shutoff the main return pump in case the overflows clogged and the water level started rising excessively.

I also painted my keypad and applied the custom vinyl numbers and symbols to it. I'll try to get a picture tomorrow.

My peizo buzzer from sparkfun doesn't seem very loud. I'm waiting for hacktronics to get theirs back in stock and give that one a try.

I also received all of my relays now (16), I'm just waiting for the second American DJ power outlet rack, then I can order some acrylic and make a case for it all.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 20, 2010, 09:48 pm
Geez does it feel like a long time i had a chance to work on this project ive had exams this last week and into the next so this has taken a back seat for a while. but i booted up the sketch and had a play tonight,

i seriously need to re think my menu code and the itterations the arduino has to go through, i never thought id say it but its got slow! the time it used to take to load one menu for another was nano seconds now its taking about 1 second per press. i think its because of how i call the menu.

so my next version of code (im on version 1.05 now!) (1 was jsut a basic hello world, 1.02 was getting the keyboard adn the first intereactive program, 1.03, was RTC 1.04 is Time probes)

im going to try and focus and make it "light" i dont think it helps not having a 20 x 4 lcd because im forced to code more "pages" to get all the data i want, if it wasnt for the fact im saving up for a new tank id think about getting a new lcd shield laugh.

Ludnix have you done any menu coding yet? or still sort of coding all your bits and bobs before you mash it into one controller?

plus im looking at sorting the LED fades in when a certain time is set.

all in all im far too busy and limited by my own time fundings and information  :-/

edit that sorted out my laggy program, i just re ordered the way my methods were called ( origionally it was temperature, led brightness (that doens nothing really) then load the menu then finally call the keypad listener method.

simply pulled my menuloader method to the top/first and its back to being lighting quick  ;D
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on May 26, 2010, 08:15 pm
well heres the latest "up to date" image
(http://i290.photobucket.com/albums/ll272/jarvophoenix/IMG00845-20100526-1851.jpg)

we have the 16x2 lcd with 5 push button keypad,
the arduino mega,
the grey protoboard tot he left of the mega and below the lcd shield is empty, im just using the it for a common ground pin and a common 5V pin.

we have the RTC module below the mega board and on the right is my semi finished temperature board, the board has 3 x 3 header pins (with each of the the white temperature probes having the males that match up) and then for sheer geekery i have a "power" led on the board which i need to solder in.  ( but that pink one is waaay to bright).

placed an order for a PH meter off ebay but i just found out i need to build an Op-amp (operation amplifier) for it so i need to order some parts once my probes here.

I want to start doing work on a powerbar/ SSR but theres so many i dont really know which to order does anyone have any links to a Relay tutorial or similar.

Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Jun 01, 2010, 01:41 am
got a ph probe in the post today, now i just need a male BNC connector and some parts for a ph op amp (whihc i need to google about)
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Titeo on Jun 23, 2010, 03:28 pm
Hello Harlequin,
I would like to ask you how you code your Idle menu?? Thank you
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: ccLansman on Jul 02, 2010, 09:05 pm
nice build, im currently starting down the road myself, do you care to share your source code to get others going?
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Onsan on Jul 15, 2010, 04:39 pm
Hi Harlequin,

Nice build and great thread! Cheers!

i'm working on a similar setup, but struggling with writing menu's, is there any chance you could post your current sketch?
I've tried getting the one you posted earlier to work but i keep getting stuck.
Thanks!
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Onsan on Jul 21, 2010, 04:27 am
Hi Harlequin,

I have the same basic setup and was wondering how you got the LCD shield to use LCDI2C.h, how'd you manage that?

Cheers,
Paul.
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: jordi-exa on Jul 21, 2010, 07:02 pm
Hello!!!
You could post the soft Minder Reef V1.02 by Luke or his latest version. Since the V1.00 does not work the keypad.

Thanks!!!!!
Title: Re: Aquarium Reef Controller, stage 1, the LCD shield,
Post by: Harlequin on Jan 21, 2011, 10:41 pm
Wow has it been a long time since i was last on here.

*blows dust off Arduino mega*

Like all good things, they take time and sometimes lifes prioritys like university and work take over. i havent really picked up an Arduino in months and July 10 i had to dismantle my pico but thankfully i recently restarted it and this has kick started my joy for Arduinos again. last week i placed an order for a second Arduino mega i also go TONNES of "stuff" leds, resistors, basic chips, pots, mini strepper, sometihnglike 4 different LCD screens all of which to play with.

The main project is Kinda on hiatus at the moment its kept safe and i do plan to pick it back up but for now i brought the second Mega to work on "other" functions. so i would like to now take it down a notch, forget LCD's for a moment, pH probes, temperature probes those can all be intergrated later. for now i want to work on lighting.

Specifically How to interface 2 chains of 3 watt led's via buckpucks and PWM, and an RTC.

Im going to start a new thread to help declutter this thread and my new drive for lighting.

the first side thread is here:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1295647519/0#0

and its about implimenting the lights.

tag along if anyone has any benficial infomation!