(Another) DIY LED Controller - Simple Arduino Style

wow what a read

wow what a read

Ketchupoy thanks. I have finaly read the entire thread. Didnt even have time to play with arduino today. I guess my big problem now is drivers. I didnt have any idea about arduino befor i built my leds so i have drivers from steves leds i believe you metioned these somewhere on you site i think i can control them with the arduino but i guess the code will be different. Any idea where i could find sketch to run my drivers.
 
Sorry guys, willing to help but not familiar with I2C...

Btw,

Im so happy because I have been fighting with the sketch/code to add the temperature sensor / fan controller, and now I was able to make it work... I need a beer too...

Haha.

Cool! Glad to hear ya got it going. I was checking out your site and I like that proto board you got. I have to look into one of those.
 
Mike,

I have the same one, I have been trying for most of the day to get this figured out with no luck. All I get is lines 1 and 3 are all blocks.

I saw a few had the same problem but never saw a solution. Let me know if you find anything.

Thanks

dan

Dan, have you tries to load up any of the examples in the I2C library you are using or are you just not getting any output when running the code from this project? If it is no output from just the code here, try loading up the "hello world" example included in the library and see if that works. If that don't work then perhaps you have a wiring issue.
 
Mike,

I have the Hello World sketch from the LCDI2C library and it is working fine, it is when I try and upload any other sketch that I can find. The display is working on the I2C Bus, just cannot figure out how to convert the sketches to work on this screen.

Thanks
 
ok so i have the hello world sketch, i arduino1.0.1. it verified but when i try to upload it it says that port com1 is in use.

Make sure you dont have any other sketch windows open. Also go into tools-serial port and choose the correct port. If all else fails, reboot.
 
Ok so i played with it some more found a couple of things i wasnt doing the biggest thing was that i hadnt swithed to pot ( com 3 ). Did that ansketch loaded but....let me back track one step when i plugged the arduino into computer there was an orange light blinking on the board... first i uploaded the blinking light sketch and my orange light quit blinking. Then i uploaded the hello world sketch and my screen still just shows blocks on the top line and nothing else.
this project may be over my head. Is there an Arduino for dummies tutorial somewhere?
 
Mike,

I have the Hello World sketch from the LCDI2C library and it is working fine, it is when I try and upload any other sketch that I can find. The display is working on the I2C Bus, just cannot figure out how to convert the sketches to work on this screen.

Thanks

Yeah, sure sounds like the same issue I am anticipating. The sketch I am currently working on is based on the one Muda uploaded and is written for version 0022 of the Arduino software. I have yet to find a library for this I2C board and version 0022. When the Arduino folks released version 1.0 of their software they changed a lot of stuff that breaks the older code. So we either write the code for version 1.x and use new libraries or try to find old libraries. :hmm3:
 
Mike,

Can you post a link to the sketch you are using. I want to take a look at it and see if it is similar to what I am using..

Thanks,
 
Thanks,


Does anyone have a sketch using the web4robot LCD with i2c backpack? If you could please upload it so we can take a look at it, I would really appreciate it.

Thanks,
 
Ok so i unstacked the shield off the uno and loadedthe blink sketch and it worked but then i hooked the lcd to the uno and tried the hello world sketch and still nothing.
 
Mike,

Can you post a link to the sketch you are using. I want to take a look at it and see if it is similar to what I am using..

Thanks,


Her is what I have been experimenting with. It has some issues though. The moonlight does not seem o work correctly and goes to a set value at 12 midnight for some reason. There was an issue where where the temp would not update during fading in or out of the LEDs but I believe that to be fixed. This still does not use the I2C for the LCD display. At this point, I'm really not sure who's code this is. I think I copied it originally from a post made by Muda. I think I may just start over at this point. It seems everyone has changed their libraries to the newer version of Arduino so maybe now would be a good time to just start fresh.



