DIY Lighting Calendar - Homemade Gift

520

8

Introduction: DIY Lighting Calendar - Homemade Gift

About: Studying Electronics andCommunication Engineering and passionate about IOT.

In this Tutorial we will make a lighting Calendar with will light up with different colors. It can be used as a decorative or as a desktop penstand etc...

So lets Begin........

Step 1: Gathering Materials

Materials Required:

Plastic containers (2 nos - one for base and one for calendar)

General purpose PCB

LED's (Tricolour)

9v battery with snap connector.

Double-side Tape

Scissors

Female and Male Berg Pins

ATtiny85 microcontroller

transparent/ translucent paper

water/glycerin

glitters

Laptop with Arduino IDE software for programming the microcontroller.

Gather all the materials and make sure that all the LEDs are working

Step 2: Circuit and Soldering

Connect the components as shown in the Circuit Diagram.

Solder the burg pins(for the Micro-controller) and as well as the led as shown.

make sure you connect the resistors in series to limit the current.

connect a switch between the battery and the board as shown.

Don't worry about the four berg pin at the end. I used it just for testing LED.

Step 3: Arduino IDE Setup

Download the Arduino IDE software from their official website:

https://www.arduino.cc/en/Main/Software

open the arduino software and go to file-->preferences

In the box labeled “Additional Boards Manager URLs” enter : http://digistump.com/package_digistump_index.json

Go to the Tools -->Board” and select “Boards Manager” and then from the type drop down select “Contributed”:Select the “Digistump AVR Boards” package and click the “Install” button.

When complete the install with pop up a Driver Install Wizard window, please click “Next” on this Window to install the drivers for Digistump Boards.

With the install complete, close the “Boards Manager” window and select the Digispark from the Tools→Boards menu. “Digispark (Default - 16.5mhz)” is the board that should be selected by all new users.

you can download additional drivers from here: https://github.com/digistump/DigistumpArduino/rele...

Complete instruction can be found in this link: https://digistump.com/wiki/digispark/tutorials/con...

Step 4: Programming

Programming the board is very simple. I will try to explain the program as simple as possible.

The code has four main functions:

1)pinMode()- used to specify the port type (output/input) . In our project all ports are output because we are connecting Led to them.

ex: pinMode(1,OUTPUT)- port 1 is configured as output.

2)digitalWrite()- used to send digital value (1/0) to the specified port. 1 corresponds to HIGH(5v) and 0 corresponds to Low (0v).

ex: digitalWrite(1,HIGH)- port 1 is made HIGH (ie. 5v).

3)analogWrite()- used to send analog values to the ports. 0 corresponds to 0v and 255 corresponds to 5v.

the intermediate values (0-255) corresponds to intermediate voltage values(0v-5v). It is mainly used to control brightness of the LED. ( 0 corresponds to min brightness/ OFF and 255 corresponds to max brigntness)

4) delay()- used to pause the program for specifies amount of time in milliseconds

I have used Common ANODE type of tricolour LED. It has a common Anode(+) and Three cathodes(-) for three colours. There must be 5v(HIGH) on the anode pin and 0v(LOW) on any of the three cathode pins to make the LED glow.

I have connected one common anode to positive (ie. +5v) and three cathodes are connected to three ports ( viz. port 0, port 1, port 4).

port 0,port 1 and port 4 are PWM( pulse width modulation) pins. We can send analog values ONLY to PWM pins.(ie. brightness can be controlled only by PWM pins).

PROGRAM:

It has has two parts :

A)

void setup() {
pinMode(0,OUTPUT);

pinMode(1,OUTPUT);

pinMode(4,OUTPUT);

digitalWrite(0,HIGH);

digitalWrite(1,HIGH);

digitalWrite(4,HIGH); }

ports 0,1,4 is configured as OUTPUT. port 0,1,4 by default as HIGH because i am using common anode. If you are using common cathode make all three ports as LOW.

B)

void loop:

I have made the LED glows in 3 patterns

pattern 1:

digitalWrite(1,LOW);
delay(2000);

digitalWrite(1,HIGH);

delay(1000);

make led glow for 2 sec and make is OFF for 1 sec

pattern 2:

for(i=255;i>=0;i--)
{ analogWrite(1,i);

delay(10); }

for(i=0;i<255;i++)

{ analogWrite(1,i);

delay(10); }

sending values continuously from 255 to 0 in a loop ( making led glow slowly from min brightness to max brightness to max brightness). Sending values from 0 to 255 in a loop ( making led glow from max brightness to min brightness).

Again if you are using COMMON CATHODE then interchange these two loops.

pattern 3:

digitalWrite(1,LOW);
delay(200);

digitalWrite(1,HIGH);

delay(200);

it is same as pattern 1 but it turns ON and OFF quicker is 200 ms delay thereby leading to flashing effect

YOU can modify the program for any pattern that you want!


Step 5: Upload and Run

After you have done with programming we should compile and upload your program.

to compile press the tick button on the top left corner to check any errors.

to upload press right arrow button next to compile button.

steps to upload:

Do not worry if the device is NOT listed in the tools--> port like other arduino boards.

just click upload wait for it to get compiled. then it will ask to plug in the device.

Now plug the device into the USB port within 60s. the program will be uploaded and you will get a message "done uploading".

now remove the microcontroller from the usb port and plug it into the PCB. Switch ON the device with the switch and you must see the led glow in pattern.

Step 6: Final Setup

Stick Everything inside the lower container stand/box.

Take the printout of the calendar on transparent/ translucent paper and stick it on the cylindrical container as shown is the picture.

Place the container on the stand the turn it ON.

Enjoy the colorful lights as it flashes inside the box and top calendar container.

You can Add hot water/ glycerin and glitters into the container to make it more attractive . You can also keep it as a show piece in parties.

You can do outer decorations for the container based on your favorite theme/ your friends favorite theme if you are giving it as a gift.

You can give it as a gift to your friends and relatives. And before you give it fill the top container with chocolates and candies!!

Hope you like the Tutorial !!

Thank you and Happy Holidays!!

Share

    Recommendations

    • Water Contest

      Water Contest
    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest

    Discussions