PCB Christmas Trees

These PCBs Christmas trees were manufactured in a small batch, soldered by hand and given as gifts.

Hardware

The design was first sketched on paper, scanned, and then imported into inkscape.

The design is then traced into vector format. When done, export as SVG files. In this case it made sense to export different parts of the sketch: some for the board outline, some for the silkscreen, etc.

The graphics are then loaded into KiCad via File>Import>Graphics.

Select the appropriate layer for the graphic to be placed on. Note that the "decorations" are loaded onto the front soldermask layer, so as to have them as exposed ENIG-coated copper.

Below is the completed schematic and board layout. The bill of materials is as follows:

A note on LED forward voltage

Since the battery only provides 3V, careful attention needs to be given to selecting LEDs with forward voltages (found on the datasheets) below 3V. Resistors also need careful selection: the lower the voltage drop, the higher the resistor value can/needs to be. In this case, I chose 1kOhm for the red LEDs (lowest voltage drop) and 330ohm for the orange LEDs, such that they match in brightness. This configuration runs them much more dimly than possible, but this was chosen to preserve battery, and to be less bright.

Programming

The board has an exposed ICSP header, through which it is programmed. Here, using an Arduino as an ISP.

The code is an Arduino sketch that runs a pattern on the LEDs (for about a minute), and then enters a deep indefinite sleep. The button on the tree is connected to the ATtiny's reset line. When the button is pressed, the chip is reset/woken, runs the sketch, and returns to sleep. In this deep sleep, the circuit draws practically no current. During wake, the circuit draws about 18mA. This results in about 18 hours worth of run time with the lights on, and months or years worth of shelf-life.

Below is a snippet of the sketch (the interesting part)

#include < avr/sleep.h >

#define STAR_LED 4
#define TREE_LED 1
#define TREE_LED_B 0
#define BUTTON_PIN 3

void setup() {
  pinMode(STAR_LED, OUTPUT);
  pinMode(TREE_LED, OUTPUT);
  pinMode(TREE_LED_B, OUTPUT);

  pinMode(BUTTON_PIN, INPUT_PULLUP);

  // disable the ADC
  ADCSRA &= ~(1 << ADEN)

  set_sleep_mode(SLEEP_MODE_PWR_DOWN);

  runLightingSequence();

  sleep_enable();
  sleep_cpu();
}

void loop() {}

...etc...