Go Down

Topic: Aquarium Reef Controller, stage 1, the LCD shield, (Read 61914 times) previous topic - next topic


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.


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.


waht is your scematic on the back up batery?

i want to use it in a turbine engine


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.


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.


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.


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


Apr 23, 2010, 05:40 pm Last Edit: Apr 23, 2010, 05:46 pm by Harlequin Reason: 1
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.


(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


Apr 24, 2010, 02:32 am Last Edit: Apr 24, 2010, 02:33 am by pwillard Reason: 1
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.


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


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;
}else if(RTC.get(DS1307_HR, true) >= 12){
  ampm = 2;
ampm = 1;
if (RTC.get(DS1307_HR,true) == 0){
if(RTC.get(DS1307_MIN,false) < 10){
if(ampm == 2){
lcd.print("PM  ");
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()
 // set the time
 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

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.


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.



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.


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.


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


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))


With I2C, you need to use use external pullup resistors, I have seen anything from 1k8 (1800 ohms) to 47k (47000 ohms) used.

Go Up