Which arduino for small led project?

Hello everyone! New to this forum, however I intend on posting here a lot in the future. Fluorescent ballast just went out on a small aquarium I have (5 gallon shrimp tank), so I've decided to build my own led light fixture for it. Just ordered the parts:

The goal is to eventually have it wired to an Arduino system to control the lights, display various temperatures and other parameters on a 3.2" led touchscreen, and eventually an auto-dosing system for the fertilizer. My question is if the Arduino Uno- R3 would be a good board for this project? Thanks!

Maybe.
Uno gets you 20 IO to work with. 14 digital, and 6 analog/digital.
How many sensors are you planning to use with all your stuff and how many does the touchscreen need?
Start making a list.

Thanks for the advice! Sounds like a good starting plan.

Sensors

  • Water Temp
  • LED Heatsink Temp
  • pH Probe
  • LED control
  • One day control 3 small pumps for auto-dosing
  • Lcd Screen (20 pins)
  • Touch Panel (5 pins)

In a thread by another fellow aquarist it seems the Mega 1280 was used. [/list]

LCD screen needs 20 pins? Wow.
I guess it is doing two functions - input sensor and displau screen.

I would reccomend an serial LCD only uses 1 pin for data and 2 for power. I have always used them they are extremely easy to setup and no libraries required

Thanks for the replies!
I may indeed resort to a serial LCD, we'll see how things go.
I recently ordered the Arduino Mega 2560 so hopefully I'll have more than enough i/o pins to work with.
I'm in the process of ordering sensors and a breadboard, and I saw this IR distance sensor:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=47

I thought this would be a perfect sensor to mount in the light fixture hood and sound an alert when the water reaches a dangerous level (too much or too little; I intend on having an automatic water replacement feature as well), however I don't know how well the distance sensor would work with water, if at all. What do you guys think?

Hi,
Interesting; I have never tried that sensor towards a water surface. Hmmm. Could work. (Maybe).. the sensor works by sending out an IR beam and looking for a reflection. The angle is mechanically adjustable. You'd have to experiment with the orientation.

INFO on the ArduinoInfo WIKI here - http://arduinoinfo.info http://arduino-info.wikispaces.com/InfraredDistanceSensor

Does IR "reflect" off water surface?? Anyone??

I'll probably get to give this a try tomorrow..

terryking228:
Does IR "reflect" off water surface?? Anyone??

Visible light and UV light do, so I would have thought IR would too - but I don't know how much.

I just tried a very unscientific test with an IR thermometer and a tub of water. I could get a noticeable heat reflection off the water, it seemed to reflect better at very low angles of incidence - as you'd probably expect - but based on the apparent temperature I'd guess the maximum reflection was no more than about 10%.

Hmm, very interesting, thanks for the replies. I have a feeling with very still water this would work consistently, however since I like a little surface agitation this may not be the best route.

I recently purchased some temperature sensors; a waterproof sensor for the tank and a regular one for the LED heatsink. I also finally bought a 3.2" TFT touchscreen lcd for the project. After even more research it seems like I can run it off 12-13 pins.

While I anxiously wait for everything to arrive I decided to start getting familiar with the code. I'm quite used to fortran programming, however I've heard this is more like C++, so it has been a learning experience.

One of my new questions is what kind of time programming is there for arduino?
My first task I set myself to was figuring out the code for sunrise/sunset dimming.
The goal is to simulate real life sunrise/sunset, therefore I was going to have the dimming
be faster for the first and last hour of daylight. So for the fade amount I was thinking:

  • 0-150 For the first hour of daylight
  • 150-255 Until Midday
  • 255-150 Until an hour before dark
  • 150-0 For the last hour of daylight

I used the sample code this website has for led fading as a base code:

int led = 9;           // the pin that the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup()  {
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop()  {
  // set the brightness of pin 9:
  analogWrite(led, brightness);    

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }    
  // wait for 30 milliseconds to see the dimming effect    
  delay(30);                            
}

However I was going to have an if-else structure that changes the delay based on the brightness.
For example:

if (brightness < 150)
{delay(24000)}
else
{delay(137142)}

However I would have to use a delay in the program for the hours when the light is off. I was wondering if there's any
'clock code', where I have a real-time clock running and I could base the programming off of that?

