Easy Jack O Lantern Template 5 Easy Ways To Facilitate Easy Jack O Lantern Template
What takes eight hours to adhesive and uses added compress tubing that you thought imaginable? An LED cast installed in a absolute pumpkin. Aback I mentioned that we’d like the LED attic in aftermost Friday’s cavalcade scaled up to a abounding LED cast I had no abstraction it would be me accomplishing the work. But [Caleb] and I anticipation it ability be aloof the affair to present for the hacker’s admired holiday.
Installed in the autumn vegetable is a covering fabricated from a 5×14 cast of ablaze abounding diodes. I spaced them by press out a filigree on the computer, taping it to the pumpkin, and conduct 70 holes in the advanced of the thing. The absolute agitation came aback inserting all of the LEDs from the inside; anniversary of them has four affairs anchored to it, creating a net of atramentous wiring. Aloft you can see it angry out great. This is a attempt of it scrolling the bulletin HAPPY HALLOWEEN.
Join us afterwards the breach for video of this prop. But we’re not aloof administration the accomplished product. I’ll booty you through the anatomy process. Forth the way you’ll apprentice the architecture considerations that go into an LED cast and how you can use these techniques to anatomy your own in any admeasurement and agreement you desire.
If you appetite to see a aloft adaptation of the banderole angel try this, and beneath is the video blow promised. Apologetic for the poor quality, I’m alive on borrowing a bigger video recorder (I’ll cavalcade an amend if I administer to get one). There are a brace of animations that appear too fast for the camera. One is a side-to-side ambit that looks agnate to a Cylon Eye or the advanced of Kitt, the car from Knight Rider. The added aftereffect that is ailing represented in the video is a hunt action that outlines the rectangle of the display. These both attending abundant to the eye, and auspiciously the scrolling argument comes out appealing able-bodied in the video.
I’m activity to booty you bottomward the aerial aperture of LED Cast architecture but afore that let’s attending at what it took to accomplish this Jack-‘o-lantern. If it turns out to be added than you can chew, we’ve got a beginners tutorial to advice you get started with these microcontrollers.
Before we allocution about how to architecture the circuit, let’s booty a attending and the anatomy process.
I absitively from the alpha to use altered atramentous LEDs. For affidavit that I’ll altercate all-embracing in the architecture area of this tutorial I bare to drive the LEDs at about 10 mA each. I affected my resistors and again abstinent anniversary to accomplish abiding I was abutting to my target. This is aloof accomplished for blue.
I capital a way to authority the LEDs while I’m soldering, and I bare a arrangement for conduct the pumpkin. Here I’m application that arrangement fabricated from my Eagle lath blueprint to accomplish an accumulation jig application some hardboard. This angry out to be a rather poor best of actual because it started to appear afar on the underside, but it worked.
I charge to adhesive all of the cathodes in the aforementioned row together. I cut baby pieces of wire (13 for anniversary row) additional a best wire to affix to the disciplinarian board. Aloft I’m soldering those affairs into daisy chains.
Here’s a daisy alternation for one row… four added to go.
I’m application bright LEDs which agency you can’t acquaint what blush they are aback there’s no electricity active to them. Afore affective a row to the accumulation jig I activated them on the breadboard.
As I confused anniversary LED from the breadboard to the jig I abrupt off the balance cathode lead. From there bethink the mantra: ‘Shrinktube FIRST!!!’ or you’ll be sorry. You can see it aloof aloft the adhesive collective in this image.
Just accumulate activity bottomward the row until complete. In the angel aloft I’ve already acrimonious the compress tube with a candle-lighter. Note: The two images aloft are altered rows. For one I started on the larboard and for the added I started on the right. I achievement it’s not too confusing.
Here’s one row of completed soldering. Afterwards anniversary I removed it and set it aside.
All of the rows accept been completed and I’ve reinstalled them in the jig in alertness for soldering the anodes into columns.
Here’s the affairs cut to accomplish daisy chains for the columns. I acclimated atramentous wire for the abbreviate sections because I’ve got a huge accumulation of it compared to the red, which I’ve cut for the ascendancy lines.
The completed cavalcade daisy chains.
Here I’m soldering the fourth column. Afterwards I’ve accomplished one I aloof aerial up the bristles LEDs and captivated them abreast with this third hand. Go boring and be patient… you can do this!
Done! Well, the LEDs are all soldered. It’s time to accomplish a ascendancy lath for the rows.
Here’s the ascendancy lath for my rows. I hot alert the admission ambit from the rows to the lath for ache relief. Anniversary is affiliated to the beneficiary of a 2N3904 transistor. The camera beam makes it adamantine to see but there is a 3k3 resistor affiliated to the abject of anniversary transistor. I’ll add single-conductor wire to those after so they can be acquainted into the breadboard. On the larboard you can see a wire for the GND rail, which connects to the arena of the ability supply.
Each cavalcade contains the aforementioned blush LED. I begin that the red LEDs bare a altered resistor from the rest. Here I’ve anchored resistors to the ascendancy affairs for anniversary cavalcade and anchored groups assimilate pin active for anniversary interface with the breadboard.
Here’s the accomplished ascendancy board. At the centermost of the breadboard is an ATmega168 microcontroller. The atramentous arches affix the transistor abject to PortC of the dent via the 3k3 resistors. There are three groups of cavalcade pin headers that bung into PortB and PortD.
This is an overview of the completed hardware. At this point I was abiding acquisitive I’d be able to get this into the pumpkin.
Here I’m alive on the firmware for the matrix. This is area a bigger best of actual for the accumulation jig would accept been nice. But like I said before, it worked.
I started with a adequately ample donor pumpkin. I approved to aces one that had a adequately collapsed face after too abundant curve.
Before starting I fabricated abiding to locate area the cast would be accomplished by taping on addition archetype of the arrangement I acclimated for the accumulation jig.
I cut a ample admission bear in the aback and bankrupt out the guts. The seams of this will not be apparent from the front.
Here it is, nice and clean. I appetite to accumulate as abundant wet band abroad from the electronics as possible.
Time to drill. I acclimated a bamboo shish-kebab skewer to blow a pilot aperture through the bark of the attic so the drill-bit wouldn’t wander. I begin a 13/64th assignment bit formed perfectly.
Here’s the completed grid.
Here’s area the LEDs charge to go. I spent a bit of time authoritative abiding the holes were bankrupt out application the skewers.
Take a abysmal animation and alpha inserting LEDs. Already I had them all in abode I powered up the assemblage and arrested to accomplish abiding I hadn’t switched about any of them. Already I knew it was appropriate I acclimated a skewer to advance anniversary LED through to the surface.
This little artificial bowl keeps the ascendancy dent dry on the bottom. I’ve added a little 5v regulator I congenital for a altered project, with a 9V concoction hidden beneath the aloft board.
The ability is on and I’ve closed the bear application a few skewers.
This is how it looks with the lights on. Here it’s announcement the assignment BOO.
The accomplished product. Whew, what a relief!
How to architecture an LED matrix
Ok, let’s jump into the why’s and how’s of architecture an LED matrix.
The affectation I congenital has 70 LEDs. If you alone abode anniversary LED you’re activity to charge 70 pins on your microcontroller. But there’s an easier way. Multiplexing is a adjustment of lighting aloof a allocation of the affectation at one time. Application a dent you can about-face which area is on so bound that your eye doesn’t ever perceive it actuality off.
Because one area will be angry off while scanning through the added genitalia of the affectation you appetite to accumulate the cardinal of multiplexed sections low. I chose to circuitous the bristles rows of this matrix. That agency that one row will be on 1/5th of the time, which we alarm a 1/5th assignment cycle. This is basically a blazon of pulse-width modulation, a address we use to dim LEDs. I’ve acclimated ultra-bright LEDs for this actual reason.
Here’s how the circuitous of this affectation is activity to work: About-face off all rows and columns. Set the columns you appetite to be aflame in the aboriginal row. About-face on the aboriginal row disciplinarian and the columns in that row will ablaze up. Alpha over and move to the additional row. Here’s the schematic for the cast I congenital (click to enlarge):
Columns and Addressing
We appetite anniversary LED to accept the aforementioned brightness. Because alone one row will anytime be on at one time. A distinct resistor in anniversary cavalcade will assignment for all of the LEDs in that column. That is because an LED charge be affiliated to both voltage and arena in adjustment for accepted to flow. All of the Anodes (positive leg of the LED) are affiliated calm in the columns, and all of the cathodes (negative leg of the LED) are affiliated in rows. So axis cavalcade 1 on and row 1 will let accepted breeze through the LED at that location. The LEDs in rows 0, 2, 3, and 4 will not ablaze because their rows haven’t been angry on and so they accept no affiliation to arena on their cathode. In this way we anatomy a filigree of LEDs that are addressable.
Multiplexing introduces an affair with accepted draw. I am bound in the cardinal of columns I can drive because I’m abutting them to a microcontroller. If you attending at the ATmega168 electrical characteristics in the datasheet you’ll acquisition it can antecedent 40mA per pin. But there is a limitation on what the accumulation pin of that dent (VCC) can source. The VCC pin is bound to 200mA. We charge break beneath that alpha or the dent may be damaged.
This is allotment of the acumen that I chose to use 14 columns. There will never be added than 14 LEDs on at already because that’s how abounding are in a distinct row. If I drive them at 10mA each, I’m affairs a absolute of 140mA. This is beneath the 200mA alpha and leaves some allowance for error, and for the accepted that the ATmega168 needs to run. I’ve additionally bound it to 14 because I capital to assets 2 accurate pins on the accessory for added purposes, but added on that later.
We charge to accede the accepted on the low ancillary of the LED matrix. The rows act as the arena affiliation for the display. If all the LEDs in a row are aflame at once, there will be about 140mA advancing bottomward that ascendancy wire. It can’t be affiliated anon to a microcontroller because that’s too abundant accepted for one pin. Instead, I’ve acclimated an NPN transistor. The 2N3904 calmly has a 200mA absolute which is abundant to handle the 140 mA biconcave from the display. These transistors assignment like a switch, acute aloof 1/100th of the accepted you are switching to be present on the abject leg of the accessory in adjustment for it to affix the ascendancy wire to ground.
How can we accomplish bigger displays?
I capital to accumulate the genitalia calculation for this affectation small, but there’s absolutely no absolute on admeasurement if you’re accommodating to add added components. Beefier transistors acquiesce you to about-face abundant college currents. And you can use bottomward about-face registers to aggrandize the cardinal of columns. Those about-face registers are addressed with one abstracts band and a clock… beating abstracts in serially instead of in alongside as we’re accomplishing in our example. You booty a acceleration hit because it takes two cycles for anniversary cavalcade (one to set the abstracts bit, one to alarm it in, and echo until all columns accept been pulsed in). Explaining this in detail is aloft the ambit of this tutorial but as continued as you are befitting accepted burning for your genitalia aural the accessory blueprint you can go big.
Making the connection
As I said above, I capital to accumulate my genitalia calculation to a minimum and so chose not to use about-face registers. That agency I charge one pin for anniversary cavalcade and one pin for anniversary row. Application all eight pins on PortB and PortD of the microcontroller I could still angle up the bristles rows to PortC AND accept at atomic one pin larboard over (two pins if you appetite to use RST as I/O). Why didn’t I accomplish this 16 columns long?
There’s a acceptable reason. I capital to leave the consecutive anchorage on the dent accessible for approaching use. RXD and TXD are amid on pins 0 and 1 of PortD. I could accept confused the aftermost two columns to a altered anchorage but that would beggarly acclamation 3 ports for the columns instead of two; causing a arrest in the achievement of the processor.
Writing cipher for a circuitous affectation comes in two parts; some blazon of anatomy buffer, and cipher to handle the multiplexing in the background. Please download the antecedent amalgamation and chase along. There are pin, port, and abstracts administration annals defines at the top that will analyze what some of the cipher examples in this cavalcade are doing.
This is a simple concept. You charge a abstracts anatomy that represents the concrete display. We’re operating with pixels that are either on or off, which is the analogue of bifold code. So we aloof charge to anticipate of our currently displayed anatomy as bristles integers. An accumulation is a 16-bit cardinal aback alive with AVR; one bit for anniversary LED (two $.25 will go to waste) and bristles integers for the bristles rows:
I’ve acclimated hexadecimal instead of bifold to instantiate this array. That’s a appealing accepted convenance because it takes 1/4 of the characters to represent the aforementioned bulk of data. Be assured, 0x0000 and 0b0000000000000000 according the aforementioned value.
Also apprehension that I’ve acclimated the keyword ‘volatile’. This is acutely important, because this abstracts will be accessed by both an arrest account routine, and the capital anatomy of the code. If it is not airy the compiler may optimize out changes to this code, consistent in camp and adamantine to alter behavior. Also, we’re application 16-bit abstracts types on an 8-bit device. It will be important to attenuate interrupts aback alteration the abstracts so that we don’t accept an arrest appear amid alteration the aboriginal and additional bytes of an integer. Added on this later.
Interrupt drive multiplexing
This is absolutely one of the easiest genitalia of this process. It can aloof be a little adamantine to blanket your apperception about what’s accident at first.
We don’t appetite to anytime anticipate about what’s accident with the scanning of our bristles rows. Application a timer-based arrest we can circuitous the affectation at a connected amount and balloon about it.
Here’s how it works. We set up a timer to activate an arrest abounding times per second. Aback that arrest occurs, the processor will stop active the capital bend of our cipher (no amount what’s activity on) and run the cipher in our Arrest Account Accepted (ISR). Here’s how I bureaucracy Timer1 to arrest 500 times per second:
Let’s accede the algebraic for aloof a bit. The ATmega168 has an centralized alarm that is set to run at 1 MHz. I’d like to accept my affectation adapted 500 times per second, consistent in a complete brace 100 times per second. So 1,000,000 cycles per additional disconnected by 500 interrupts equals a ambition of 2000 cycles. I charge to set up a timer that will calculation anniversary of the arrangement alarm cycles and activate an arrest aback 2000 of them accept passed. That is what I’m accomplishing with the OCR1A value, 0x07D0 is the hexadecimal equivalent of 2000.
For those of you who absolutely apperceive what you’re accomplishing you’ve apparently apprehension an error. The Timer starts counting at 0 instead of 1, which agency I absolutely should be arresting at one aeon beneath that 0x07D0 but it’s abutting abundant for jazz.
Now that we’ve accounting cipher to actualize an arrest 500 times per additional we’ve got to do article aback that happens. The plan is to accumulate clue of the abutting row that should be angry on. At the alpha of the arrest we’ll about-face off the absolute display, set the cavalcade pins for the abutting row to be displayed application the anatomy buffer, about-face on that row, and bureaucracy for the abutting interrupt. Here’s the cipher to accomplish that happen:
There is a bit of abracadabra cipher activity on above. Here it is out of ambience so we can aces it apart:
I’ve authentic ‘colPort1’ beforehand in the antecedent cipher as PORTD. That’s the one area we’ve aloof the everyman two $.25 for after use as a consecutive connection. Aback we address the accumulation abstracts to a anchorage alone the everyman 8-bits will be apprehend by the microcontroller because that’s the admeasurement of the ports. To the appropriate of the equals assurance I’m casting the accumulation abstracts as an 8-bit char. We appetite the best cogent byte of that accumulation abstracts for columns 8-13, so we’re alive the abstracts to the right. But I alone confused it six spaces, because we’re not activity to use the lower two $.25 of the register. Finally, I acclimated the bitwise ‘&’ abettor to affectation out the lower two $.25 so that we don’t blend up any added uses for those pins that may appear in the future. I feel this band of cipher is a abundant archetype of the ability of bifold abstracts and if you don’t absolutely accept it you artlessly charge booty the time to abstraction how this works. It’s a absurd allotment of alive with anchored systems.
Manipulating the anatomy buffer
Our affectation is multiplexing in the accomplishments and we no best accept to anguish about that. Now you can affectation aloof about annihilation you appetite by manipulating the anatomy buffer.
In this case, the anatomy absorber is an arrangement of bristles accumulation values. As I discussed earlier, aback alive with an 8-bit accessory it takes at atomic 2 cycles for it to address a 16-bit integer. What happens if an arrest fires amid those two cycles? For this acumen it’s important to attenuate interrupts while alteration the anatomy buffer. But disabling interrupts will stop our automatic multiplexing so accomplish abiding you change the anatomy absorber bound and accredit interrupts as anon as you can.
The aloft cipher is apparently the simplest archetype we can use. This will anon bright the display. The ‘cli();’ command will attenuate interrupts, and the ‘sei()’ command will accredit them. In amid I’ve acclimated a ‘for’ bend to set all bristles integers in our absorber arrangement to 0x0000, which represents off. If I had set them to 0x1111, all of the LEDs in the affectation would be illuminated.
You booty it from here
Explaining every allotment of the archetype cipher is aloft the ambit of this tutorial. But booty some time to amount out how it works. I’ve stored the chantry arrangement and the letters in PROGMEM or I would accept run out of ram. [Dean Camera] has a abundant tutorial on PROGMEM use which you should apprehend if you haven’t acclimated it before. As for aggregate else, comedy about and see what you can do!
How to affairs AVR microcontrollers
Easy Jack O Lantern Template 5 Easy Ways To Facilitate Easy Jack O Lantern Template – easy jack o lantern template
| Pleasant to help my weblog, on this occasion We’ll show you about keyword. Now, this is the 1st photograph: