Who wants a cheap, simple, Arduino-based LED controller?

Just noticed something...

The script is set up to use the EEPROM... but there's no "erase eeprom" function at the beginning of the script.. before writing to the eeprom. The eeprom's still holding values from the last time it was flashed/programmed. I'm playing with the original script.. not my modified version.. if I change values in the LED variables, it still loads whatever values were in the script the last time. I've verified this.. 3 times.

Since we have the EEPROM library installed.. open the "eeprom_clear" example.. flash that before loading a newly revised script/sketch.. new values are now in control.

Code:
/*
 * EEPROM Clear
 *
 * Sets all of the bytes of the EEPROM to 0.
 * This example code is in the public domain.

 */

#include "EEPROM.h"

void setup()
{
  // write a 0 to all 512 bytes of the EEPROM
  for (int i = 0; i < 512; i++)
    EEPROM.write(i, 0);
    
  // turn the LED on when we're done
  digitalWrite(13, HIGH);
}

void loop()
{
}
 
Trying to hook in a relay function for the heatsink fans, but I can't figure out what to associate the lightsOff function to. I have a 5mm led connected to the relay pin for testing. I reconfigured the StartMins and PhotoPeriod for each channel to use a global StartMins and PhotoPeriod, so they all start and end the same time, but their individual fade functions are still functional. I then redid the menu to have a master "lights on" and "lights off" setting, followed by the individual fade and % settings for each channel. Figured having a master start and end function would be easier when hooking in a relay function.


If I use:
Code:
if (Relay1 >= StartMins) {
   digitalWrite(Relay1, HIGH);
}
The light just stays off.



If I use:
Code:
if (Relay1 <= StartMins) {
   digitalWrite(Relay1, HIGH);
}
The light stays on, even if StartMins hasn't been reached yet.



Adding in:
Code:
if (Relay1 <= StartMins) {
   digitalWrite(Relay1, HIGH);
  } else {
       if(Relay1 > (StartMins+PhotoPeriod)) {
   digitalWrite(Relay1, LOW);
         }
}
Light stays off.



I managed a half-assed fix by putting it within the "led functions" section:
Code:
/****** LED Functions ******/
/***************************/
//function to set LED brightness according to time of day
//function has three equal phases - ramp up, hold, and ramp down

int   setLed(int mins,         // current time in minutes
            int ledPin,        // pin for this channel of LEDs
            int start,         // start time for this channel of LEDs
            int period,        // photoperiod for this channel of LEDs
            int fade,          // fade duration for this channel of LEDs
            int ledMax,        // max value for this channel
            boolean inverted   // true if the channel is inverted
            )  {
  int val = 0;
  
  
      //// heatsink fan relay on /////////////////////////////////////////////
     if (mins > start || mins <= start + fade)  {
        digitalWrite(Relay1, HIGH);
      }
      //// heatsink fan relay off
      if (mins <= start || mins > start + period)  {
        digitalWrite(Relay1, LOW);
          }
      
      //////////////////////////////////////////////////////////////////////////

      //fade up
      if (mins > start || mins <= start + fade)  {
        val = map(mins - start, 0, fade, 0, ledMax);
      }
      //fade down
      if (mins > start + period - fade && mins <= start + period)  {
        val = map(mins - (start + period - fade), 0, fade, ledMax, 0);
      }
      //off or post-midnight run.
      if (mins <= start || mins > start + period)  {
        if((start+period)%1440 < start && (start + period)%1440 > mins )
          {
            val=map((start+period-mins)%1440,0,fade,0,ledMax);
          }
        else  
        val = 0; 
      }
    
    
    if (val > ledMax)  {val = ledMax;} 
    if (val < 0) {val = 0; } 
    
  if (inverted) {analogWrite(ledPin, map(val, 0, 100, 255, 0));}
  else {analogWrite(ledPin, map(val, 0, 100, 0, 255));}
  if(override){val=overpercent;}
  return val;
}
Now.. the light follows the oneStartMins schedule, turning on when channel 1 starts up, and turning off when channel 1 shuts off.

But now... when it shuts off, it still flickers.. very dimly. Is this normal?

relaytest.jpg
 
Think it's a ghost in my script. Playing with the original Typhon script, and the led keeps flickering. Modify the script I posted here with the 6 PWM channels.. and the led doesn't flicker. In fact.. it's about 1/2 as bright for some reason. Still hooking the relay controls in with the led functions, as I haven't tried hooking it in separately yet. It's working.. I don't want to screw it up now :p.

But it is strange that earlier it was twice as bright when "high", and flickering when "low". Definitely had something in the script screwing it up.

Now to play with some heat sensors.....
 
There are 96 Luxeon Rebel emitters on 32 three-up stars 20mm in diameter. Each star has a Neutral White, Blue and Royal Blue. Mixing is basically perfect because the LEDs are so close to one another.
Can you please tell me where did you get this LEDs, and are you able to dimm every color on its own?

Thanks
 
Can you please tell me where did you get this LEDs, and are you able to dimm every color on its own?

Thanks

Not sure I can post a link due to forum policy, but if you do a search for "luxeon star rebel 3-up" on Google, you'll find the site right away. Cree's are going to be a little cheaper, but I wanted the spectrum that Rebel emitters give. likewise, 3-up stars are a little harder to wire, but the color mixing is as good as you'll get.

I did wire them so that each color is dimmed independently. That way the overall color is easily tuned, and I'm a big fan of the pure "actinic" look for sunrise and sunset ... and showing off! :lol2:
 
As my grandpa would say.

Now we're cooking with gas!!! LOL
Hello shark boy, you asked me in pm if temp&relay is working: yes in the code i posted Temp1 can be assigned at the pwm channel to use it as a relay of pwm for a 12v fan (not directly but with mainly two npn transistors). Temp2 can only use the relay.
 
Found a script with a good example of using the adc_keys... not the Typhon, but good info for modifying Typhon to use the single wire key pad.
 
Found a script with a good example of using the adc_keys... not the Typhon, but good info for modifying Typhon to use the single wire key pad.

WOW!
That's way over my head!

I did look the project up after looking at the code and found the whole thing in a great PDF file. There is some very interesting and adaptable parts here. I love the Nokia 3310 screen with joystick.

http://code.google.com/p/dangerduino/downloads/detail?name=KrusduinoUserManualv1.pdf

shark boy
 
Dwizum (or anyone with hardware design knowledge"¦.)

What would your thoughts be about adding a bridge rectifier like a DF02M to this design? It could provide reverse polarity protection for the circuit, and even accept AC adapters for that matter. Cost would be very minimal, and give you the ability to use a wide range of wall warts.

Is there a downside to using one, other than the voltage drop across the rectifier? Would the DF02M, and a 100uf cap be good for this application?

Also, I noticed when trying to create the gerbers for ITead, if you use THEIR cam to generate the gerbers, it messes up the drill file for some reason. You can see it if you use a gerber viewer. I used the cam from Seeed, and copied the drill file over with the rest of the files for ITead, everything "looks" proper now.

Chris
 
Dwizum (or anyone with hardware design knowledge….)

What would your thoughts be about adding a bridge rectifier like a DF02M to this design? It could provide reverse polarity protection for the circuit, and even accept AC adapters for that matter. Cost would be very minimal, and give you the ability to use a wide range of wall warts.

Is there a downside to using one, other than the voltage drop across the rectifier? Would the DF02M, and a 100uf cap be good for this application?

Also, I noticed when trying to create the gerbers for ITead, if you use THEIR cam to generate the gerbers, it messes up the drill file for some reason. You can see it if you use a gerber viewer. I used the cam from Seeed, and copied the drill file over with the rest of the files for ITead, everything "looks" proper now.

Chris



DF02M, DF04M.. both will work fine. As long as the Arduino doesn't need more than 1.5A that is... :p
 
Adafruit delivery finally came.. new bigger LCD and some Dallas Temperature sensors :D.


mytemp1.jpg


mytemp2.jpg


tempsensorsconnectiondiagram-1.jpg



Code:
#define ONE_WIRE_BUS 2                  //data wire for temperature probes. 
#define TEMPERATURE_PRECISION 9
OneWire oneWire(ONE_WIRE_BUS); 
DallasTemperature sensors(&oneWire); 
DeviceAddress TempSense_1, TempSense_2, TempSense_3;

-
-
-
-
-

//////////////   TEMPERATURE   //////////////

void printAddress(DeviceAddress deviceAddress) 
{ 
	for (uint8_t i = 0; i < 8; i++) 
	{ 
		// zero pad the address if necessary 
		if (deviceAddress[i] < 16) Serial.print("0"); 
		Serial.print(deviceAddress[i], HEX); 
	} 
} 
void printTemperature(DeviceAddress deviceAddress) 
{ 
	float tempC = sensors.getTempC(deviceAddress); 
	lcd.print(DallasTemperature::toFahrenheit(tempC), 1); 
} 
void printData(DeviceAddress deviceAddress) 
{ 
	Serial.print(" "); 
	printTemperature(deviceAddress); 
	Serial.println(); 
} 

-
-
-
-
-

//////////////    Get temp data from DS18B20   //////////////

	Serial.begin(9600); 
	sensors.begin(); 
	if (!sensors.getAddress(TempSense_1, 0)); 
	if (!sensors.getAddress(TempSense_2, 1)); 
	if (!sensors.getAddress(TempSense_3, 2));
	sensors.setResolution(TempSense_1, 9); 
	sensors.setResolution(TempSense_2, 9);
	sensors.setResolution(TempSense_3, 9); 

-
-
-
-
-

//////////////    Display HeatSink Temperature   //////////////

		sensors.requestTemperatures(); 

		lcd.setCursor(0,2); 
		lcd.print("Temp1"); 
		lcd.setCursor(0,3);
		printData(TempSense_1); 
		lcd.print((char)223); //print degree symbol ° 
		lcd.print("F "); 
		lcd.setCursor(7,2); 
		lcd.print("Temp2"); 
		lcd.setCursor(7,3);
		printData(TempSense_2); 
		lcd.print((char)223); // print degree symbol ° 
		lcd.print("F "); 
		lcd.setCursor(14,2); 
		lcd.print("Temp3"); 
		lcd.setCursor(14,3);
		printData(TempSense_3); 
		lcd.print((char)223); // print degree symbol ° 
		lcd.print("F");
               if((StartMins < minCounter && StopMins >= minCounter)) {
                  lcd.setCursor(16,0);
                  lcd.print("ON ");
                  }
                  
	          else{
                  lcd.setCursor(16,0);
                  lcd.print("OFF");

                  }
}



My fixture is going to be 3 sections, 3 heatsinks. So I want 3 temp sensors.

Although all 3 sensors are working, I noticed something strange. In my picture above.. the sensor to the left is reading as #1, the middle sensor is reading as #3, and the sensor to the right is reading as #2.

??? What did I do wrong?
 
I can't wait for this add on board to come to life, i'd love the moon lights and temp sensor to turn lights if temp got too high.
I'd live to see a relay of some kind to turn fans on/off

I don't know about the surface mounting though...




That would be great, controlling fans that run when the lights are on would be awesome to have in this controller. This would solve my last problem with full implementation of this board into my hood of red sea max 130 and i could ditch stock timer that controls fans and moon lights!

Awaiting eagerly to see the results. And if anyone happens to have an extra add-on board i'd love one :)

Any update on the add on board ?
 
I have my first honest attempt at an expansion board in a draft stage. It has a single driver on it for moonlight LEDs that is I2C controllable (via digital pot, since that is easier to get ahold of than any reasonable I2C pwm IC). It also has a 4 channel ADC for temperature sensors, pH, etc. The idea is to keep this LED focused so for instance you could put the temp probes in the waser and/or on the heatsink and turn the LEDs off if things got too hot.

The board is 5cm square so it is the same size as the CAT4101 drivers and will be cheap to get from common board houses. There is technically some spare room on the board. Can anyone think of other hardware I might fill that space with?

Oh, and it is all surface mount, but easy packages, with the idea that this is a good first smt project. I would rate it as a similar difficulty as the 4101 drivers.
Any update on the add-on board?
 
Back
Top