|
||||||||||||||||
|
||||||||||||||||
|
|
#121 |
|
Newbie
|
Hello guys,
great work! I installed the code on my Arduino Uno (with DS1307) and it works perfect! I build a lamp with two strings (? or circuits?), one with warm white and one with cold white LEDs to simulate the sunrise. The lamp is driven by 2 PT4115 constant current regulators with 24V at ~1,1A. So I have round about 50W LED light power! The only problem is now, how can I switch the 2 PWM outputs separately? For example: ww begins at 8h for 1h and after 45min the cw starts. Now it starts simultaneously. It is possible to reduce the time for the moonlight? I think 2h (22-0) is enough. The feature list says it is possible: "Flexible timing logic. You can do anything you want (with minor modifications) so long as it's on a 24hr cycle." Regards Knut PS: Sorry for my bad english, I hope u understand me. |
|
|
|
|
|
#122 |
|
Planted Tank Obsessed
|
From what I can tell, by reading the sketch, both channels are governed by the same set of constants. Sink would have to re-write the code to make each channel independent of the other. I'm no expert in code writing but I think it's possible. Sink is the ultimate authority on that Subject though.
|
|
|
|
|
|
#123 |
|
Newbie
|
@Sink: Help me please
Yes, I think you are right. So I wait for a reply from the master Sink! |
|
|
|
|
|
#124 |
|
Newbie
|
I have been looking for a solution like this, but was considering rgb. I an new to this, so what ask is required to get a working set up for a 80 gal salt tank ? DIY is not an issue for me as I have done holiday DIY for years now. Please lead me in the right direction as far as parts go. I would like to simulate the correct color temperatures for the full 24 HR cycle. Thank you in advance.
|
|
|
|
|
|
#125 |
|
Newbie
|
It's not much of a contribution but I'm sure this would save you a lot time rewriting the code.
You mention that this code is pre ver 1.0 Arduino I have managed to compile it get it working on a Ver 1.01 Arduino UNO Rev3 with changing one Library Time.h Thanks for the great code hope this helps to the cause. Last edited by chuckxx; 12-03-2012 at 04:27 PM.. Reason: typos |
|
|
|
|
|
#126 | |
|
Planted Tank Obsessed
|
Quote:
Thanks A Lot! That's a big help for people running Arduino 1.0l
__________________
|
|
|
|
|
|
|
#127 |
|
Newbie
|
Ok I have been at this for a week now, I too was looking at getting my RGB lights running off of this simple but wonderful code.
But looking into it getting it to run on the Uno was the easy part but getting 3 CH timer is an other story entirely and I'm not programer I'm more of a band aid hacker lets say. Well to explain it shortly the Arduino has 3 Timer, Timer0, Timer1, Timer2, each one of these timers have 2 CH with a variety feature for each. It polls an compares the millis() and Freq ch A, B. The timers and says hey you need to Turn on, or off, or Fade, ext.. but each timer has 2 Registers to keep track of the time. And see this is a great feature and what makes this code great, Is its not taking up all your clock times(CPU) while trying to keep track of the time and do other things. Like keeping track of Temps, or controlling your 3 speed pump or turing them on and off ect.. I tried to add one of the other timer from pin 11 but I don't have all the programming knowledge to get it to work properly, I mean it was working sort of. So I'm taking the easy route and using the Arduino Mega 2560 it adds 3 more 16 Bit Timers. Making it easy to modify the code to work withe RGB lights. Plus if you really wanted too you could use both Timer1 for your main lights and Timer3 for your complementary RGB Lights. I am plaining to adding lots more features I just need to mash all this code a have together like setting the time from the LCD Unit it self with 2 Buttons or a rotary encoder, Alarms to tell you its time to do Water changes or clean your filter. If any one is interested when I get it all done I can post it up. Cheers! Happy coding.. Oh here's the Timer3 file for the Mega I have it using Pin 5,3,2 And you need to add or change this code. I'm still trying to debug the Error so if you find one or see something wrong let me know. Code:
#include <TimerThree.h> const int kChan0Pin = 5; // Channel 0 Pin const int kChan1Pin = 2; // Channel 1 Pin const int kChan2Pin = 3; // Channel 2 Pin Code:
const int kDayState[] = { 1023, 1023, 1023 }; // daytime LED state
const int kNightState[] = { 0, 0, 0 }; // nighttime LED state
Code:
int state_chan1, state_chan2, state_chan3; Code:
void fader(long start_time, const int start_state[], const int end_state[], int out[3]) {
float per_second_delta_0 = (float) (end_state[0]-start_state[0])/kFadeDuration;
float per_second_delta_1 = (float) (end_state[1]-start_state[1])/kFadeDuration;
float per_second_delta_2 = (float) (end_state[2]-start_state[2])/kFadeDuration;
long elapsed = ctr-start_time; // Calculate the elapsed Time
out[0] = start_state[0] + per_second_delta_0 * elapsed;
out[1] = start_state[1] + per_second_delta_1 * elapsed;
out[2] = start_state[2] + per_second_delta_2 * elapsed;
}
Code:
void set_state(const int state[]) {
if (state[0] >= 0 && state[0] <= 1023) {
Timer3.setPwmDuty(kChan0Pin, state[0]);
state_chan1 = state[0]; }
if (state[1] >= 0 && state[1] <= 1023) {
Timer3.setPwmDuty(kChan1Pin, state[1]);
state_chan2 = state[1]; }
if (state[2] >= 0 && state[2] <= 1023) {
Timer3.setPwmDuty(kChan2Pin, state[2]);
state_chan3 = state[2]; }
}
Last edited by chuckxx; 12-09-2012 at 11:59 PM.. Reason: Opps forgot the file |
|
|
|
|
|
#128 |
|
Wannabe Guru
|
so uh... does anyone want to put together a shopping list via amazon.com?
I'd love to get started on this to eventually control the lights and co2 of a 125g. I've heard of the arduino and knew it was being used for fun stuff like this. I'm a web developer by trade, so this hardware stuff is quite confusing to me, but i can definitely dig into the code. |
|
|
|
|
|
#129 | |
|
Bow ties are cool
|
Quote:
https://www.sparkfun.com/products/11226 It's too much and confusing if you jump right in. If you want to get acquainted with the coding check here http://aquatictechtank.net/viewtopic...bbdb9b12409943
__________________
DIY High Tech Tank forum
http://aquatictechtank.net A forum dedicated to design and program aquatic tanks |
|
|
|
|
|
|
#130 | |
|
Wannabe Guru
|
Quote:
|
|
|
|
|
|
|
#131 |
|
Algae Grower
|
Hi all i was wondering if it is possible to implement auto daylight savings time so it automatic change the time?!
|
|
|
|
|
|
#132 |
|
Algae Grower
|
I need help understanding how an n-fet works i have chosen one ( irf520) it can handel alot of power about 10 amp or so, but why is it getting so hot when it is only handling a load of 1.0 amp?
I have mounted it on a large heat sink because i want to make a salt water one day and i may then nead 6amp pr. Channel!! But how hot vil it be at that load ? Is it becurse i have a resistor betwin Arduino pin 9 and gaten on the fet so it dosent open totely?? Is it nessasery with a resistor? Last edited by Gisimo; 02-21-2013 at 02:26 PM.. Reason: spelling |
|
|
|
|
|
#133 | ||
|
Bow ties are cool
|
Quote:
Quote:
__________________
DIY High Tech Tank forum
http://aquatictechtank.net A forum dedicated to design and program aquatic tanks |
||
|
|
|
|
|
#134 |
|
Algae Grower
|
Thank you!! Every thing works fine i just wondered why it gets hot when it is that little current!!! Is the fet getting hotter if the voltage on the gate is lover than 4.8 volts? Is it necessary to have a resistor in front of the gate?? (Between pin 9 and gate)
|
|
|
|
|
|
#135 | |
|
Bow ties are cool
|
Quote:
The wattage is what makes a component hot or not. Use the correct wattage rated component. P = V*I watts = volt * current
__________________
DIY High Tech Tank forum
http://aquatictechtank.net A forum dedicated to design and program aquatic tanks |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|