Aquarium Reef Controller, stage 1, the LCD shield,

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

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

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.

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.

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.

#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.

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

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!

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

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:

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.

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

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:MilesBurton.com

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.

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.

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.

Here's what my serial monitor shows when I run the code:

yeah i tried that but i'll give it a nother shot now see what happens.

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 =]

Nice! I'll study it!

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

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.


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)

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.

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.

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.

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.

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