Pages: [1]   Go Down
Author Topic: Control Christmas Tree lighting with Arduino Starter Kit  (Read 3722 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello,

i am wondering if it is possible to control my christmas-tree lighting with Arduino.
I have bought this Arduino Starter kit, called Tinkerkit, but am aware i will need to buy some more components.
The lighting will just be some regular lights i still have (to plug into the powernet)

I own a shop and i'm decorating it for christmas and what i would like to accomplish is my christmas tree will start to glow, blink, make sounds whenever a customer arrives (ex. open the door).

So i'm asking if i can make this (easily?) happen with my Arduino and the regular lights i have decorated my tree with?

thanks,

Lukas

PS: i'm sorry, i'm not that familair with Arduino components & code, but i'm very eager to learn.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12456
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


The simplest way to control your Christmas lights might be by using a relay that randomly switches the lights
Code:
void setup()
{
  pinMode(10, OUTPUT);
}

void loop()
{
  delay(random(100,1000));
  digitalWrite(10, HIGH);  // relay on
  delay(random(100,1000));
  digitalWrite(10, LOW);  // relay off
}
you can add a potmeter on the analog port to set the delay values

Code:
void setup()
{
  pinMode(10, OUTPUT);
}

void loop()
{
  digitalWrite(10, HIGH);  // relay on
  int pot1 = analogRead(A0);
  int upper = map(pot1, 0, 1023, 200, 2000);
  delay(random(100, upper));

  digitalWrite(10, LOW);  // relay off
  int pot2 = analogRead(A1);
  upper = map(pot2, 0, 1023, 200, 2000);
  delay(random(100, upper));
}

Merry X-mas smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for replying robtillaart,

i want the lights start playing when the door opens, is there a better way than using the potmeter?

if i use the relay, i'm afraid i have to strip my cable? is there another way without breaking my lights-cable?

and i don't really understand the second code.
There are 2 analogReads, wich mean I have to use 2 potmeters?

PS: ik heb opgemerkt dat je van Nederland bent, als het gemakkelijker is, mag je zeker in Nederlands antwoorden.
Logged

Pages: [1]   Go Up
Jump to: