LED Tree With DigiSpark

by Amit_Jain in Circuits > LEDs

6737 Views, 110 Favorites, 0 Comments

LED Tree With DigiSpark

temp_-1810205566.jpg
LED TREE with DigiSpark

Hi,

I wanted to make a LED Tree for few years but did not get good instructable on internet. I found some which used simple lights wound round a rigid wire structure. These lights are bit fragile and get spoil easily.

I had made everything from scratch, I used 3mm yellow leds with Digispark ( ATTINY85 )

What Do We Need ?

IMG_20150516_113747_1431767448208.jpg
temp_-1760941283.jpg
Components
• 60 : 3mm Yellow LEDs
• 02 : 5MM Red Leds
• 01 : Digispark
• 01 : 4 AA Battery holder
• 04 : AA NIMH rechargeable batteries
• 05 : Meters CAT 5e cable
• 01 : Plastic Pot
• 01 : Old Mobile charger
• 01 : Switch ( On/OFF)
• 01 : Push button
• 01 : Universal PCB ( 1 X 2 Inches)
• 03 : 2N222 npn Transistor
• 03 : 1K Ohms resister
• 30 : 56 ohms Resisters
• 01 : 10K Ohms resistor
• Loose wires

Tools
• Nose Pliers
• Wire Cutter
• Soldering Iron

Stationary
• Arclyic Paint
• Paper Tape
• Paint brush

Concept 1 : LED Resister Calculation

Img0470.jpg
If you are not expect on Ohms Law

R = V/I

Use this URL to calculate resister and schematic LED in parallel



• Source voltage : 5V
• Diode forward voltage : 2V
• Diode forward current : 20mA
• Number of LEDs in your array : 60


Refer to the image for LED Schematics

The wizard says: In solution 0:



• each 56 ohm resistor dissipates 22.4 mW
• the wizard thinks 1/4W resistors are fine for your application Help together,
• all resistors dissipate 672 mW together,
• the diodes dissipate 2400 mW
• total power dissipated by the array is 3072 mW
• the array draws current of 600 mA from the source


So my LED tree will need 5V 600 mA and 5.5Watts

I am going to divide the Circuit into 2 sets of 30 LEDs

Concept 2 : Circuit

Img0473.jpg
Img0442.jpg
IMG_20150613_143451.jpg
In the circuit: I am using



• Two 2N222 NPN transistor
• Connected pins P0, P1 and P4 from Attiny85 ( PWM capable pins) to LEDS
• Attiny85 P2 / Int0 to button
• Using 4 AA Batteries


I used 1K Ohm resister between Transistor and pins of attiny85 to prevent reverse current from transistor

PS: The Pins on Attiiny85 are numbered differently

Test your circuit on bread board before we build circuit and adjust the code

Concept 3 : the Code

For the code I wanted to put 4 animations



• All LEDS on, wit 2 RED Leds fading on PWM
• All fading on PWM
• Alternate flickering
• Alternate fading on PWM
• And Loop each for 30 Secs


I used Digispark on Arduino Studio to code it.

Also used an hardware interrupt with debounce to change animation.

I did not have schmit trigger chip to use the hardware interrupt, So used debounce and attachinterrupt in unique combination

Partial Code :)

void setup() {
// declare pin 0 and 1 to be an output:

pinMode(led0, OUTPUT);

pinMode(led1, OUTPUT);

pinMode(led4, OUTPUT);

pinMode(button, INPUT);

// Hardware Interrupt on Physical pin 7, logical pin 2)

attachInterrupt(0, flag_interrupt, CHANGE);

}

boolean debounce(boolean last)
{

boolean current = digitalRead(button);

if (last != current) { delay(5); current = digitalRead(button); }

return current; }

void flag_interrupt()
{ // read button, pressed set Flag++

currentButton = debounce(lastButton);

if (lastButton == LOW && currentButton == HIGH) { Flag = Flag + 1; }

lastButton = currentButton;

}

Prepare LEDs

IMG_20150516_135509_1431767416377.jpg
IMG_20150516_231747.jpg
IMG_20150516_221453.jpg
IMG_20150516_143507_1431767342226.jpg
IMG_20150516_223931.jpg
IMG_20150517_084951.jpg
Connect, 3mm yellow LEDs and soldered two with a 56Ohms resisters in series.
D1.anode : colored wire
D2.anode : D1.cathode
D2.cathode : white wire

Separate the wire pairs from a cat5e cable and solder it on the leds in series with colored on Anode and white on cathode or resister end

Use heat shrunk tube to seal and secure the leads from getting short

Make 30 such bunches

Make Tree Structure

IMG_20150516_095552_1431767604975.jpg
IMG_20150516_100035_1431767581494.jpg
IMG_20150517_105721.jpg
IMG_20150517_111055.jpg
IMG_20150604_200154.jpg
Use a hard rigid wire and cut them as required and use some imagination

I had made 5 branched and then added 2 more later (without the rigid wire)

Paint the metal wire with red-oxide to prevent it from rusting and decoloring later

Get a plastic pot and use card board as base as stand for the tree

LED on the Structure

IMG_20150517_123634.jpg
IMG_20150517_124714.jpg
IMG_20150517_145014.jpg
temp_-1112422650.jpg
temp_1187792290.jpg
IMG_20150517_172900.jpg
temp_-802755526.jpg
temp_1681539641.jpg
Now one at a time wound / fix the leds on each branch, use paper tape as it is easy to work and can be painted later

All Anodes are connected to Battery or positive directly

Separate the negative / cathode, wires into 2 bunched for yellow leds and 1 for red

Connect soft wires as shown and seal the base using card board

Please test the leds after every step, just to make sure there are no breakages or shorts

Paint all branches with arcylic colors as you want. I used brown and green color

Prepare Circuit and Pot Enclosure

temp_-1643063436.jpg
temp_-1538740495.jpg
temp_1504740984.jpg
temp_-1140304309.jpg
temp_-524083833.jpg
Use a universal pcb and place the components on it. Carefully solder each component as per the circuit diagram.

Use different color wires so that it is essay to troubleshoot later.

Attach switch, power in and push button on the pot using PVC solvent cement.

For some reason I am unable to use hot glue gun, not strong enough.

I had used 600mAh batteries but they get used up very fast.
So you can replace them by higher rating batteries it by pass the charger to power circuit instead of charging battery

The Charger

temp_-1775759116.jpg
I had an old Samsung mobile charger, which over a period of time did not work with my phone beside to lose connector.

I clipped the connector end and soldered another plug matching the in plug on the pot


this charger can be used to charge battery or power our tree

Dim the Lights

temp_-1775759116.jpg
temp_-546153550.jpg
Dim the lights and switch on the tree.
it is very amazing to watch the animation run