Improved Arduino LED lighting code - Page 8
Planted Tank Forums
Your Tanks Image Hosting *Tank Tracker * Plant Profiles Fish Profiles Planted Tank Guide Photo Gallery Articles

Go Back   The Planted Tank Forum > Specific Aspects of a Planted Tank > DIY


Reply
 
Thread Tools Display Modes
Old 04-12-2012, 03:46 PM   #106
Gisimo
Algae Grower
 
PTrader: (0/0%)
Join Date: Apr 2012
Location: Denmark
Posts: 17
Default

hi i have just testet the code and now it works.....
i donīt understand what has happened but now i worked!!! so thanks....
Gisimo is offline   Reply With Quote Quick reply to this message
Sponsored Links
Advertisement
 
Old 04-22-2012, 06:51 PM   #107
Travelbug
Newbie
 
PTrader: (0/0%)
Join Date: Apr 2012
Location: Mississauga Ontario, Canada
Posts: 1
Default LED lighting with Arduino PWM controller

Hello O2Surplus/Sink!

I just stumbled across this forum and your thread on your LED lighting project!
Awesome work guys!! (first post...)

I am amazed because I have been working on a similar system - so similar its scary actually!

I had someone make some circuit boards with CAT4101 chips and 5v regulators with phoenix contact screw connectors to attach to strings of 6 CREE LEDs (XPG/XPE) and a 24v power supply. I bought the LEDs already (108 ) along with my 1 foot slabs of heat sink. The idea is to put 36 LEDs (6x6 array) per slab and control 3 colours (18white/12blue/6violet) independently via PWM from an Arduino and a Chronodot.
I have all the components but haven't put it all together. You guys are way ahead of me, but nearly identical plan!

Would love to see your circuit diagram on the cat4101 to compare to mine as well, your arduino code would save me hours and hours I am sure!!

any chance at getting a peek?

Again - would love to see a pic of the finished product - I plan to document my progress as well and am fine with sharing anything I do/have in terms of hardware/code/ideas.

Martin aka Travelbug.
Travelbug is offline   Reply With Quote Quick reply to this message
Old 04-23-2012, 06:39 PM   #108
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: yorba linda, ca.
Posts: 538
Default

Hey TravelBug,

Here are the EAGLE files and a Bill of Materials for a 4 channel version of my CAT4101 driver board led driver. My design includes an Analog current adjustment for each channel of leds and a 12 volt power regulator for cooling fans ect.. Let me know if you need any help with design changes as I can quickly customize it for you if you'd like
Attached Files
File Type: zip 4upcatver5.0 EAGLE FILES.zip (62.1 KB, 176 views)
O2surplus is online now   Reply With Quote Quick reply to this message
Old 04-29-2012, 05:47 PM   #109
max2012
Newbie
 
PTrader: (0/0%)
Join Date: Apr 2012
Location: Lissone, Italy
Posts: 1
Default

Quote:
Originally Posted by sink View Post
Certainly possible, though due to storage requirements on the Arduino you'd have to approximate the sunrise/sunset times with an equation rather than hard coding it. Another possible thing would be have moonlights (if using them) follow a lunar cycle and wax and wane accordingly. Cool stuff. That said I'm way too busy to do any of this stuff, but I can help with code issues if anybody wants to try.
Hello everyone,
I'm new to the forum and I recently used with success Arduino LED lighting code, I state that I am not a programmer but, I follow with interest the development of the project and I'd like to contribute.
I found a code (which I tested) that in relation to date returns the correct time for sunrise and sunset.
It would be very nice to try and implement it.
You can find the source code at this link
http://www.arduino.cc/cgi-bin/yabb2/...1292938893/all
max2012 is offline   Reply With Quote Quick reply to this message
Old 05-22-2012, 07:05 PM   #110
hylik
Algae Grower
 
PTrader: (0/0%)
Join Date: Mar 2011
Location: Dominican republic
Posts: 13
Default

great code...thanks o2surplus for recomendation....
hylik is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 05:35 PM   #111
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 147
Default

Quote:
Originally Posted by Travelbug View Post

Would love to see your circuit diagram on the cat4101 to compare to mine as well, your arduino code would save me hours and hours I am sure!!

any chance at getting a peek?

Again - would love to see a pic of the finished product - I plan to document my progress as well and am fine with sharing anything I do/have in terms of hardware/code/ideas.