Perhaps I need to buy a RTC

Or run the clock code you mention.
Battery backed RTC does have the advantage of getting you thru a power outage:
http://www.dipmicro.com/store/DS1307N
http://www.dipmicro.com/store/XC4-32768
couple of resistors for I2C pullups
http://www.dipmicro.com/store/R3F47-4
http://www.dipmicro.com/store/BAT-CR2032
http://www.dipmicro.com/store/BH120591-1

$2.17, ~$2 for shipping.

Just bought everything you listed, thanks for the advice! I really appreciate it.
Thank you also for sharing that website, I've been bouncing back and forth between electronic supply websites and so far this one seems the most comprehensive while maintaining a user friendly interface.

www.taydaelectronics.com inThailand has a good prices too.

Thanks! I'll have to check them out.

For the past couple hours I've been working on deciphering code written for the lcd screen.
I'm using the code from this page (thanks Jeremy!):

http://thecustomgeek.com/2012/08/28/jos-updated/

My problem is this comment:
"First, this is code for the Touch Shield, but it can easily be changed to the breakout board, and don’t forget to uncomment the ‘#define USE_ADAFRUIT_SHIELD_PINOUT’ line in Adafruit_TFTLCD.h file."

I believe what I bought is the breakout board which means I need to "uncomment the ‘#define USE_ADAFRUIT_SHIELD_PINOUT’ line in Adafruit_TFTLCD.h file."

However, when I opened the .h file I had a very hard time making any sense of it.
I finally found the line he's talking about by doing the Find function for the word "define".
There was a ton of code all on one line. So much that it exceeded the limit for this forum, so I
posted only a portion of it. I also made what the programmer is referencing red so it would be easy to find.

#if ARDUINO >= 100

 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif
#include <Adafruit_GFX.h>

// **** IF USING THE LCD BREAKOUT BOARD, COMMENT OUT THIS NEXT LINE. ****
// **** IF USING THE LCD SHIELD, LEAVE THE LINE ENABLED: ****
#define USE_ADAFRUIT_SHIELD_PINOUT
class Adafruit_TFTLCD : public Adafruit_GFX {
 public:
  Adafruit_TFTLCD(uint8_t cs, uint8_t cd, uint8_t wr, uint8_t rd, uint8_t rst);<

I just have no idea what to actually comment out with all the gibberish in there.

You need to find a way to copy it so that you are not getting all the HTML code.

For something like this I'd go with a Teensy or Teensy++ board.
http://www.pjrc.com/teensy/
Much smaller and easier to use for custom one off designs.
You can solder on header pins and then use it directly in a breadboard while prototyping and
debugging the cirtuit.
When it all works, then move all the parts to a breadboard prototype board and solder
them in to make it permanent.

--- bill

Ahh, of course!
I tried to save the file by right clicking and then 'save link as', I was wondering where all that html code came from.
Thank you very much for all your help so far, you've saved me many many hours of frustration. I can't thank you enough.

I recopied all the files and my long long list of errors was greatly reduced.
Unfortunately now I get the error:

Sample1.cpp:10:3: error: #error "For use with the shield, make sure to #define USE_ADAFRUIT_SHIELD_PINOUT in the TFTLCD.h library file"

Which I assume is caused by this If statement:

#if not defined USE_ADAFRUIT_SHIELD_PINOUT
 #error "For use with the shield, make sure to #define USE_ADAFRUIT_SHIELD_PINOUT in the TFTLCD.h library file"
#endif

However I don't know why it would be programmed to return an error from doing something I was instructed to do.
Perhaps I should just comment out that if statement?

I'm also getting this error:

Sample1.cpp: In function 'void setup()':
Sample1:137: error: 'class Adafruit_TFTLCD' has no member named 'readRegister'

And it highlights this code:

uint16_t identifier = tft.readRegister(0x0);

I tried searching the Adafruit_TFTLCD library for the term "readRegister" and "tft.readRegister" but could not find anything.
I was wondering if it was something simple that an amateur arduino programmer like me is missing, or if that library file is actually
missing the variable "readRegister".

The arduino arrived today! Hopefully by the end of tonight I'll be able to get the LED's running on the arduino.

Can't help you on the screen/library, no experience with those.