Improved Arduino LED lighting code - Page 10 - The Planted Tank Forum
 3Likes
Reply
 
LinkBack Thread Tools Display Modes
post #136 of 219 (permalink) Old 02-21-2013, 05:46 PM
Algae Grower
 
Join Date: Apr 2012
Location: Denmark
Posts: 19
The IRF520 has a max power dissipation at 60w and i have only 10 watt pr channel it is the reason i am concerned that it is hot not much but 45 degrees celsius!!
The IRF520 Has a gate threshold voltage at 4 volts max and the arduino put out 4,8 voltage so i need a resistor between arduino and gate which is 10 ohm or am i wrong ????
Gisimo is offline  
Sponsored Links
Advertisement
 
post #137 of 219 (permalink) Old 02-21-2013, 06:04 PM
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,398
45 C isn't too bad. It's not boiling hot.

R = V/I
5 = (5-4) / .2 ?

5 ohm seems to be it but 10 ohm should work too.

mistergreen is online now  
post #138 of 219 (permalink) Old 02-21-2013, 06:13 PM Thread Starter
Algae Grower
 
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Quote:
Originally Posted by Gisimo View Post
Hi all i was wondering if it is possible to implement auto daylight savings time so it automatic change the time?!
I know I haven't been around much, but I'm thrilled to see people are still using the code!

The main reason there is no auto-daylight savings code is that a library to do that (if a clean one even exists for the Arduino) would take up too much amount of the limited space available on the unit. Given how easy it is to just update the time twice a year I figured it wasn't worth it.
sink is offline  
post #139 of 219 (permalink) Old 02-21-2013, 06:48 PM
Algae Grower
 
Join Date: Apr 2012
Location: Denmark
Posts: 19
Thank you for your help !!
Gisimo is offline  
post #140 of 219 (permalink) Old 02-21-2013, 07:42 PM
Planted Tank Enthusiast
 
O2surplus's Avatar
 
Join Date: Jan 2010
Location: "Out West, in the Land of Fruits & Nuts"
Posts: 818
Quote:
Originally Posted by sink View Post
I know I haven't been around much, but I'm thrilled to see people are still using the code!
Hey Sink! Glad to see that you're still around. I'd been wondering where you'd disappeared too?

225 Gal, Glass "Reef Ready" w/ twin Iwaki Pumps & 2 Ocean Clear inline filters.Lighting- Custom built DIY 600 watt LED system, BlueFish "mini" Led Controller,iAqua Aquarium Controller , and a 20lb CO2 system w/ Milwaukee Ph Controller.
O2surplus is online now  
post #141 of 219 (permalink) Old 02-21-2013, 08:09 PM Thread Starter
Algae Grower
 
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Hi buddy. I hope you're well
Work, mostly, with the woods being a close second. Also my tank is well established and the lighting setup Just Works so I haven't spent a lot of time thinking about the internals.
sink is offline  
post #142 of 219 (permalink) Old 02-22-2013, 07:08 AM
Algae Grower
 
Join Date: Apr 2012
Location: Denmark
Posts: 19
Hey sink would it be possible to make 3 channels instead of two??
I have one blue light and i would like to use it as a moon light !!
And i alreaddy use the two channels !!
Gisimo is offline  
post #143 of 219 (permalink) Old 02-22-2013, 12:01 PM Thread Starter
Algae Grower
 
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
That has been a common request. I may end up adding a binary (just off or 5V) moonlight output eventually, but I am hesitant to add too much complexity. In many ways, the code is already more complex than I want it to be -- the plan was to have a barebones lighting system that was simple enough behind the scenes that by looking at it, reasonably techie people could see how to add their own things (CO2 control, temp, etc) where needed.

In any case, if I had a single moonlight I would just rig it to be on all of the time. Much easier and you won't notice it on during the day anyway with the normal lighting active.
sink is offline  
post #144 of 219 (permalink) Old 02-22-2013, 03:55 PM
Algae Grower
 
Join Date: Apr 2012
Location: Denmark
Posts: 19
Ok tanks sink!!
Gisimo is offline  
post #145 of 219 (permalink) Old 04-04-2013, 04:50 AM
Algae Grower
 