PHP:
/* ------------------------------
 * 0  HEATER              A0 FAN
 * 1  ATS                 A1 24V
 * 2  LCD  14-D7          A2
 * 3  LCD  13-D6          A3
 * 4  LCD  12-D5          A4 RTC
 * 5  LCD  11-D4          A5 RTC
 * 6  Moon 
 * 7  
 * 8  TEMP IC2
 * 9  LED B    PWM
 * 10 LED W    PWM
 * 11 LCD E
 * 12 LCD RS
 * -------------------------------
  
 **********************************************************************************/
//#include 
//#include 
//#include "Wire.h" 
//#define DS1307_I2C_ADDRESS 0x68 // Set rtc
//#include       // initialize the library with the numbers of pins
//#define ONE_WIRE_BUS 2          // Define the pin of the DS18B20

#include <OneWire.h>
#include <DallasTemperature.h>
#include "Wire.h" 
#define DS1307_I2C_ADDRESS 0x68 //set rtc
#include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins
#define ONE_WIRE_BUS 8 //Define the pin of the DS18B20


/*|||||||||||||||||||  L E D   D I M M I N G   P A R T  ||||||||||||||||||||||||||*/

int bluemin = 0 ;          // minimmum dimming value of blue LEDs, range of 0-255
int bluemax = 255 ;        // maximum dimming value of blue  LEDs, range of 0-255
int whitemin = 0 ;         // minimum dimming value of white LEDs, range of 0-255
int whitemax = 255 ;       // maximum dimming value of white LEDs, range of 0-255
int photoperiod = 610 ;    // amount of time array is on at full power in minutes
int ontime = 11 ;           // when start photoperiod fade in
int ramptime = 60 ;       // time for LEDs to dim on and off in minutes
 
/*|||||||||||||||||||||||||||||||||  P I N    ||||||||||||||||||||||||||||||||||||||*/

int blue = 9;             // blue  LEDs connected to digital pin 11 (pwm)
int white = 10;            // white LEDs connected to digital pin 10 (pwm)

int fan = A0;
int ats = 1;
int heater = 0;
int light = A1;
int moon = 6;
int backlight = 1;

int iBlueIntensity;	//declare the integer of blue intensity
float fBlueIntensity;	//declare the floating point version of blue intensity

int bluepercent[] =  { 0, 2, 3, 4, 5, 7, 11, 15, 26, 52, 78, 100, 128, 154, 180, 205, 230, 255, 255,  255, 255, 255 };
int whitepercent[]=  { 0, 0, 0, 0, 2, 3,  4,  8, 18, 40, 54,  75,  99, 110, 130, 155, 175, 200, 210,  230, 255, 255 };

int abc(sizeof(bluepercent)/sizeof(bluepercent[0]));
   
LiquidCrystal lcd(12,11,5,4,3,2);   // initialize the library with the numbers of the interface pins

byte newChar[8] = {	//  Set up the custom icon saule leidzias ir kyla    ( 0 ir 1 kyla) (2 ir 3 leidzias) (4 ir 5 menulis )
	B01001,
	B01001,
	B00101,
	B00101,
	B10101,
	B10111,
	B01111,
	B11111
};

byte newChar1[8] = {
	B10010,
	B10010,
	B10100,
	B10100,
	B10101,
	B11101,
	B11110,
	B11111
};
byte newChar2[8] = {
	B11111,
	B01111,
	B10111,
	B10101,
	B00101,
	B00101,
	B01001,
	B01001
};
byte newChar3[8] = {
	B11111,
	B11110,
	B11101,
	B10101,
	B10100,
	B10100,
	B10010,
	B10010
};
byte newChar4[8] = {
	B00111,
	B01110,
	B11100,
	B11000,
	B11000,
	B11100,
	B01110,
	B00111
};
byte newChar5[8] = {
	B01010,
	B10000,
	B00010,
	B01001,
	B00100,
	B10000,
	B00100,
	B10001
};
byte newChar6[8] = {
 	B01010,
	B00100,
	B00001,
	B11011,
	B00011,
	B00001,
	B01000,
	B10010
};
byte newChar7[8] = {
	B10010,
	B00100,
	B10000,
	B11011,
	B11000,
	B10000,
	B00010,
	B01001
};

OneWire oneWire(ONE_WIRE_BUS);        // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire);  // Pass our oneWire reference to Dallas Temperature.

 /*|||||||||||||||||||||||||||||||||||||||  R T C   C L O C K   D S 1 3 0 7  ||||||||||||||||||||||||||||||||||||*/

byte decToBcd(byte val)    // Convert normal decimal numbers to binary coded decimal
{
  return ( (val/10*16) + (val%10) );
}
byte bcdToDec(byte val)    // Convert binary coded decimal to normal decimal numbers
{
  return ( (val/16*10) + (val%16) );
}
void setDateDs1307(byte second,
byte minute, 
byte hour,
byte dayOfWeek,
byte dayOfMonth,
byte month,
byte year)
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0);
  Wire.send(decToBcd(second)); // 0 to bit 7 starts the clock
  Wire.send(decToBcd(minute));
  Wire.send(decToBcd(hour));
  Wire.send(decToBcd(dayOfWeek));
  Wire.send(decToBcd(dayOfMonth));
  Wire.send(decToBcd(month));
  Wire.send(decToBcd(year));
  Wire.endTransmission();
}
void getDateDs1307(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
 
  *second = bcdToDec(Wire.receive() & 0x7f);
  *minute = bcdToDec(Wire.receive());
  *hour = bcdToDec(Wire.receive() & 0x3f);
  *dayOfWeek = bcdToDec(Wire.receive());
  *dayOfMonth = bcdToDec(Wire.receive());
  *month = bcdToDec(Wire.receive());
  *year = bcdToDec(Wire.receive());
}

/*||||||||||||||||||||||||||||||||||||  D E F I N E  :  B A C K L I G H T ||||||||||||||||||||||||||||||*/
void backlighton()
{
analogWrite(backlight, 200);     
}
void backlightoff()
{
analogWrite(backlight, 25);    // If too bright or dim adjust the value accordingly.
}
/*||||||||||||||||||||||||||||||||||  D E F I N E  :  L U N A R P H A S E ||||||||||||||||||||||||||||||*/

int moonPhase(int moonYear, int moonMonth, int moonDay)
{
  int dayFromYear, dayFromMonth;
  double julianDay;
  int phase;

  if (moonMonth < 3)		//keep the month before march
  {
    moonYear--;			//take away a year
    moonMonth += 12;		//add an extra 12 months (the year taken away from before)
  }
  ++moonMonth;
  dayFromYear = 365.25 * moonYear; //get days from current year
  dayFromMonth = 30.6 * moonMonth; //get number of days from the current month
  julianDay = dayFromYear + dayFromMonth + moonDay - 694039.09; //add them all  
  julianDay /= 29.53;		//divide by the length of lunar cycle
  phase = julianDay;		//take integer part
  julianDay -= phase;		//get rid of the int part
  phase = julianDay*8 + 0.5;	//get it between 0-8 and round it by adding .5
  phase = phase & 7;		//get a number between 1-7
  return phase; 		//1 == new moon, 4 == full moon
  
}
/*||||||||||||||||||||||||||||||||||||||||  D E F I N E  :  O N E S E C O N D ||||||||||||||||||||||||||||||*/

void onesecond() //function that runs once per second while program is running
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  lcd.setCursor(0, 1);
  if(hour>0)
  {
    if(hour<=12)
    {
      lcd.print(hour, DEC);
    }
    else
    {
      lcd.print(hour, DEC);
    }
  }
  else
  {
    lcd.print("12");
  }
  lcd.print(":");
  if (minute < 10) {lcd.print("0");}
    lcd.print(minute, DEC);
  //lcd.print(":");
  //if (second < 10) {lcd.print("0");  }
  //lcd.print(second, DEC);
  delay(1000);
}

/*||||||||||||||||||||||||||  D E F I N E  :  24 V   O N - O F   |||||||||||||||||||||||||||||||||*/