Martin aka Travelbug.
I'll borrow a camera and try to take some photos of my setup next week. The wiring doesn't look like much (I'm very much from the "get it done with whatever you have on hand" school of DIY) but I think the design for my hood is a nice balance of cheap, stylish and simple.

I'm sure you found it, but the code can be found at the link in the first post. It needs the 0023 and earlier versions of Arduino due to some library incompatibilities. Fixing that is on my todo list.

On that note I should also point out that I'll happily accept patches if anybody wants to add features/fix bugs/make the code run on arduino 1.0+. Just PM me or use the bitbucket repository in the first post.
sink is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 05:51 PM   #112
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 147
Default

Quote:
Originally Posted by max2012 View Post
Hello everyone,
I'm new to the forum and I recently used with success Arduino LED lighting code, I state that I am not a programmer but, I follow with interest the development of the project and I'd like to contribute.
I found a code (which I tested) that in relation to date returns the correct time for sunrise and sunset.
It would be very nice to try and implement it.
You can find the source code at this link
http://www.arduino.cc/cgi-bin/yabb2/...1292938893/all
This is pretty cool. It wouldn't be too hard to implement if there is sufficient interest from people. I think I like having a nice consistent 12hr day in my tank though -- it lets me pretend I don't live in the frozen northern wastes.
sink is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 06:15 PM   #113
jcgd
Wannabe Guru
 
jcgd's Avatar
 
PTrader: (6/100%)
Join Date: Feb 2004
Location: Calgary, Alberta, Canada
Posts: 1,985
Send a message via MSN to jcgd
Default

Something I have no idea how to add, but would love would be a minimum dimmming setting. Most of my lighting I want to fade all the way off, but is it possible to have a string stop at minimum value to act as the moonlights and then ramp up and down normally with the rest I the strings?
jcgd is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 06:41 PM   #114
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 147
Default

Quote:
Originally Posted by jcgd View Post
Something I have no idea how to add, but would love would be a minimum dimmming setting. Most of my lighting I want to fade all the way off, but is it possible to have a string stop at minimum value to act as the moonlights and then ramp up and down normally with the rest I the strings?
Ta-daa! This feature is mostly built in already.

Code:
const int kDayState[] = { 600, 400 }; // daytime LED state
const int kNightState[] = { 0, 0 }; // nighttime LED state
Those two lines set the maximum (daytime) and minimum (nighttime) states for the two channels. The possible values for each number range from 0 (off) to 1024 (full power). The first number in each array is for channel one, the second number is for channel two. The default is to have kNightState be {0,0} which turns both channels all off. But you could change that (for example) to {10,0} to have channel one dim to ~1% intensity during nighttime instead of turning off. You'll probably have to experiment with the right number for your setup -- some drivers can't dim below a certain threshold and just cut off entirely rather than dimming.

Note that you can only *control* two channels using my code. If you have four strings and only want one to act as a moonlight, you could connect three of your strings to one channel and the fourth to the second channel and then control them that way.

Does that meet your requirements?
sink is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 07:07 PM   #115
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: yorba linda, ca.
Posts: 538
Default

Sink-

"JCGD" is running 2 of the controllers that I built for him, so he's up against the software limitations that are inherent to the original "Typhon" Firmware. Have you made any progress with modding the original code to make it behave more like your own AKL Tank Control code?
O2surplus is online now   Reply With Quote Quick reply to this message
Old 05-24-2012, 07:43 PM   #116
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 147
Default

Quote:
Originally Posted by O2surplus View Post
Sink-

"JCGD" is running 2 of the controllers that I built for him, so he's up against the software limitations that are inherent to the original "Typhon" Firmware. Have you made any progress with modding the original code to make it behave more like your own AKL Tank Control code?
Ah, my misunderstanding. My comments above apply to my code only.

I stalled on that point because the LCD control code in the Typhon firmware was such a spaghetti mess that to get the good stuff from my code in there would require rewriting everything -- a sizeable task and I'm trying to focus on work that allows me to eat

That said I still have visions of getting that done at some point.
sink is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 07:48 PM   #117
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 147
Default

I should point out that if people want to run my code on the Typhon, they can, with probably a few very minor modifications that I could help with. There would be some limitations -- the LCD wouldn't be functional and you'd only have two channels to spread out among your strings. But you would get the benefits of much smoother dimming and higher resolution on the LEDs. You'd need an adapter to let you reflash the Arduino to do this, since the Typhon doesn't speak USB.
sink is offline   Reply With Quote Quick reply to this message
Old 05-24-2012, 07:54 PM   #118
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: yorba linda, ca.
Posts: 538
Default

Quote:
Originally Posted by sink View Post
Ah, my misunderstanding. My comments above apply to my code only.

I stalled on that point because the LCD control code in the Typhon firmware was such a spaghetti mess that to get the good stuff from my code in there would require rewriting everything -- a sizeable task and I'm trying to focus on work that allows me to eat

That said I still have visions of getting that done at some point.
No worries- we all have to make a living! No one wants to hear that "sink" is posting thread replies while living under a highway overpass. We need our software guru well fed and happy.
From what you've seen in the original Typhon firmware, do you think a "Minimum ON state" variable could be added to that code? I'd take a stab at adding it myself - if you think it can be done?
O2surplus is online now   Reply With Quote Quick reply to this message
Old 05-24-2012, 08:14 PM   #119
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 147
Default

The problem is that to add it and make it functional for people to use without having to reflash to make changes means not just adding the that minimum state check in the code (which isn't terribly hard), but also adding a new option to the LCD menu, which requires extensive changes to the LCD code (which sucks).
sink is offline   Reply With Quote Quick reply to this message
Old 05-25-2012, 02:53 AM   #120
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: yorba linda, ca.
Posts: 538
Default

Hey I've got an Idea! Now that I can buy Atmega's cheap and burn my own boot loaders, do you think we could do a complete re-design of the controller to use Dgital pins #9 & 10 from multiple ATMEGA chips using I2C or some other clever means? It should be possible? I don't know of hand if we would have to use some sort of master/slave configuration to do it or do it through a rotary encoder switch to address and send commands to multple AVR's? What do you think? If you can dream up the coding, I can build the prototype and we can have a controller that's truly our creation.
O2surplus is online now   Reply With Quote Quick reply to this message
Reply

Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in

Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright Planted Tank LLC 2012