Automating Christmas Trees (Attiny/Arduino)

Christmas is coming and everyone gets out all decorations and lightnings from the basement. It’s a wonderfull time of the year to remember every light bulb from the lightning, which was broken last year, and when there was no time to fix it, etc.

IMG_20161211_192514

Also to remember which decorations were not so appreciated. This is the case with our two little trees which we got for the childrens room. They had to be turned on every evening and off after going to sleep. An unnecessary process which I wanted to fix.

I remembered some time ago I controlled a simple light with a little Attiny85. This had to be done again.

I used a Arduino Uno as a programmer for the Attiny. I had to remember the whole process again, so I’ll better write it here for the future.

Arduino softare has in properties a field for the link to get additional board managers. There I added: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

In the boardmanager I installed it. I uploaded AndroidISP into the Android Uno, connected the Attiny like in the picture, and then uploaded using the programmer the following code:

void setup() {  pinMode(0, OUTPUT); }
void loop() {
  digitalWrite(0, HIGH);
  delay(21600000);
  digitalWrite(0, LOW);
  delay(64800000);
}

A simple program to turn the tree on for 6 hours and off for 18. This means if started in the evening at 18:00, it will always turn on at 18:00 and off at 00:00.

The electronics in the tree couldn’t have been easier to understand and adapt.

Didn’t test it yet, but I hope it works good enough even using the Attiny internal clock.