void LightOn()
{
  digitalWrite(light, HIGH); 
  lcd.setCursor(3, 3);
  lcd.print("+");
}

void LightOff()
{
  digitalWrite(light, LOW);
  lcd.setCursor(3, 3);
  lcd.print("-");
}
/*||||||||||||||||||||||||||  D E F I N E  :  A T S   O N - O F   |||||||||||||||||||||||||||||||||*/

void AtsOn()
{
  digitalWrite(ats, LOW); 
  lcd.setCursor(19, 3);
  lcd.print("+");
}

void AtsOff()
{
  digitalWrite(ats, HIGH);
  lcd.setCursor(19, 3);
  lcd.print("-");
}



//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Define Temperature<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void Temperature()
{
sensors.requestTemperatures(); // Send the command to get temperatures
delay(750);
 lcd.setCursor(13, 2);
 
float temp1=0, temp2=0;
 
 temp1=sensors.getTempFByIndex(1);
 lcd.print(sensors.getTempFByIndex(1));
 lcd.print((char)223);
 lcd.print("F");
 
 lcd.setCursor(2, 2);

 temp2=sensors.getTempFByIndex(0);
 lcd.print(sensors.getTempFByIndex(0));
 lcd.print((char)223);
 lcd.print("F");
 
 if ( (temp2) > 79.7)
    {
    digitalWrite(fan, HIGH);
    lcd.setCursor(8, 3);
    lcd.print("+");
    }
  else if ( (temp1) > 113)
    {
    digitalWrite(fan, HIGH);
    lcd.setCursor(8,3);
    lcd.print("+");
    }
  else if ((temp2) < 79.5)
    {
    digitalWrite(fan, LOW);
    lcd.setCursor(8,3);
    lcd.print("-");
    }
    
if ( (temp2) < 75.5 )
    {
    digitalWrite(heater, HIGH);
    lcd.setCursor(14,3);
    lcd.print("+");
    }
else if ( (temp2) > 76.28 )
    {
    digitalWrite(heater, LOW);
    lcd.setCursor(14,3);
    lcd.print("-");
    }
}
    
    
/*|||||||||||||||||||||||||||||||||||||  S E T U P  P I N   ||||||||||||||||||||||||||||||||||||||||||||*/

void setup() {
  pinMode(heater, OUTPUT);
  pinMode(fan, OUTPUT);
  pinMode(light, OUTPUT);
  pinMode(ats, OUTPUT);
  pinMode(moon, OUTPUT);
  pinMode(backlight, OUTPUT);
  
  pinMode (A3, OUTPUT);  
  digitalWrite (A3, HIGH);  //sets pin A3 as a + for the RTC
  pinMode (A2, OUTPUT);
  digitalWrite (A2, LOW);  //sets pin A3 as a - for the RTC
  
  sensors.begin();        // Start up the DS18B20 Temp library

  /*|||||||||||||||||||||||||||||||  S E T U P - C L O C K  ||||||||||||||||||||||||||||||||||||||||*/

  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  Wire.begin();

  second = 00;
  minute = 25;
  hour = 20;
  dayOfWeek = 5;  // Sunday is 0
  dayOfMonth = 06;
  month = 07;
  year = 12;
  
//setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);   // ******* set the clock *******
  
  // Change these values to what you want to set your clock to.
  // You probably only want to set your clock once and then remove
  // the setDateDs1307 call.
  
  analogWrite(blue, bluemin);
  analogWrite(white, whitemin);
  lcd.createChar(0, newChar);
  lcd.createChar(1, newChar1);
  lcd.createChar(2, newChar2);
  lcd.createChar(3, newChar3);
  lcd.createChar(4, newChar4);
  lcd.createChar(5, newChar5);
  lcd.createChar(6, newChar6);
  lcd.createChar(7, newChar7);
  lcd.begin(20, 4); //Set up LCD as a 20x4 display
 
  /*
  lcd.setCursor(0, 0);
 lcd.write(0);
 lcd.write(1);
  
  lcd.setCursor(18, 0);
  lcd.write(3);
  lcd.write(2);
  */
  
  lcd.setCursor(11, 1);
  lcd.print("B:");
  lcd.print(33*bluemin/85);
  lcd.setCursor(16, 1);
  lcd.print("W:");
  lcd.print(33*whitemin/85);
  lcd.setCursor(11, 2);
  lcd.print("L: ");
  lcd.setCursor(0, 2);
  lcd.print("W: ");
  lcd.setCursor(0, 3);
  lcd.print("24V");
  lcd.setCursor(5, 3);
  lcd.print("Fan");
  lcd.setCursor(11, 3);
  lcd.print("Htr");
  lcd.setCursor(16, 3);
  lcd.print("Ats");
  }



