Pages: [1] 2 3   Go Down
Author Topic: 12/12 Led timer?  (Read 6848 times)
0 Members and 1 Guest are viewing this topic.
Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could someone please give me a code to a 12/12 timer led lighting? im going to hook up leds around the house, I want it to turn on for 12 hours and off for 12 hours a day. Thanks!
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wouldnt a Walmart $3 timer do as good a job?
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 93
Posts: 3968
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Will you use a real-time clock?
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, Is there a code like this?
Logged

Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I need the code asap smiley-sad it will be not real time, it will just turn on in 12 hours and turn off in the other 12 hours
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 93
Posts: 3968
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm confused. Your one reply seemed to indicate you'd use a real time clock, and then you say not real time. Wanna go for two out of three?

Anyhoo, this is pretty straightforward, have you given it a try yourself? Might be an educational experience you know.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

South England
Offline Offline
Full Member
***
Karma: 3
Posts: 205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure you really need to bother with a microcontroller... couldn't you do the job with a 555 timer and some counter ICs? If you really want to use an arduino for this simple task, look up the millis() function and how it relates to keeping time.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5350
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I need the code asap smiley-sad it will be not real time, it will just turn on in 12 hours and turn off in the other 12 hours

Indoor farming?

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Simple example:
Code:
const unsigned long twelve_hours = 12*60*60*1000;
unsigned long elapsed;
bool light_state;

void loop()
{
  if ( millis() - elapsed >= twelve_hours )
  {
    light_state = !light_state;
    elapsed = millis();
           
    print( light_state ? "Light enabled" : "Light disabled" );
  }
}
Logged

Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I need the code asap smiley-sad it will be not real time, it will just turn on in 12 hours and turn off in the other 12 hours

Indoor farming?



Yes, Indoor farming planning on growing tomatoes
Logged

Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Simple example:
Code:
const unsigned long twelve_hours = 12*60*60*1000;
unsigned long elapsed;
bool light_state;

void loop()
{
  if ( millis() - elapsed >= twelve_hours )
  {
    light_state = !light_state;
    elapsed = millis();
           
    print( light_state ? "Light enabled" : "Light disabled" );
  }
}

I need this code here, But only for the light, Could you edit it for me in a way that only the light will work? And I just want to use flower mode. http://www.instructables.com/files/orig/FY8/6LS8/FV4LSLHL/FY86LS8FV4LSLHL.tmp thanks, And if you do good you may get a donation smiley
Logged

Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

anybody? is there a code like this? http://www.instructables.com/files/orig/FY8/6LS8/FV4LSLHL/FY86LS8FV4LSLHL.tmp
Logged

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need this code here, But only for the light, Could you edit it for me in a way that only the light will work? And I just want to use flower mode.

Well if you remove everything but what is related to light and flowering, you will end up with a code similar to mine, smiley-grin
Logged

Grand Rapids Mi
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need this code here, But only for the light, Could you edit it for me in a way that only the light will work? And I just want to use flower mode.

Well if you remove everything but what is related to light and flowering, you will end up with a code similar to mine, smiley-grin

What about the pins on your code? And it would be only flowering mode...
Logged

Eugene, Oregon
Offline Offline
Sr. Member
****
Karma: 9
Posts: 388
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);   
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(43200000);               // wait for 12 hours
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(43200000);               // wait for 12 hours
}

This is a modied version of the very first arduino project, blink. it originally blinks an LED on pin 13. The only thing I did to change this program was to change the timing from 1 second, to 12 hours.

My guess is that you will need more than 40ma, so you will need to use transistors or relays to switch to higher current devices, but the code is still the same.


Honestly, i think the cheapo 24 hour switch thing like someone previously mentioned would be more appropriate.

Like the previous code example, this would only do the flowering lights, which is really all you need, the other room would be lighted 24/7, and not need anything to control that.

I would be interested to find out how well LEDs work for growing. Most setups that i have seen require their own service panel, lots of expensive lights that use crazy amounts of current, and enclosures with fans to keep the lights from heating everything too much.

How many LEDs are you using? Im guessing it must be thousands.
Logged


Pages: [1] 2 3   Go Up
Jump to: