LED and aquarium controller with TFT LCD touch screen

Mine (not yet) finished light and tank controller.
No documentation yet but the sketch (source code) is available here.
I’ve decided to use older Arduino Mega board as those are on ebay for about the same price as Uno.
The screen is 3.2’’ TFT with touch panel, again from ebay for about £16. There are few different ones, mine has Himax HX8347-A controller and can work only with 16-bit parallel interface. I use Henning Karlsen's libraries to drive the screen and touch panel.
Last bit is RTC chip DS1307, again from ebay. :roll_eyes:
At the moment everything is connected on breadboard, I have to order few more bits to connect it to my LED lights.
The temperature probe is simple thermistor connected in series with resistor so it’s not very accurate, ideally I’d make it more reliable and control heaters and coolers instead of my TC-10. Using digital temp sensor like DS18B20 would be much simpler but I couldn’t find a waterproof one.
To do list contains another temp sensor to control temperature of LED heatsinks and RPM of fans, add EEPROM library to save settings and data logging, PH meter and maybe connect pumps i.e. powerheads so they can be controlled by touchscreen.

Breadboard:

Main screen:

LED test screen:

Nice project, nice touchscreen.
What kind of communication are you using , i2c?

I hope you wil make a wire diagram and links to the necessary libraries when your finished.

The interface is 16-bit parallel, it's using 20 wires.
That's way I used Mega board.

Actually the screen controller supports serial SPI interface but it's not connected on PCB.

You can find my library for this display here: Electronics - Henning Karlsen
And the touch-addon here: Electronics - Henning Karlsen

I also have a library for the DS1307 here: Electronics - Henning Karlsen

/Henning

BTW: My name is Henning Karlsen, not Karl Henning :slight_smile:

Sorry Henning, stupid mistake to make, corrected now. :blush:

I think your library contains a bug, printNumF doesn't display numbers correctly if they are less then 1 (0.1, 0.2 etc).
I got around that by simply adding '0.' in front, maybe something you can look at.
Otherwise it works brilliant, maybe a bit slow but I'm not sure what the limiting factor is. I try to keep refreshing things to absolute minimum :slight_smile:

The printNumF-bug has been fixed in v2.6 of the library (released a few minutes ago :slight_smile: ).

I am still looking for ways to optimize the libraries, but the ATmegas are not the fastest MCU's out there :frowning:

/Henning

Great build lads im (reefergeek) was trying to amend your code for use on the atmega 328 but read that the tft on that arduino board ties all the pins up so none for dimming leds left or temp sensor

Going to buy a mega and try to solder some pin headers in my atmega 328 tft

Kev

ktnch:
Great build lads im (reefergeek) was trying to amend your code for use on the atmega 328 but read that the tft on that arduino board ties all the pins up so none for dimming leds left or temp sensor

Going to buy a mega and try to solder some pin headers in my atmega 328 tft

Kev

Some of those Ebay HX8347-A controlled screens appear to have their SPI-interface available on the connector, requiring just 4 wires.
That might save you a Mega.

How many free pins are left in this design? And would you be willing to help with coding I have for a wave maker to incorporate into the one you just finished?

I'm back 8)
After over 18 months I got around to update my project.
For all this time it was working fine controlling lights on my tank but it had number of bugs and some of the 'features' were not working at all.
The documentation was crap as well.

Stilo 2.5 is not compatible with Arduino 1.0.1 yet but sketch is well tested and documentation is up to date. Everything can be downloaded from code.google.com/p/stilo

Main features:

  • two separate PWM signals for independent control of white and blue leds;
  • dusk and down effect;
  • real time clock;
  • water and LEDs heatsink temperature sensors;
  • too high and too low water temperature alarm;
  • safety dimming light when LEDs temperature too high;
  • speed control for heatsink fans;
  • all settings are stored in EEPROM.

Some screenshots:
Main screen:

Settings:

Lights output values:

Very nice Vasco,

I was wondering if you'd ever be back. I kinda let go of your project after my lil one fried my 2560 and TFT. But am looking to get back into it after seeing the work done on the Jarduino. Would like to work with you when I get my hardware again and see about adding more features as i've designed a pH/ORP Shield for the mega just so I could use your sketch. Have thought about implementing weather patterns with lighting strikes also and a few other menus/options.

Yep, it took me a while to get back to my project :roll_eyes:
Meantime other people kept it going, I've seen Jarduino as well, especially I like its moonlight implementation, I plan to do something similar.

I bought second Mega board and another screen so I don't have to test my sketches on 'live' controller and scare my fish :slight_smile:
I plan to add more channels, moonlights and I have an idea for simple ATO.

Regarding ph probe, where did you buy it? I have seen info somewhere that it's useful life is about one year?

Hello Vasco!

I am writing a program based on your code. He was very helpful.

If you want to know my project can find it here:

https://github.com/FernandoGarcia/Ferduino

Here's more information but, in Portuguese. Sorry.

http://reefcorner.org/forum/topic.asp?TOPIC_ID=135383&whichpage=2

Thank you for your provided code.

Hug.

Fernando Garcia

Hi Fernando,

I'm glad you liked my idea.
I don't understand Portuguese so I looked at pictures on your thread and I have to say it looks really good!
Lots of innovation and new features.
Keep it coming!

Meantime I'm upgrading my own code as well, I have added more LED channels and moonlights and now I'm tidying up the code.

Take care.
Daniel

I have finished updating my project and Stilo 3.0 is now ready and can be downloaded from my project site www.code.google.com/p/stilo

List of features:

  • up to five separate PWM signals for independent control of leds colors;
  • moonlight channel with simple and real time modes;
  • dusk and down effect for LEDs and moonlight;
  • real time clock;
  • water and LEDs heatsink temperature sensors;
  • too high and too low water temperature alarm;
  • safety dimming light when LEDs temperature too high;
  • speed control for heatsink fans;
  • all settings are saved to EEPROM memory;
  • screen brightness control;
  • simple ATO (water top up system) controlled by one float switch.

The number of controlled LEDs channels (colours) can be changed and accordingly the main screen, leds menu, test and color mixer screens will display info only for configured LEDs channels. Also the names and colours of bars are configurable for each channel.

Moonlights can work in two modes: simple and real time.
In simple mode moonlight is on between preconfigured times (the same for every day).
In real time mode moonrise and moonset times are calculated for current day and configured latitude / longitude. So the times when moonlight is on will vary from day to day the same as for real moon. Moonrise and moonset times are displayed on main screen.

Moonlight configuration screen:

Redesigned screen to change LEDs output values:

Colour mixer that allow to check LEDs colour blending:

For all features and screenshots see the documentation.
If something is missing or not clear as it should be please let me know.

Hey, your controller looks great. However, I am having trouble getting the code to compile i keep getting the following errors:

/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'uint8_t DS1307new::isPresent()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:47: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::stopClock()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:55: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:58: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:60: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:61: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::startClock()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:68: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:71: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:73: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:74: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::getTime()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:82: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:85: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:86: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:87: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:88: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:90: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:91: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:92: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::setTime()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:106: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:107: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:108: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:109: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:110: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:111: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:112: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:113: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::getCTRL()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:121: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:128: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::setCTRL()':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:135: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:136: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::getRAM(uint8_t, uint8_t*, uint8_t)':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:146: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:156: error: 'class TwoWire' has no member named 'read'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp: In member function 'void DS1307new::setRAM(uint8_t, uint8_t*, uint8_t)':
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:166: error: 'class TwoWire' has no member named 'write'
/Users/DJW/Documents/Arduino/libraries/DS1307new/DS1307new.cpp:169: error: 'class TwoWire' has no member named 'write'

OK all the errors are gone, but now the screen just flashes and refreshes every second or two. Could it be because I haven't installed the RTC module yet?

No, I don't think so. If arduino can't see RTC then some weird numbers are displayed instead of time and date.
I think it something with the screen, did you manage to successfully run examples from UTFT library?

Vasco,

I want to thank you as seeing your controller a few months back was one of the main reasons I decided to try and make my own. For ATO I have implemented freescales MPXV5004GC7U pressure sensor in order to get accurate water levels. It is extremely simple to use and is quite accurate. Here is a link to the product

Nick D.

vasco:
No, I don't think so. If arduino can't see RTC then some weird numbers are displayed instead of time and date.
I think it something with the screen, did you manage to successfully run examples from UTFT library?

Yeah, all the examples work properly, and I can even get some simple sketches that I created to run no problem. Weird part is, i commented out a a section of the sketch pertaining to the clock (forgot where it is, ill try to look for it) and it caused the main screen to load fully, but right after loading it went to a menu screen with options to adjust the clock, led stuff, and some other things, but I couldnt tap on anything.