|
|
A Unit of Aim Clear Technologies Ltd.
Advertise with us
 |
|
|
Page 1 of 1
|
[ 1 post ] |
|
amritbawa
Supporter
Joined:
Fri Aug 28, 2009 9:03 pm
Beans: 115
In Bank: 1150
College: GNDU
Degree: BTECH
Department: ECE
State: punjab
Fav Quote: Nothing is IMPOSSIBLE on this earth....Because the word itself says---- I'M POSSIBLE !!
|
|
Mon Aug 31, 2009 9:25 pm
|
Post subject: valentine gift for ur girl friend
DIY LED Heart for Valentine's Day Valentine's Day is enough to make even the most suave guy nervous. This February 14th, use your techie skills to make a gift that is sure to win her heart. In this video tutorial, we'll show you how to make this LED Heart Valentine's Card. The card is complete with an LCD display so you can show any message you want, and also has 20 LEDs mounted around the perimeter. The code on the microcontroller (MCU) makes the LEDs blink in a way that emulates random twinkling! SPECIAL ALERT: For all USB NerdKits ordered between now and Valentine's Day 2009 (2/14), we'll include an extra 20 high-brightness red LEDs (as used in this video) for free with the order, so you can build this Valentine's Day gift with no extra electronic components required. SOLD OUT -- EXTRA LEDs ARE NO LONGER AVAILABLE Here's what the finished product looks like: Parts List In addition to our USB NerdKit, you'll need: Photo Part Quantity Description T1-3/4 (5mm) standard LEDs 20 We used high brightness 5mm red LEDs from abcTronics. If you order from them, please tell them NerdKits sent you! Unlike other LEDs you might see on our site, these have a clear plastic package, so you can't tell what color the LED is when it's off. But when it's on, it is red as normal. We also used cardboard (roughly 9" by 9"), spray paint, wire (roughly 10 feet). For the mechanical assembly, we used a handheld drill and 11/64" drill bit, a hot glue gun, and a soldering iron. LED Wiring Plan One wire runs along the outside of the cardboard, and this is like the row wire in the LED Marquee project, constantly alternating between high and low voltages. Then, individual wires are run to pairs of oppositely-connected LEDs. This allows for 20 LEDs to be controlled from 11 signal wires. Click to enlarge: Physical Construction 1. Cut cardboard into the shape of a heart. You can download a heart template PDF we made. 2. Spray paint it. Red is recommended, but certainly not required. 3. Cut out LCD hole. 4. Mount LCD with hot glue. 5. Affix breadboard with adhesive pad. Make sure you sure you leave enough room along the edge for the LEDs to go through. 6. Drill LED holes. We used an 11/64" drill bit, which at 0.172" diameter is slightly smaller than the 5mm = 0.197" body of the LED. The holes are just the right size to squeeze the LEDs through and give a good friction fit. 7. Insert LEDs in alternating fashion. You want to alternate which lead (anode or cathode) faces the outside to make the wiring easier, as shown in the wiring plan above. 8. Solder the LEDs in place. Remember that you need to wire the row wire all the way around on the outside, and connect adjacent pairs of inside leads so that the two can share one column wire. 9. Program the LED array code. The source code is provided in this tutorial, but as always we encourage you to try coding it yourself. It's the best way to learn! Click any photo to enlarge: Display Interrupt Handler Much like our LED Array Project, this heart uses a timer interrupt and an interrupt handler to to handle the switching back and forth of the row driver. The interrupt handler sets the single row driver in the forward direction, and then turns on all the forward LEDs. When the timer fires again, the handler reverses the direction of the row driver, and turns on all the appropriate backward LEDs. Randomized Twinkling In order to complete the effect on the card, we decided to emulate twinkling of the LEDs. To do this, we take advantage of the duty cycle of the LEDs. Remember how we are switching the row driver back and forth in order to drive first the forward LEDs, then the backward LEDs; this allows us to define a duty cycle for each LED. Every time we switch back and forth, we increment a counter that rolls over to zero every 64 ticks. For each LED in our heart, we store a brightness level between 0 and 64. This brightness level defines the duty cycle (the number of cycles we will keep the LED on out of 64). If the LED is on for only one cycle it will be very dim, but if it is on for all 64 cycles, it will be on at maximum brightness. The twinkling code sits in a while loop that iterates through an array that represents the state of each LED. Each LED can be off, brightening, or dimming. At each iteration it chooses a random number, and with a 1/10 probability it switches the state of the LED from off to brightening. It then increases the brightness of all the LEDs that are brightening and decreases the brightness of all the LEDs that are dimming. Once the LED gets back to its minimum brightness level, it switches the state back to off. This creates the desired effect where LEDs seem to randomly begin twinkling. To further the effect, the code also randomizes the maximum brightness they reach, which makes some LEDs flicker on and off quickly, while other LEDs go through a long cycle and reach higher brightnesses. Overall, the effect is difficult to capture in the still photos, but it's easy to see at about 3:05 to 3:23 in the video. Source Code You can download the source code here. Start with a standard NerdKits project and Makefile (included with the kit) and plug in this source code. Questions?
|
|
|
|
|
Page 1 of 1
|
[ 1 post ] |
|
Bookmark & Share
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|

| |