/*|||||||||||||||||||@@@@@@@@@@@@@@@@@@@@@@@@@@@|||||  L O O P |||||||@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@||||||||||||||||||||||*/
 
void loop()
{
  onesecond();
   

  /*|||||||||||||||||||||||||||||||||||||||||||||||  L U N A R |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/


  float fSecond, fHour, fMinute;		//turn the times read from the RTC into float for math ops
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year; //declare variables to hold the times
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year); //read the RTC times
  int daybyminute = ((hour * 60) + minute); //converts time of day to a single value in minutes
  fSecond = (float) second;			//sets fSecond as the float version of the integer second from the RTC
  fMinute = (float) minute;			//same as above, but for the minute
  fHour = (float) hour;				//ditto, but for the hour
  int lunarCycle = moonPhase(year, month, dayOfMonth); //get a value for the lunar cycle
  Serial.begin(9600);
   Serial.println (fBlueIntensity);
   Serial.println (lunarCycle);
 
  //--------MOON LED SETUP----------//

  if ( ((hour == 7) && (minute < 00)) || (hour < 7))//Off at 730am.
  {
    fBlueIntensity = 255;		//...then we want the blue LED at the max brightness (255)
  }
  //else if (hour > 22) //&& (hour < 19))             // On at 10pm
  else if (hour > 18) //&& (hour < 19))             // On at 5pm
  {	
    fBlueIntensity = 255 * (((fHour - 16) + (fMinute / 59)) / 7);   //...set intensity out of 255 based on time since 17:00
 Serial.println (fHour);
 Serial.println (fMinute);
 Serial.println (fSecond);
  }
  else
  {
    fBlueIntensity = 0;
  }

 //--------- Account for the moon cycle with the blue LEDs ---------//

   if (lunarCycle == 0)		//new moon
  {
    fBlueIntensity /= 2;
  }
  if ((lunarCycle == 1) || (lunarCycle == 7))	//cresent
  {
    fBlueIntensity /= 1.75 ;
  }
  if ((lunarCycle == 2) || (lunarCycle == 6))	//half moon
  {
   fBlueIntensity /= 1.5;
  }
  if ((lunarCycle == 3) || (lunarCycle == 5))	//gibbous
  {
    fBlueIntensity /= 1.25;
  }

  //full moon is full intensity 


  //----------FLOAT TO INT-------------//
  iBlueIntensity = (int) fBlueIntensity;

  //---prepare the intensities to be written to pin----//

  if (iBlueIntensity < 0) //if the blue intensity is less then 0, set it to 0
  {
    iBlueIntensity = 0;
  }
  analogWrite(moon, iBlueIntensity);
  lcd.setCursor(6, 0);
  lcd.print("Moon:");
  lcd.setCursor(12, 0);
  lcd.print(iBlueIntensity);
  
  //delay(1000); // why is this here?

/*||||||||||||||||||||||||||||||||||||||||  T E M P E R A T U R E DS18B20  |||||||||||||||||||||||||||||||||||*/
Temperature();

/*||||||||||||||||||||||||||||||||||||||||||||||||||||  ATS  |||||||||||||||||||||||||||||||||||||||||||||||||*/
if (hour >= 11)   //  butu 14 val
  {
    if ( hour < 23)  AtsOff();
  }
 else
{
  AtsOn();
}

/*||||||||||||||||||||||||||||||||  R A M P   T I M E   C A L C U L A T I O N ||||||||||||||||||||||||||||||||*/


  int rampup;
     if (daybyminute >= (ontime*60))
       rampup = (((ontime*60) + ramptime) - daybyminute);
     else
       rampup = ramptime;

    int rampdown;
    if (((ontime * 60) + photoperiod + ramptime) <= daybyminute)
      rampdown = (((ontime*60) + photoperiod + 2*ramptime) - daybyminute);
    else
      rampdown = ramptime;

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

 if (daybyminute >= (ontime*60))
   { if (daybyminute < ((ontime*60) + ramptime))
    {
      LightOn();
      backlighton();
      
  lcd.setCursor(0, 0);
  lcd.write(0);
  lcd.write(1);
  lcd.setCursor(18, 0);
  lcd.write(0);
  lcd.write(1);

      int i;
      for (int i = 0; i < abc; i++)
{
  analogWrite(blue, bluepercent[i]);
  analogWrite(white, whitepercent[i]);
  
       lcd.setCursor(13, 1);
       lcd.print((bluepercent[i]*99)/255);	                        
       if (i < 10) lcd.print(" ");
              
       lcd.setCursor(18, 1); 
       lcd.print((whitepercent[i]*99)/255);	
       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);
        }
       }
     }
    }    

 /*|||||||||||||||||||||||||||||||||||||||||||||||     M A X     |||||||||||||||||||||||||||||||||||||||||||||*/

