Go Down

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


Apr 14, 2010, 12:28 am Last Edit: Apr 14, 2010, 12:36 am by Harlequin Reason: 1
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.

shield and arduino mega top down,

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


Anaglog IN pins 0-5

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:

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


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.

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.


Apr 14, 2010, 04:26 pm Last Edit: Apr 14, 2010, 11:51 pm by Harlequin Reason: 1
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

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  :-?


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.


Apr 16, 2010, 03:40 pm Last Edit: Apr 16, 2010, 04:39 pm by Harlequin Reason: 1
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


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.  


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.


Apr 17, 2010, 02:32 am Last Edit: Apr 17, 2010, 02:36 am by ludnix Reason: 1
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: [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()
 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
 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

void loop()
lcd.print("Aquarium Controller");


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!


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.


Apr 17, 2010, 11:28 pm Last Edit: Apr 17, 2010, 11:31 pm by Harlequin Reason: 1
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  ;)


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.


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


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.


Apr 20, 2010, 01:32 pm Last Edit: Apr 20, 2010, 01:35 pm by Harlequin Reason: 1
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)

Go Up