Go Down

Topic: Control Christmas Tree lighting with Arduino Starter Kit (Read 4433 times) previous topic - next topic

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.

robtillaart


The simplest way to control your Christmas lights might be by using a relay that randomly switches the lights
Code: [Select]

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: [Select]

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 ;)
Rob Tillaart

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

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.

Go Up