# 15 Mode Alternating LED Flasher

#### Quick2Scramble

Joined Oct 30, 2009
10
I'm trying to build my own alternating flasher circuit to drive 2-6 LED light boards. The LED boards are premade and consist of 22 LED lights each, I've placed a link to a picture of the lights at the bottom of the post. The lights I have come with a control box that only offers 2 flash modes.

Here's some background. We had an issue with a set of lights in a cruiser, only the blue would work and not the red. I took the red apart and discovered it to be cold joints on the led board, tapped them all with my 30 watt and fixed the problem right up. While I had the light apart I noticed a circuit board with a 12F629 chip. The set from the cruiser has 19 different flashing patterns. The power is controlled by an on/off rocker switch and the pattern is controlled by a momentary rocker switch, each press of the momentary changes the pattern.

I'd like to build something like this myself. I'm currently researching PIC programming to write my own code for the chip or perhaps use their code in my build if permissible. I've tried searching around for something like this but I haven't had much luck. Most of what I find consists of the 555 timer chip which won't serve my needs. I want to be able to have full control over the different patterns and use all 19 patterns in my design. By using a programmable pic I can alter the patterns at any time.

The LEDS I purchased: http://i33.tinypic.com/2na1ogx.jpg

The circuit board I am referring to:

http://i37.tinypic.com/2w2ivr6.jpg

http://i37.tinypic.com/wme7g5.jpg

J5 and J6 on the board connect to the LED light bars (6 LEDs on each, 2 bars). I can post pics of the actual led bars if needed. They are small bars, approx 3" x 1".

The large black wires come from the control box.

If I can get this going I've got a few different project ideas in mind.

After reading several posts here I also want to mention that I am a LEO and will be using this setup in my personal vehicle so there are no legalities for me to contend with.

Last edited:

#### SgtWookie

Joined Jul 17, 2007
22,210
Bill,
Our OP wants them to be programmable, not hard-wired using multiple IC's.

When you use uC's (microcontrollers) most of the hardware just goes away - it isn't needed any longer.

Quick2Scramble,
If the company that built the lightbar to begin with was careless, they may have not set the "secure" option when they programmed your microcontroller (secure isn't the proper term, but it's late, I'm tired, and away from all of my reference materials).

It's doubtful that you could get the source code from the company. However, it's not all that hard to write, either.

A PICkit 1 kit comes with a PIC12F675 uC already programmed with a flashing LED routine. The PICkit 1 board has 8 red LEDs that can be controlled by a PIC12 series uC using a technique known as "Charlieplexing", originated by a fellow named Charlie over at Maxim (Google will give you boatloads of hits on Charlieplexing). There's room for another four LEDs on the PICkit 1 board, which I added to mine.

The basic demo flashing program just lights one LED at a time; I made a modified version that allows you to press a button and change the pattern of flashes; you can also adjust the speed of the flashes using a potentiometer.

I'm out of town for a couple of days, and don't have any of my source code or reference materials handy.

I'll try to remember to get back to this when I get back home.

Meanwhile, you might consider purchasing a PICkit 1 (if you just want to stick with a couple of visibars) and some PIC12F629 or PIC12F675 uC's to play around with. The PICkit 1 costs about $35, and comes with 1 pre-programmed PIC12F675 (the flashing LED demo), software, and a "lite" version of C and an assembler. Thread Starter #### Quick2Scramble Joined Oct 30, 2009 10 @ Bill I did read that page but it didn't seem to cover my project as it doesn't mention using a pic for the control I'm looking for. SgtWookie, Thank you for your reply. I pulled the 12F629 out of their assembly and put it into my Willem to try and get the hex. Read was successful. I wrote the code to a 12F629 I had on hand and put that into their assembly and the LEDs functioned as if I had the original in. I did some quick research on how to convert the hex to ASM so I can modify it but I'm not quite sure what I'm doing. All just a part of the learning process, I'm sure. My main issue now is everything on the board besides the 12F629 chip. I'm trying to figure out exactly what's on the board and the purpose of everything. The resistors I can figure out by band color. The capacitors appear to have their values printed on them. A few parts I'm not familiar with are: C4/C5/C6 - Based on the C I'm assuming these are capacitors? The chip labled UTC SDA5 MC34063AL R1 - Why is this surface mount unlike the others? U1 C11 Q3/Q4 - Transistors? D1/D3 The large blue cap looking component next to the UTC chip I'd imagine I can just follow the traces on the board to see what connects to what but I was hoping to perhaps find a similar schematic to guide me along a bit. I'm not understanding what the need is for everything they've got on there. I'm new to all of this and trying to learn as I go along. Thread Starter #### Quick2Scramble Joined Oct 30, 2009 10 Here's what I've managed to get from some components: C1 - 220uF 35v Capacitor C4 - 104J 100V "" C2 - 220uF 35v "" C5 - 104J 100V "" C6 - 104J 100v "" D1 - IN4007 CH Diode? D3 - N5819 (Assuming it should be IN5819) bufan Diode? R1 - R33 (Surface Mount) Haven't tackled the banded resistors just yet. U1 - WS 78L05 707B Q3/Q4 - NEC D882P M 2Y #### tibbles Joined Jun 27, 2008 249 hi Quick2Scramble im thinking of building something like this for disco lighting, i too am just starting programming, so i shall be interested to see what you come up with. reverse engineering your existing board sounds like a right p.i.t.a. (i have seen these surface mount resistors, usually very low value used as current sense resistors) you are probably better finding a similar code and modifying it youself, im sure someone here would help with this. regards dougal ps whats a LEO? Last edited: #### SgtWookie Joined Jul 17, 2007 22,210 @Tibbles: LEO = Law Enforcement Officer. MC34063AL is a DC-DC converter. I have to run. [eta] Back for a bit. Moving is no fun! Datasheet for the MC34063A is here: http://www.onsemi.com/pub_link/Collateral/MC34063A-D.PDF There are some application circuits in the datasheet. A 1N5819 is a 1A 40v Schottky diode. U1 - 78L05 is a 5vDC 100mA regulator. PICs require a Vcc of 2.5v to 5.5v; 5v is most commonly used. R1 is an 0.33 Ohm resistor. Resistors of such values can be easier to obtain in SMT/SMD rather than thru-hole axial packages; as they are very commonly used for current sense resistors in things like H-bridges and power supplies. It is rather odd that they mixed SMT and thru-hole. A 1N4007 is a 1kv 1A rectifier diode. Q3 and Q4 are transistors. These will substitute: http://www.fairchildsemi.com/ds/BD/BD441.pdf Mouser stocks them: http://mouser.com/ProductDetail/Fairchild-Semiconductor/BD441STU/?qs=JV7lzlMm3yKqdJ3z04aOiw== NTE crosses the 2SD882P to an NTE184. Datasheet: http://www.nteinc.com/specs/100to199/pdf/nte184.pdf If you want to pay a lot more for those, Mouser also has a few in stock for$2.29 instead of $0.33. The capacitors marked 104J are 100,000pF or 100nF or 0.1uF (all the same value) 5% tolerance. They're used for bypassing the power rails at the ICs (handling transient loads; smoothing out the bumps). Digikey has 10 for$1.25:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=P4725-ND

[eta]
As far as the resistor values, not hard to figure out once you know the color codes and what they mean.
Here's a page with their meaning and a graphical resistance calculator:
http://www.the12volt.com/resistors/resistors.asp
Here's a page with just the graphical calculator, but also links to 5 and 6 band resistor calculators:

The blue capacitor looking thing labeled L1 is an inductor. Are their any markings on it?

Last edited:

#### SgtWookie

Joined Jul 17, 2007
22,210
OK, as far as your board pics - you have two top views, which is great. Can you post a pic of the bottom, too?

#### SgtWookie

Joined Jul 17, 2007
22,210
OK, getting a bit into what's connected to what...

Scroll to page 5, looking at figure 9. That IC is your U3.
See the inductor marked "170uH" and "L" on the top? That's your blue thing labeled L1 that looks like a cap. Exactly what value your inductor is may vary; see if you can read it.
One end of it is connected to U3's pin 1 - so is the anode of your 1N5819 Schottky diode.
The other end of your L1 is connected to a 180 Ohm 5% resistor (brown-grey-brown-gold) - your R2 - and pin 7 of U3.
R1 on your board is an 0.33 Ohm resistor. See Rsc in the schematic? It's 0.22 Ohms.

Below that in the schematic, you have R1 (2.2k) and R2 (47k). These establish the output voltage.

Your boards' R3 (10k) is the schematics' R1 (2.2k).
Your boards' R4 (220k) is the schematics' R2 (47k).
They're basically the same ratios; 23 vs 22.36 ; you'll get about 28.8v out of U3 on C2, your 220uF cap. FYI, caps should be rated around 2x or more the voltage they might 'see' across themselves, otherwise they may have high leakage current and will fail early. That 35v rating should've been 55v.

You haven't given a value yet for your C3; that's Ct (1.5nF) on the schematic. That's the timing capacitor for the oscillator in U3. It's value could be anywhere between 470pF and 4.7nF (471j to 472j).

#### Quick2Scramble

Joined Oct 30, 2009
10
C3 is marked: F63 102K

Will check on the thru hole values tonight.

#### SgtWookie

Joined Jul 17, 2007
22,210
C3 is marked: F63 102K
OK, that's 1nF (.001uF, or 1,000pF) and 10% tolerance.

Will check on the thru hole values tonight.
I may not be back at my place for another day or two. Take your time.

#### Quick2Scramble

Joined Oct 30, 2009
10

#### SgtWookie

Joined Jul 17, 2007
22,210
Nice job on the pics. Helps a lot to get slightly different views.

On capacitor C3; Digikey has on hand a suitable replacement: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=P4785-ND
Same value, just a bit tighter tolerance and higher voltage. You have to buy 10, but if you're going to make several of these things you'll need them anyway. Always good to have some spare components on hand; you don't want to pay twice for shipping.

Eventually, they'll run out of those caps. After that, you could buy these:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=495-1132-ND

#### Quick2Scramble

Joined Oct 30, 2009
10
Thanks SgtWookie!

I'm in the process of figuring out the resistors. One thing I just noticed and found quite strange is that D2 has a resistor instead of a diode.

Here's what I have so far and I'm double checking with a multimeter. First reading will be according to bands/calculator, second reading is from MM.

D2 - 10k/9.9k
R2 - 180/180
R3 - 10k/9.6k
R4 - 220k/Can't get a good read, meter just keeps moving
R5 - 10k/9.82k
R6 - 5.1k/5.2k
R13 - 2.2k/2.11k
R14 - 2.2k/2.13k
R17 - 330/324
R18 - 330/327
R19 - 5.1k/5.1k

Can't find any markings on the L1 inductor. Would it help to pull off the outer shielding?

#### SgtWookie

Joined Jul 17, 2007
22,210
On the 220k; don't worry about it - you're probably seeing multiple paths for current flow via the IC.

It's OK that you can't find markings on L1. I'm not going to try to do much circuit analysis from where I am; I have no good way to save my results, nor any real tools to work with.

#### Quick2Scramble

Joined Oct 30, 2009
10
I found a few MC34063A at DigiKey, not sure which will suit my needs.

#### SgtWookie

Joined Jul 17, 2007
22,210
I found a few MC34063A at DigiKey, not sure which will suit my needs.
OK, right now the board is sort of a mish-mosh of surface mount and thru-hole. DIP PICs may be your only option if you have a DIP programmer. You mentioned your programmer previously, but I'm not familiar with it's capabilities.

If you're going to be making a bunch of these things, you might consider going to SMT/SMD packages. They can be a bit of a challenge for someone that's new to soldering, and/or if you have clumsy fingers. Sometimes when I'm working with SMD's I feel like I'm trying to solder a flea using a crowbar.

A couple of items that are left sort of up in the are are the trace routings around the MC34063A and the PIC12F629. The former can be figured out by using the example circuits in the datasheet; the latter can't. You'll need to pull out the PIC and see what's connected to what.

Also, you should consider whether you want to fiddle around using DIPs in sockets, or start using SOIC packages and in-circuit programming headers so that you can just re-program the thing without taking it off the board.

#### Quick2Scramble

Joined Oct 30, 2009
10
This is my programmer, more or less:

http://www.mcumall.com/images/DualPowerWillemAT29C256.jpg

This is a newer version of mine:

http://www.sivava.com/EPROM_Programmer_5.html

Here is a list of the latest supported chips:

Now, I am unable to write to a 12F629 using that software, but I am able to write to it with another program.

I will probably use smt/smd. I'm very experienced in soldering with 15/30 watt irons. Making the actual PCB is going to be my first real challenge. I've never done so before.

Ok, will trace the pic pinouts tomorrow.

I assumed that since the code is from the 12f629 that i have to put it on another 12f629.

#### SgtWookie

Joined Jul 17, 2007
22,210