Join Date: Oct 2011
Location: Franktown,CO
Posts: 5
Hey Sink, so i'm really liking the look of your code and would like to use it on my new pico reef. However, I need 6 channels to control the fixture. How would i go about adding 4 more outputs? It seems to me i'd need to add the libraies for the other 2 timers, but will using different timers effect my dimming between channel's? I'm still very new to arduino, (this is my very first project) so i would very much appreciate your help. Thanks!
shrimper23 is offline  
post #146 of 219 (permalink) Old 04-04-2013, 03:26 PM Thread Starter
Algae Grower
 
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Quote:
Originally Posted by shrimper23 View Post
Hey Sink, so i'm really liking the look of your code and would like to use it on my new pico reef. However, I need 6 channels to control the fixture. How would i go about adding 4 more outputs? It seems to me i'd need to add the libraies for the other 2 timers, but will using different timers effect my dimming between channel's? I'm still very new to arduino, (this is my very first project) so i would very much appreciate your help. Thanks!
The TimerOne library is only there to provide high-resolution output -- if coarser control is fine for your other channels you don't need libraries for them. Dimming for other channels would be the same, except your range would only be 8 bits (0-255) so you'd have to figure the math for that out in the code. As far as how the timers interrelate to each other...I'm not positive It probably varies by device, but Google should be able to provide an answer there. It may be that you are limited to how many PWM outputs you can sent at once using the HW timers.

For making the changes to the code, you'd just basically duplicate what I've done for the two channels for the other four, creating appropriate variables and adding lines where needed in the dimming code etc. It's not that bad.
sink is offline  
post #147 of 219 (permalink) Old 04-04-2013, 11:11 PM
Algae Grower
 
Join Date: Oct 2011
Location: Franktown,CO
Posts: 5
So if I added the libraries would I achieve higher resolution outputs on the other 4? What is the resolution of the outputs as the code stands? Could I perhaps add an I2C pwm breakout to my contoller such as this one? http://adafruit.com/products/815
I'd like to retain the higher resolution on all channels if possible. Also, I am using meanwell LDD-L's to drive my LED's if it makes any difference.
shrimper23 is offline  
post #148 of 219 (permalink) Old 04-04-2013, 11:46 PM Thread Starter
Algae Grower
 
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Quote:
Originally Posted by shrimper23 View Post
So if I added the libraries would I achieve higher resolution outputs on the other 4?
Theoretically, but it is awkward. For example, messing with the settings for Timer0 will affect built in functions like delay() and millis() because they get their timing from it under the hood. There might be libraries to compensate for this, but I haven't really looked.
Quote:
What is the resolution of the outputs as the code stands?
Normally Arduino PWM outputs are 8 bits. The TimerOne library allows 10 bits resolution on its two outputs.
Quote:
Could I perhaps add an I2C pwm breakout to my contoller such as this one?
That thing looks sweet! 16 independent outputs with 12 bits of resolution. You'd have to make some changes to the code to use it, but ultimately with 6 (or more) outputs the code would be simpler using something like that. Plus you wouldn't have to deal with the libraries. Do note that at some point the limiting factor for how precisely you can set light level will be the driver itself (and how it interprets the PWM signal) and not the resolution of the PWM output itself.

Quote:
I'd like to retain the higher resolution on all channels if possible. Also, I am using meanwell LDD-L's to drive my LED's if it makes any difference.
The driver does certainly make a difference, but I couldn't speak as to how well the PWM control is for that driver. The control on some drivers is quite nonlinear at the low end (< 10% of light output) and can be inconsistent for fast PWM signals.
sink is offline  
post #149 of 219 (permalink) Old 04-05-2013, 03:15 AM
Algae Grower
 
Join Date: Oct 2011
Location: Franktown,CO
Posts: 5
Sounds like I need to order that breakout! I already have 2 slave devices on my I2C, I would think adding this would be alright, correct me if I'm wrong. These are the current devices:
http://www.adafruit.com/products/264
http://www.adafruit.com/product/772
Better yet, I can now get full control on the refugium lights as well! 7 channels over a 4 gallon, gotta love DIY!

I was originally planning on the CAT's, then I got talking to a customer while testing his water. He peaked my interest when he told me about the LDD's. Then brought me 2 of the PCB's he had for them as a Christmas gift! From what I've read they have the best of dimming accuracy so I don't think it should be an issue.
shrimper23 is offline  
post #150 of 219 (permalink) Old 04-09-2013, 10:50 PM
Algae Grower
 
Join Date: Oct 2011
Location: Franktown,CO
Posts: 5
Any idea on the I2C capability guys? Also, Sink, a quick question on your code, I see you name the channels with a "k". Such as kChan0Pin, is there a reason for this? Just wondering as I haven't seen this before.
shrimper23 is offline  
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:
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:
OR

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
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode



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
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome