PIC based Pack Light Tutorial

This is a tutorial on how I made my first pack lights. This guide has been on my blog here for a long time, I just haven’t posted it in here yet. Today is my birthday, and my gift to myself is giving you this tutorial to maybe help at least one buster and make me feel like a better person.

When I made these I had no formal training on this stuff, I just happened to have a PIC programmer from flashing mod chips. So I learned a little assembly and, after many hours of tinkering, here is the result.

Might seem daunting to the electrical newcomer, but it can be done, just check out GBFans member AlmightyCornDogg’s lights turned out: http://www.youtube.com/watch?v=LKvT2pCJFHs

And here’s a video link to what mine look like: Community Videos - GBFans.com | GBFans.com

This only covers the blue power cell lights and and red cyclotron lights. They are actually independent chips so you can use one or the other or both.

What you need:

  1. PIC programmer. I bought serial JDM programmer on eBay.

    mine looks like this: image

  2. PIC 12F509 (cyclotron)

  3. PIC 16F628A (power cell)

Note: you can also use 12C509, but beware those are not rewritable.

  1. 12 blue LEDs (got mine on eBay)

  2. 4 red LEDs (eBay again)

  3. appropriate resistors for each LED (a very wide range of resistor values will work, I usually use 220ohm)

  4. a breadboard is nice when working this stuff out

  5. free flashing software. I like PICPgm for the 16F628a and PICProg4U for the 12F509.

Download the HEX file, source code, the bottom side of the main PCB, and a crude pinout HERE

I used the laser toner and hot iron method to make my prototype. Go to Instructables.com and run a quick search for “etch pcb” and you will find many methods of etching a circuit board.

I don’t have a single sided PCB PDF for the power cell mounting, I made mine on some perf board. It is very crude.

For each pin on the PIC that will control an LED, the wiring goes like this:

PIC pin > resistor > +LED- > ground (negative on battery or PIC).

All the negative LED pins are connected. I’ll get a schematic up here some day to make it easier.

Powering the project

These PICs like 5 volts, so shoot for that. I first used 4.5V (3xAA) and that worked just fine. However I have now switched over to a regulated 5V supply. Here’s an easy to build one: [urlhttp://www.tkk.fi/Misc/Electronics/circuits/psu_5v.html[/url]

If you have questions, feel free to ask. I’ll probably update this post from time to time with more info.

-Devin

here are some pics of my first prototype:

What’s the price range on this?

Actually, a full breakdown of costs would be better. Average eBay price would be nice, if it’s something that has a stable cost (like RAM does, for the most part). Cost in-store, also good.

Also, what’s the estimated battery life?

The biggest expenses are the programmer and other tools you’ll need to complete the project. It also depends how fancy you want to get. Like if you want to add removable connectors and whatnot. It’s also nice to get everything in one place so you aren’t violated by multiple shipping costs.

Here are some digi-key.com part numbers and low quantity pricing

PIC16F628A (160-1608-ND) - $2.68

PIC12F509 (PIC12F509-I/P-ND) - $0.90

Blue LEDs (160-1608-ND) - $0.463

Red LEDs (160-1685-ND) - $0.108

220ohm resistors (220QBK-ND) - $0.064

These are the very basic parts needed. Note on the LEDs: there are TONS of different LEDs, these are just some examples of what is available.

As for battery life, I used a 9V battery from the dollar store and got over 8 hours. Even when the battery gets really low the LEDs are very bright when you look straight at them.

Thanks for posting this!

I gotta go pick up one of those PIC Programmers as I’ve been wanting to learn about this stuff for years!

I swear, the Law of Attraction works overtime for me. I decide that this will be the Halloween I’m gonna have a proton pack for, and people keep showing ways to make it more affordable as long as I’m willing to do some work. I haven’t even been here two months and I’ve seen more spirit of fellowship than any other fan site I’ve even GLANCED at.

Well, I know where my next paycheck’s going. Thanks for posting this, I’ll try to get the results up.

How hard would it be to wire this to a switch (say, a DPDT submini toggle switch from a certain DIY sound kit thread)? I’m not seeing one in your pictures and I was curious as to whether or not you’d like to clarify that a bit sometime BEFORE I go and do something foolish because I’ve learned just enough to get myself into trouble. :slight_smile: I’d rather only have the lights cycling when the pack is “on,” so to speak. For one thing, it’ll save battery life.

glad there’ some interest! But can I edit my original post? It’s not letting me. oh well, let’s continue.

I made a little schematic diagram to help visual the circuit. It’s for the cyclotron but it’s the same idea for the power cell.

It’s a large picture, so click here: http://slightmiscalculation.com/GB/cyclotron.jpg

and regarding the DPDT switch, it’s very easy. I made a professional diagram here: http://slightmiscalculation.com/GB/lightandsounddpdt.png

I don’t have a sound kit so I just some wires running from a SPST switch in my wand all the way down to my circuit board. it connects to those two headers in the upper right just above the headers for the cyclotron light connectors. The layout I used wasn’t exactly optimized for component placement.

also…I just put my new pack lights up for sale Light Kits by us - For Sale - GBFans.com

:vinzclortho:

You should review the pic16f628a datasheet most importantly section 17, if you are using 14 @ 20mA LEDs

Can you be more specific?

None of the LEDs are running 20mA through them. I calculated about 7mA each using (5V-3.5V)/(220ohm)

As designed yes, but if one changes the resistors to power the LEDs in excess of 14mA it breaches the sink/source limits of the chip…

You also have to consider the total power dissipation, as designed it’s OK but again changing the resistor can breach the chips limits…

ah, good info from the master himself :slight_smile:

So the range of acceptable resistor values isn’t quite as large as I made it out to be up top. Just because it works for the LED itself doesn’t mean that the PIC will be happy with it, especially when using this many LEDs.

hey, Im definitely new with PIC programming but I was interested in learning more about it, so I wanted to give this a try. Im having problems hooking up my PIC controller (a pickit 2) to the microcontroller. I used MPLAB and have the build file ready. However, when I try to program, i run into an error. I didnt get the demo board that has a header just for the pickit and a plug for the microcontroller but I was just gonna hook em up on my breadboard. But I dont think I have the correct pins hooked up or else it wouldve worked… I tried building a test circuit with just 1 LED from GP1 but it wasnt working either.

Heres how I have the pickit connected to the microcontroller.

Top — bottom left pin

2nd — top left pin

3rd ----ground on breadboard

4th ---- 3rd from top pin on right

5th ---- none

last — none

If I understand correct, the pickit 2 goes like such:

Top — VPP/MCLR

2nd — VDD (pos V?)

3rd ----VSS (ground?)

4th ---- Data

5th ---- ICSPCLK/PGC??

last — aux ??

Any help would be greatly appreciated.

Thank you,

-Damien

I am really intriged by the design set up with the PIC chip. I have been wanting to give programming one a shot, so I believe I am going to give your set up a try.

Thanks for posting this… I will let you know how mine goes!!!

So what is the acceptable range?

here’s a brief and simple explanation:

depends on the LED and how much current you are running through it. For most common LEDs, you usually wouldn’t want to go above 20mA (0.02 amps) or you risk burning it out. So let’s say the LED has a forward voltage of 2.5V, and our supply voltage is 5V, and we want 20mA. The resistor you would want can be found by: (supply voltage minus forward voltage)/(current), where current is in Amps, no milliamps. So that translates to (5-2.5)/0.02 = 125 ohms. then find a resistor close to value, or higher to be safe due to the tolerance on the resistor. Quarter watt resistors are fine for this application

so that’s great, however if you are running lots of LEDs from a microcontroller and driving them directly through individual pins, the combined current of all those LEDs will damage the microcontroller. The amount of current through the output pins will vary from chip to chip.

Luckily the brightness vs current relationship is not linear, and you can drop the current down a lot without sacrificing brightness. 10mA will often yield high brightness at half the power consumed, but of course this will vary so you just need to test a few LEDs and resistor combinations.

I am finally getting around to upgrading my light set up on my pack. I had two separate circuits to run the pack lights, a simple timer circuit set up to do the cyclotron lights and a set off Christmas wreath led’s that were okay for the power cell.

I got my USB Pic Programmer and just received my PIC chips and assembled it on a breadboard. All I can say is… WOW!!!

Thank you R2DEVO!!!

It works great, I really love it!!!

@ldlaughlin

hey cool, glad you got it going! Good work :slight_smile:

I got my breadboard set up uploaded to Youtube!

Thanks again R2DEVO!!! :cool:

Just ordered a PIC programmer from ebay ($10!) and 5 each of the two PICs (they’re cheap, might as well justify the shipping cost).

On an interesting note, you can actually pay to have microchip.com send you your PICs pre-programmed.

Looking forward to trying this out. I imagine it will be pretty easy.

Suggestions for PIC programmer software for OSX?

Sigh, I tried via VMWare… I get verify errors every friggin time.