if ( daybyminute >= ((ontime * 60) + ramptime))
  {
    if ( daybyminute < ((ontime * 60) + ramptime + photoperiod ))
     {
    LightOn();
    backlighton();
    AtsOff();
    analogWrite(blue, 255);
    analogWrite(white, 255);
     
  lcd.setCursor(0, 0);
  lcd.write(6);
  lcd.write(7);
  lcd.setCursor(18, 0);
  lcd.write(6);
  lcd.write(7);
  lcd.setCursor(0, 3);
  lcd.print("24V");   
  lcd.setCursor(13, 1);
  lcd.print(99);
  lcd.setCursor(18, 1);
  lcd.print(99);
  
  lcd.setCursor(6, 1);
  lcd.print("   ");
    }
  }
   
  /*|||||||||||||||||||||||||||||||||||||||||||||   F A D E  O U T   |||||||||||||||||||||||||||||||||||||||||*/
  
   if ( daybyminute >= ((ontime * 60) + photoperiod + ramptime))
   
  {
    if ( daybyminute < (ontime * 60) + photoperiod + (ramptime *2) )
    {
      LightOn();
      backlighton();
      
   lcd.setCursor(0, 0);
   lcd.write(2);
   lcd.write(3);
   lcd.setCursor(18, 0);
   lcd.write(2);
   lcd.write(3);
      
      for (int i = abc-1; i >= 0; i--)
{
  analogWrite(blue, bluepercent[i]);
  analogWrite(white, whitepercent[i]);
       
        lcd.setCursor(13, 1);
        lcd.print((bluepercent[i]*99)/255);
        if (i < 10)  lcd.print(" "); 
        lcd.setCursor(18, 1);
        lcd.print((whitepercent[i]*99)/255);
        if (i < 10)  lcd.print(" "); 
         
        int countdown = ((rampdown*60)/abc); // calculates seconds to next step
        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);
       }
     }
    }
  }
 

//*||||||||||||||||||||||||||||||||||||||||||||||||  Night Time ||||||||||||||||||||||||||||||||||||||||||||||*/

  if  (daybyminute >= (((ontime * 60) + photoperiod + (2 * ramptime))))
       {        
   LightOff();
   backlightoff();
   AtsOn();
   
   lcd.setCursor(0, 3);
   lcd.print("24V");   
   lcd.setCursor(0, 0);
   lcd.write(4);
   lcd.write(5);
   lcd.setCursor(18, 0);
   lcd.write(4);
   lcd.write(5);
   lcd.setCursor(6, 1);
   lcd.print("   ");
    }
   }
//*||||||||||||||||||||||||||||||||||||||||||||||||  T H E   E N D  ||||||||||||||||||||||||||||||||||||||||||*/
 
Mike,

It took a lot of time and patience but I was able to get the LCD to work on the I2C bus. I had to take ReefNinja's Original code and change a bunch of commands and use the LCDI2C library to coincide.

When I get home later I will upload the code and the libraries that it will require to work. I am in the process of updating the entire code to match some of the more popular codes in this thread. It will be a few days before it is complete but I am hoping to have the entire Version 1.06 code adapted to the I2C Bus.

One thing that I was told in another thread that I started was to verify that every component was receiving 5v. After I checked I realized that none of my components were receiving 5v. I added another power supply and everything is working better.

One of the biggest problems that I was having today was the temperature kept freezing I found a fix and so far it has been 2 hours with no freezing. Hopefully, everything will work the same if not better once it is done.

Thanks,
 
Dan,

I hope this can help in a way. The way I was able to insert my temp is via a "blink without a delay" style of coding.

Please check my version two of the code.

The only major changes is the "DEFINE THERMISTOR" section.
 
Last edited:
Katchupoy,

Your code looks great, very detailed and good explanation. What is the difference between the Thermistor and the DS18B20.

Are you going to expand the project any further?

Thanks,
 
i believe the DS18B20 is one wire? or maybe digital? not really sure.

I got mine because my Ranco controller died on me... so I salvaged the sensor which works very good. I also might use the built in relay and just replace the brain with arduino.
 
Mike,

It took a lot of time and patience but I was able to get the LCD to work on the I2C bus. I had to take ReefNinja's Original code and change a bunch of commands and use the LCDI2C library to coincide.

When I get home later I will upload the code and the libraries that it will require to work. I am in the process of updating the entire code to match some of the more popular codes in this thread. It will be a few days before it is complete but I am hoping to have the entire Version 1.06 code adapted to the I2C Bus.

One thing that I was told in another thread that I started was to verify that every component was receiving 5v. After I checked I realized that none of my components were receiving 5v. I added another power supply and everything is working better.

One of the biggest problems that I was having today was the temperature kept freezing I found a fix and so far it has been 2 hours with no freezing. Hopefully, everything will work the same if not better once it is done.

Thanks,

That's awesome. I'm glad you got the i2c working. I tried and could not. I actually went back to square one and have been rewriting in the Arduino 1.01 IDE with the newer libraries. Not sure if I will finish but I have been learning a lot!

Not sure of the code you are using but the temp did freeze in mine also. Found that it was only freezing in the led ramp stages. This was because the sketch would go into the ramp function and stay there until the LEDs were ramped up or down and never get the temp off the sensors during that time. I fixed that with the help of RonnyTheReefer, by creating a temp function and calling it while in the ramp function. Look in the Fade in or out sections and you will see this
Temperature();
when the sketch reaches that point it will go up to the temperature function and update the temp. This updates the temp on the LCD but I bet anything that turns on or off due to a specific temperature still wont work because it stays in the ramp section until complete but I have not tested that yet.

To check and see if it is freezing during the fades, set your clock to a few minutes before the LEDs come on and wait until the fade starts then put your finger on the sensor and see if it temp goes up. If not, you are seeing the same issue that I was.
 
i believe the DS18B20 is one wire? or maybe digital? not really sure.

I got mine because my Ranco controller died on me... so I salvaged the sensor which works very good. I also might use the built in relay and just replace the brain with arduino.

Yup, the DS18B20 is a onewire device that has it's own address and rides on the onewire bus. You can have a bunch of them and access each through it's own address. You can have one for heat sink temp, one for water temp and one for ambient temp and act on each reading according to whatever parameters you set. And the beauty of it is you only have to take up one pin on your Arduino.

A thermister is simply a resistor that changes resistance based on it temperature. No smarts in the device and not addressable.
 
Back
Top