(Another) DIY LED Controller - Simple Arduino Style

If you look at my version - there is posibility to change dimming the way you like. You can make any count of step and any size. You can dim blues and whites parallel or one after another . It is couple pages above.

Thanks for the respsone. I was able to put together what I wanted referencing the Arduino Sketches thread.
 
@ Muda: ooops.....sorry,thought you was that

i remember to have read that..... the age...:headwalls:

Perhaps anybody else can help me....



Greetings Ronny

I'm seeing the same thing with the temp. I just got my rtc today an am running a sketch and see that the temp does not update when the blues are ramping. that is as far as I got testing as I just got it running a little while ago. I'm waiting on my drivers so I'm just looking at the display for testing.
 
Temp freezing

Temp freezing

I think i´solved this little problem.
I´m using Muda´s sketch,just a little modified.
There are "while" commands for dimming like this:

Code:
    /*||||||||||||||||||||||||||||||||||||||||||   F A D E  I N ||||||||||||||||||||||||||||||||||||||||||||||*/

 if (daybyminute >= (ontime*60))
   { if (daybyminute < ((ontime*60) + ramptime))
    {
      
      AbluftOn();
      BlueledOn();
      MoonledOff();
      MoonOff();
      Temperature();
      
  lcd.setCursor(17, 0);
  lcd.write(9); // Sonnenaufgang
  lcd.setCursor(18,0);
  lcd.write(1);
  //lcd.setCursor(18, 0);
 // lcd.write(0);
 // lcd.write(1);
  lcd.setCursor(4,1);    
  lcd.print("%");
  lcd.setCursor(11,1);
  lcd.print("%");
      int i;
      for (int i = 0; i < abc; i++)
{
  analogWrite(blue, bluepercent[i]);
  analogWrite(white, whitepercent[i]);
  
       lcd.setCursor(2, 1);
       lcd.print((bluepercent[i]*99)/255);
              
       if (i < 10) lcd.print(" ");
              
       lcd.setCursor(9, 1); 
       lcd.print((whitepercent[i]*99)/255);    
       if (i < 10)   lcd.print(" ");
       
       int countdown = ((rampup*60)/abc);
     [COLOR="Red"] [B] [SIZE="5"]while[/SIZE][/B] [/COLOR](countdown>0)
        {
          onesecond();
          countdown--;
          [SIZE="5"][COLOR="Lime"][B]Temperature[/B][/COLOR][/SIZE]();
     
          //lcd.setCursor(6, 1);
          //if (countdown < 100) lcd.print ("0");
          //if (countdown < 10) lcd.print ("0");
          //lcd.print(countdown);
            //lcd.setCursor(16,1);  // Moon
            //lcd.print("off");
        }
A friend of mine told me to insert the temperature Array to the "while" circle und temp will work.

I don´t give a guarantee that this one works,just testing it for myself.
I also hope it´s understandable.

Greets Ronny
 
I think i´solved this little problem.
I´m using Muda´s sketch,just a little modified.
There are "while" commands for dimming like this:

Code:
    /*||||||||||||||||||||||||||||||||||||||||||   F A D E  I N ||||||||||||||||||||||||||||||||||||||||||||||*/

 if (daybyminute >= (ontime*60))
   { if (daybyminute < ((ontime*60) + ramptime))
    {
      
      AbluftOn();
      BlueledOn();
      MoonledOff();
      MoonOff();
      Temperature();
      
  lcd.setCursor(17, 0);
  lcd.write(9); // Sonnenaufgang
  lcd.setCursor(18,0);
  lcd.write(1);
  //lcd.setCursor(18, 0);
 // lcd.write(0);
 // lcd.write(1);
  lcd.setCursor(4,1);    
  lcd.print("%");
  lcd.setCursor(11,1);
  lcd.print("%");
      int i;
      for (int i = 0; i < abc; i++)
{
  analogWrite(blue, bluepercent[i]);
  analogWrite(white, whitepercent[i]);
  
       lcd.setCursor(2, 1);
       lcd.print((bluepercent[i]*99)/255);
              
       if (i < 10) lcd.print(" ");
              
       lcd.setCursor(9, 1); 
       lcd.print((whitepercent[i]*99)/255);    
       if (i < 10)   lcd.print(" ");
       
       int countdown = ((rampup*60)/abc);
     [COLOR="Red"] [B] [SIZE="5"]while[/SIZE][/B] [/COLOR](countdown>0)
        {
          onesecond();
          countdown--;
          [SIZE="5"][COLOR="Lime"][B]Temperature[/B][/COLOR][/SIZE]();
     
          //lcd.setCursor(6, 1);
          //if (countdown < 100) lcd.print ("0");
          //if (countdown < 10) lcd.print ("0");
          //lcd.print(countdown);
            //lcd.setCursor(16,1);  // Moon
            //lcd.print("off");
        }
A friend of mine told me to insert the temperature Array to the "while" circle und temp will work.

I don´t give a guarantee that this one works,just testing it for myself.
I also hope it´s understandable.

Greets Ronny


I will give it a try also. Thanks!

My 20x4 and other goodies just showed up yesterday.:D:D I was trying the sketch with the weather patterns but can't get the temp to show. Not sure what I am doing wrong there.
 
So I pasted that code into the section you were talking about and the temp does update during the ramp up and down now. It did screw with the timing though. The count now takes twice? as long. I tried to get rid of the delays in the temp code which helped a little.

My RTC freaked out and started reading all kind of strange times and was not counting. I could not reset it even after pulling the battery. I tried a few more times and it finally came around and is working now. Not sure what that was all about.
 
Hi

I have the same problem,but i saw it yesterday evening when i was at home.
I was confused too.
Sorry,that it doesn´t work. It was a tip of a friend of mine.
Just try to get rid of this....
If you know how it could be solved please let me know.
I´m working on it,but could not understand why the Arduino do what it do...:headwally:

Greetings Ronny
 
Sorry,that it doesn´t work. It was a tip of a friend of mine.

It does work but just messes with the fade out timings. I can adjust my fade times accordingly. :D

I still want to get the weather patterns sketch by liquidart to work. That one looks really cool. For some reason, it wont execute the whole sketch. It will only show about half of the info out. I put some lcd.print statements in the temp section and it never prints them so I guess it never even gets that far in the script. I will play around with that one some more.
 
Here´s something for you....
The same Array i use in my Sketch.
Code:
//>>>>>>>>>>>>>>>> D E F I N E   T E M P E R A T U R E DS18B20 <<<<<<<<<<<<<<< 
void Temperature()
{
sensors.requestTemperatures(); // Send the command to get temperatures
//delay(750);
 lcd.setCursor(2, 3);//Watertemp=2
 
float temp1=0, temp2=0;  //temp1 = LedTemp, Temp2 = Watertemp
 
 temp1=sensors.getTempCByIndex(0);
 lcd.print(sensors.getTempCByIndex(0));
 lcd.print((char)223);
 lcd.print("C");
 
 lcd.setCursor(2, 2);

 temp2=sensors.getTempCByIndex(1);
 lcd.print(sensors.getTempCByIndex(1));
 lcd.print((char)223);
 lcd.print("C");
 
 if ((temp2) > 27) // Wassertemp
    {
      digitalWrite(fanwater,HIGH);
      lcd.setCursor(16,2);
      lcd.print("on ");
      lcd.setCursor(9,2);
      lcd.print("!");
    }
  else
    {
      digitalWrite(fanwater,LOW);
      lcd.setCursor(16,2);
      lcd.print("off");
      lcd.setCursor(9,2);
      lcd.print(" ");
    }
    
 if ((temp1) > 35)
    {
     digitalWrite(fanled,HIGH);
     lcd.setCursor(16,3);
     lcd.print("on ");
     lcd.setCursor(9,3);
     lcd.print("!");
    }
   else
    {
     digitalWrite(fanled,LOW);
     lcd.setCursor(16,3);
     lcd.print("off");
     lcd.setCursor(9,3);
     lcd.print(" ");
    }  
}

This one runs....exept the dimming phases.

Greetings Ronny
 
HI

The temperature is an Array and BEFORE SETUP.
Everytime i need it in sketch only have to write "Temperature();"

You are using Mudas sketch,right?
The 24V he defined as relay for the lights as the "MAIN SWITCH",yes.

Greetings Ronny
 
ATS is algae scrubber , which I am running. Thing this is simple on/off timer.
24V is DC power supply for LED drivers. I like it to switch off at night.
 
ATS is algae scrubber , which I am running. Thing this is simple on/off timer.
24V is DC power supply for LED drivers. I like it to switch off at night.

Thanks for the clarification on the acronyms! That helps me free up pins for just what I need.
Thanks
Mike
 
For those who are just reading this thread, I beg you to read the firs 5 pages or so. Its a really good read.

But if you dont have time... i created a Frequently Asked Question or lets say an Index so you can find things fast.


Frequently Asked Question

What is Arduino? </font></span><span style="color:rgb(0,0,0);font-family:arial,sans-serif">    </span><a href="http://arduino.cc/en/" style="font-family:arial,sans-serif" target="_blank">Info here</a><span style="color:rgb(0,0,0);font-family:arial,sans-serif">.  </span><a href="http://www.reefcentral.com/forums/showthread.php?t=1987110" style="font-family:arial,sans-serif" target="_blank">Page 1, Post 9</a>. <a href="http://tronixstuff.wordpress.com/tutorials/" target="_blank">Tutorial here</a>.

Where to get the Arduino software so I can load the your sketch? </font></span><span style="color:rgb(0,0,0);font-family:arial,sans-serif">    </span><a href="http://arduino.cc/en/Main/Software" style="font-family:arial,sans-serif" target="_blank">Download it here</a><span style="color:rgb(0,0,0);font-family:arial,sans-serif">.</span>

How to setup the time on the sketch using DS1307? </font></span><span style="color:rgb(0,0,0);font-family:arial,sans-serif">    <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=12" target="_blank">Page 12, Post 298</a></span>

I have the ELN 60-48P driver. I want 255 steps instead of 10 steps. How to do this?</font></span><span style="color:rgb(0,0,0);font-family:arial,sans-serif">     <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=15" target="_blank">Page 15, Post 365</a>,  </span><a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=35" target="_blank">Page 35, Post 851</a>

I want more features, yours is too basic. Where can i find it?     <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=15" target="_blank">Page 15, Post 373</a> or go to <a href="http://www.reefledcontroller.com/" target="_blank">ReefLedController</a>.

Where to find temp sensors if I want to add it in the future?     <a href="http://arduino-direct.com/sunshop/index.php?l=product_detail&p=151" target="_blank">Buy it here</a>.

Im using Buckpucks instead of meanwells, will this work?     <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=20" target="_blank">Page 20, Post 488</a>

What is Optically Isolated Relays?     <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=21" target="_blank">Page 21, Post 506</a>

Can I still use or keep a potentiometer with the arduino installed?     <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=21" target="_blank">Page 21, Post 520</a>

Which is better? 48P driver or 48D driver?   <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=23" target="_blank">Page 23, Post 551 and 570</a>

Can I use the LCD buttons? <a href="http://web1.reefcentral.com/forums/showthread.php?t=1987110&page=24" target="_blank">Page 24. Post 581</a>

Can I connect multiple drivers in one pwm pin/channel?  Yes.  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=26" target="_blank">Page 26, Post 628</a>

I have 20x4 lcd. Which pin is for backlighting ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=27" target="_blank">Page 27, Post 663 and 668</a></font></span>

Is it possible to scroll text on the 16x2 screen ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=29" target="_blank">Page 29, Post 724</a></span>

Is there a limit of how many drivers you can connect per pin ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=36" target="_blank">Page 36, Post 899</a>,   <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=37" target="_blank">Page 37, Post 919</a>

Can i fade in and out the blue and white parallel ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=37" target="_blank">Page 37, Post 908</a>

How to add temp ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=41" target="_blank">Page 41, Post 1014</a>

Coding for the PH probe ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=41" target="_blank">Page 41, Post 1024</a>

Coding for Weather Pattern ?  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=42" target="_blank">Page 42, Post 1030</a>

Sketch for GLCD screen ? <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=42" target="_blank">Page 42, Post 1035</a>

Centralized location of all sketches ?  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=42" target="_blank">Page 42, Post 1039</a>,  and here  <a href="http://code.google.com/p/aquatroller/" target="_blank">Liquidarts</a>

Where to get temp probe ? <a href="http://www.satistronics.com/waterproof-ds18b20-waterproof-stainless-steel-encapsulated-temperature-sensor_p2993.html" target="_blank">Buy here</a>,  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=42" target="_blank">Page 42, Post 1042</a>

Android App ?  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=46" target="_blank">Page 46, Post 1130</a>

Amazing shield by Saltydogaqua...  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=48" target="_blank">Page 48, Post 1187 and 1193</a>

One channel very simple sketch for small tanks...  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=50" target="_blank">Page 50, Post 1244</a>

Arduino Pin assignments I used on this project...  <a href="http://reefcentral.com/forums/showthread.php?t=1987110&page=51" target="_blank">Page 51, Post 1268</a>


Pin0 - reserved
Pin1 - reserved
Pin2 - relay1
Pin3 - Blue LED driver (PWM)
Pin4 - LCD
Pin5 - LCD (PWM)
Pin6 - LCD (PWM)
Pin7 - LCD
Pin8 - relay2
Pin9 - (free PWM)
Pin10 - (free PWM)
Pin11 - White LED driver (PWM)
Pin12 - LCD
Pin13 - LCD


Sketch. Original Katchupoy Sketch or here.
A simple 2 channel (white and Blue) ramp up and ramp down code.
2 channel, on and off for powerheads to act as wavemaker.
Using 16x2 LCD with 6 non-functioning buttons.


Libraries needed. LiquidCrystal and Wire.



.
 
Last edited:
In the past, I mentioned that I want to buy/build another one identical to what i had before so I can play with the sketch/code etc. So I can add features like temp, etc. And I believe, Fishman want to go along with me because he is an expert with coding and he does it for a living....

I think im going to do it soon. My ranco controller gave up and I believe i can use the existing temp sensor on it attach to my arduino. Unfortunately i cannot do it on my existing arduino setup, so i have decided that Im going to buy another set.

so here is my parts list again... this time, local US seller, and I believe cheaper than what i had before.

Arduino + 16x2 LCD + misc items = $40

DS1307 RTC = $9

5v Relay Module $10

if you dont want the combo kit above... you can also go with these...

Arduino $23

20x4 LCD $13.50

8 channel relay board with 5v coil. $16.75



.
 
Last edited:
In the past, I mentioned that I want to buy/build another one identical to what i had before so I can play with the sketch/code etc. So I can add features like temp, etc. And I believe, Fishman want to go along with me because he is an expert with coding and he does it for a living....

I think im going to do it soon. My ranco controller gave up and I believe i can use the existing temp sensor on it attach to my arduino. Unfortunately i cannot do it on my existing arduino setup, so i have decided that Im going to buy another set.

so here is my parts list again... this time, local US seller, and I believe cheaper than what i had before.

Arduino + 16x2 LCD + misc items = $40

DS1307 RTC = $9

5v Relay Module $10

if you dont want the combo kit above... you can also go with these...

Arduino $23

20x4 LCD $13.50

8 channel relay board with 5v coil. $16.75



.

That shield with the breadboard will be nice for testing and you can solder it up when you are done. i got the soldering one with the screw terminals for each of the pins. Starting to assemble mine now. I went with the 20x4. The extra room is very nice but wish i would have gone with an i2c version. Cant wait to see your new version. :)
 
Hi guys!
I wanted to start the very same project until I found out that you guys already did all the work for me! Amazing work guys!! Thank you!
There´s one thing to add to your setup:
I thought about the 10v issue and came up with a MAX680 voltage doubler, which might make life more easier, taking the arduino´s 5V and make it 10v for the PWM signal.. Does someone have an idea if this might be useful?
http://datasheets.maxim-ic.com/en/ds/MAX680-MAX681.pdf
problem might be that it only has 500uA supply current. will this be enough?
 
Hi @ All!!

@ yellobello: only for Arduino with its relayboard and,or for Dimming the Drivers it would be strong enough I think. If you use Fans for Watercooling,Ledcooling,etc. I would take a stronger one,about 2 Ampere will do it.

@ All: I plan to dim red Leds for Sunrise/Sunset too if blues and whites are already dimming in/out. I only want them in the dimming phases. Info: I´m using mudas sketch if this is helpful. How could this look like?
This is the dim in:
Code:
   /*||||||||||||||||||||||||||||||||||||||||||   F A D E  I N ||||||||||||||||||||||||||||||||||||||||||||||*/

 if (daybyminute >= (ontime*60))               // Anfangszeit Fade in , (aktuelleZeit >= (Startzeit*60))
   { if (daybyminute < ((ontime*60) + ramptime))          // Endzeit Fade in , (aktuelleZeit < ((Startzeit*60) + Dimmzeit))
    {
      
      AbluftOn();
      BlueledOn();
      MoonledOff();
      MoonOff();
      Temperature();
      
  lcd.setCursor(17, 0);
  lcd.write(0); // Sonnenaufgang
  //lcd.setCursor(18,0);
  lcd.write(1);
  
      int i;
      for (int i = 0; i < abc; i++)
{
  analogWrite(blue, bluepercent[i]);
  analogWrite(white, whitepercent[i]);
  
       lcd.setCursor(2, 1);
       lcd.print((bluepercent[i]*99)/255);
       lcd.print("%");
              
       if (i < 10) lcd.print(" ");
              
       lcd.setCursor(9, 1); 
       lcd.print((whitepercent[i]*99)/255);
       lcd.print("%");    
       if (i < 10)   lcd.print(" ");
       
       int countdown = ((rampup*60)/abc);
      while (countdown>0)
        {
          onesecond();
          countdown--;
         // Temperature();
          //lcd.setCursor(6, 1);
          //if (countdown < 100) lcd.print ("0");
          //if (countdown < 10) lcd.print ("0");
          //lcd.print(countdown);
          //lcd.setCursor(16,1);  // Moon
          //lcd.print("off");
        }
       }
     }
    }

I´m sorry that I´m not able to do it myself,I´m just a newbie with Arduino.

best regards Ronny
 
The arduino will be driven by 5V, but i just wanted to make 10v out of the 5V for the sole purpose of having the full 10v on the pwm signal.
I made a quick and dirty diagram where the meanwell is a peltier element. :-)
Could someone pls check if this could work this way?
g6o44ni2.png

The solution with the 4.7uF caps comes from the datasheet of the MAX680, but the pin layout of the datasheet seems to be incorrect (C2+ seems misspelled as C1+).. could someone pls verify this?
Also, are the diodes I put in really necessary? I am a electronics noob..
 
Back
Top