Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 15, 2010, 12:11:37 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.
2  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 06, 2010, 11:38:49 pm
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.
3  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 06, 2010, 12:24:22 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.



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:
4  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 04, 2010, 08:55:15 pm
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.
5  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 04, 2010, 04:58:32 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!
6  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 04, 2010, 04:04:42 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:
#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.  
7  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: May 04, 2010, 02:05:51 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.
8  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 30, 2010, 01:33:14 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
9  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 27, 2010, 03:44:42 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.
10  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 25, 2010, 07:59:14 pm
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.
11  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 24, 2010, 05:32:54 am
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:
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:
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.
12  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 20, 2010, 06:03:54 am
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.
13  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 17, 2010, 05:06:53 pm
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.
14  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 17, 2010, 01:57:56 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.

15  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 16, 2010, 07:32:56 pm
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.


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:
#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!
Pages: [1] 2