Science Project - 10-yr old needs help with PIC Led Flashing Circuit

SgtWookie

Joined Jul 17, 2007
22,230
OK, I figured out what they meant ... look for their other auctions of the similar type; the specifications are on the other auctions, not on the package that you receive.

Here is what I found:
-------------------------------------------------------
Choice #1B: 5mm Red, 4,000mcd
Product Label: 100x FCB Red 5mm Oval Ultra Bright
Package Description: 100 pcs 5mm Red LED 4000mcd
Emitted Color: Red
Size (mm): 5mm
Lens Color: Water Clear
Peak Wave Length (nm): 625 - 630
Static Sense: No
Forward Voltage (V): 1.9 - 2.1
View Angle: 5 - 25°
Luminous Intensity (mcd): 3500 - 4000
Maximum Current:20mA Continuous, 50mA peak for 10% Pulse Width
Item Net Weight:75g / 2.7oz
-------------------------------------------------------
Choice #2B: 5mm White, 15k to 17,000mcd
Product Label:100 pcs 5mm White LED 17000mcd
Emitted Color:White
Size (mm):5mm
Lens Color:Water Clear
Peak Wave Length (nm):N/A
Static Sense: Yes
Forward Voltage (V):3.0 - 3.2
View Angle:5 - 25°
Luminous Intensity (mcd):15000 - 17000
Maximum Current:20mA Continuous, 50mA peak for 10% Pulse Width
Item Net Weight:75g / 2.7oz
-------------------------------------------------------
Choice #3B: 5mm Blue, 6,000mcd
Product Label: FCB 100x Blue LED 5mm Ultra Bright
Product Description: 100 pcs 5mm Blue LED 6000mcd
Emitted Color: Blue
Size (mm): 5mm
Lens Color: Water Clear
Peak Wave Length (nm): 460 -470
Static Sense :Yes
Forward Voltage (V):3.2 - 3.4
View Angle: 5 - 25°
Luminous Intensity (mcd): 5000 - 6000
Maximum Current: 20mA Continuous, 50mA peak for 10% Pulse Width
Item Net Weight: 75g / 2.7oz
-------------------------------------------------------
 

Thread Starter

szot

Joined Jan 5, 2010
16
Bill/SgtWookie,
Just wanted to update you on where we are with the project:
1) I read the specs and Bill's article on LEDs, but I am still not confident that I understand how to calculate the power/resistor combination that we will need to power her sign with approximately 90 LEDs. I think we will need to solder all of the negative ends of the LEDs (already done on the "U" & "S"). I take it we will then solder a 30ohm resistors between every positive end and then connect the positive ends of the letters that we want to operate at the same time.

2) My concern is that it does not appear that the switch in the kit will allow us to operate strings of LEDs separately like in the "Ultimate Fan Sign" where he had 1 letter flashing at any given time. This switch appears to control all strings simultaneously which would mean that the load at some points will be maxing out when all of the LEDs are lit.

3) Now for the most embarrassing update....We soldered the new 78L05 5V regulator to the board and then per Mr. Al's direction, I daisy-chained (+ to -s) 4x9V snap connectors together and connected 4 x 9v batteries to the LED power side of the circuit and 1x9 v to the micro controller side. Immediately I saw smoke rising from what appeared to be the 5v regulator and as I was disconnecting it, I touched the ULN2803A was scorching hot. I figured I fried the 78L05 and of course I don't have another one. I am still waiting to receive the replacement from the place where I ordered the kit + I ordered several more as back-ups from Digikey earlier today (along with a replacement ULN2803A in case I fried it too, some 30ohm resistors and the 8 AA battery holder). I disconnected the extra snap connectors and then tried just reconnecting the 1 x 9v to the LED side and immediately the ULN2803A heats up (too hot to touch) and for the 2-3 seconds that it is on only about 1/2 of the LED strings are lit.

So, that is where we stand. Thanks for your continued help!
Stacy





I am attaching a couple more pictures and the report that Katie wrote yesterday.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Ouch. I don't know why you tried to wire four 9v batteries in series, and then connect them up without asking.

I had suggested that you obtain a battery holder that would take eight 1.5v batteries. You would have been fine if you had done that.

The 78L05 should only have 8v to 12v DC input. You put about 35v into it, and let the magic smoke out. You may very well have killed the PIC microcontroller, too.

The cathodes of the LEDs should not have been all wired together. You can connect LEDs in series; each LED will drop some of the voltage, and then use a current limiting resistor to control the current through them. But if all of the LEDs have their cathodes wired together, you'll have to unsolder them.
 

hgmjr

Joined Jan 28, 2005
9,027
Sorry to hear about your temporary setback.

These delays are what I refer to as "rocks in our shoes". It is part of the learning process and should be accepted as such. Believe me I have destroyed many components in my career. Some of them were very expensive too.

The reward is overcoming these small hurdles and moving on to attain your final goal.

Nice writeup by the way. Sounds like Katie has a pretty good grasp of the basic operation of her circuit.

Good Luck,
hgmjr
 

Thread Starter

szot

Joined Jan 5, 2010
16
I assure I have enough disappointment for the both of us SgtWookie. I only connected the 4 x 9vs because the technician who was helping us showed me how to do it and said that it would be fine. I think I thought that the power going to the LEDs was not going through the 5v regulator and that it would directly power the LEDs. I have the 8 "AA" battery holder on order, it just won't be here for a couple more days. I really hope that I didn't fry the PIC...

1) I am confused as to why we wouldn't solder the negative ends of the LEDs just like we had done on the 16 "test" green and red LEDs that we connected onto the board originally? The positives were then commoned together which is what I planned to do, with the acception of adding the resistors.

2) I will continue to follow your advice though as long as you are willing to give it. Fortunately I bought 100 of each color LED so it will not require unsoldering, but just removing what we have soldered and starting again. I hate to waste the LEDs that are already in place, but I am willing to accept it as a price of learning...

3) Can you give me a basic rundown of how the LEDs should be connected from this point out? I am just not "getting" how to calculate for voltage drop, differing voltage requirements of the various LED colors in the different letters.

hjmgr - Thx for the compliment on Katie's write-up. I know that she will have to make some improvements after her test presentation at the end of this week, but this is a learning PROCESS...I have to keep reminding myself of that as this project grows more and more expensive!

Stacy
 

Wendy

Joined Mar 24, 2008
23,429
For what it's worth you have a better handle on what to do that 50% of the people who come to this site. It's OK to make mistakes, it is how all of us learn.

Did you know a capacitor connected backwards makes an excellent stink bomb? Not some thing I would recommend. :)
 

Thread Starter

szot

Joined Jan 5, 2010
16
I reread Bill's article on LEDs as well as both articles from the magazine and what came with the kit and have some more thoughts that I wanted to run by you guys:

According to their example they say we need 1.8V per LED... and 45V is enough to power 22 LEDs *on each output* (in other words, each LED row, and there's 8 rows... hence their 22LEDs * 8 rows = 176 total LEDs.). So let's say we split up your 90 LEDs as evenly as possible across the 8 rows... that'd leave at most 12 LEDs on one row, so 12 * (1.8V) = 21.6V, so we'd probably only need maybe 24V on the 9-45V input to power a row that had 12 LEDs on it (we need a little more than 21.6V since the current limiting resistor will use some of that up)...is that right?

BUT I still don't understand this: All we did was connect the COM pin to the end of all the LEDs: "On the right hand side all the anodes have been commoned together and connected by a single wire to the COM pad." With the + side of the 9V going to the 9-12V connector, the + of 4x9V going to the 9-45V connection, the - of both batteries wired to ground, and the COM pin wired to the anodes of all the LEDs (with all of those anodes wired together) I'm not sure why we burnt out the regulator if things were wired correctly (which I really think that they were).

QUESTION: Should I be using 420 Ohm resistors instead of 30 ohm? I think I am mixing info from the kit and the Ultimate LED Fan Sign instructions....the fan sign guy definitely said 30 ohm so I ordered 120 of those from Digikey yesterday. Do I need to go buy something else?

Please bear with us SgtWookie! We can still really use your help!
Stacy
 

SgtWookie

Joined Jul 17, 2007
22,230
Stacy,
Sorry if I sounded a bit gruff in my last reply. I just didn't know why you would've done the 4-9v battery thing when we'd previously discussed operating it on 12v. Staying with a somewhat lower voltage and bigger batteries is actually a good thing.

Let's just assume for now that you want to run it from a lower voltage.

You can run multiple strings of LEDs in parallel from that ULN2803 IC. If it's been really heated, it may be fried; you might want to order a replacement from Digikey.com, Mouser.com, or Jameco.com. Digikey will ship via USPS 1st Class mail, which can save money on small orders.

OK, so you have three different LEDs:
Vf is the forward voltage of the LEDs when the given current is passed through. I've averaged the Vf from the specifications given; this is typical.
Red: Vf= 2.0V @ 20mA
Wht: Vf= 3.1V @ 20mA
Blu: Vf= 3.3V @ 20mA

You can operate several LEDs in a series "string", even on lower voltages.
The ULN2803 is rated for up to 350mA sink current per output; but let's be conservative and limit that to 200mA. 200mA/20mA = 10 strings of LEDs in parallel.

If you are operating the board from 12v, the ULN2803 driver will drop between 0.8v and 1.1v across itself, and the resistor needs to have at least a volt drop for good current regulation.

Let's just say the ULN2803 will drop 0.9v, and the resistor needs another volt. That's 1.9v.
If using a 12v supply, you have to subtract the resistor and driver (uln2803) voltage from the supply voltage. So, 12v - 1.9v = 10.1v remaining.
Let's see how many LEDs of the different colors you can use in one string.
Red: 10.1/2v =5.05; you round that down to an integer, so 5 LEDs in one string.
White: 10.1/3.1 = 3.25; rounded = 3 in one string.
Blue: 10.1/3.3 = 3.06; rounded = 3 in one string.

Now let's figure out the resistors that you will need. Remember, we subtracted an extra volt from the supply to make sure we had a voltage drop across the current limiting resistor. Right now, we just need to subtract the voltage drop across the ULN2803 driver.
So, 12v - 0.9v = 11.1V remaining as a voltage supply to the LEDs.
The generic formula for calculating LED current limiting resistors is:
Rlimit >= (Vsupply - (Vf_LED * Number_of_LEDs)) / Desired_Current

So, let's dive right in:
Red: Rlimit >= (11.1v - (2.0v * 5))/20mA
Rlimit >= (11.1 - 10) / 0.02
Rlimit >= 1.1 / 0.02
Rlimit >= 55 Ohms
Next, we look at a table of standard resistance values - here's a page that has them:
http://www.logwell.com/tech/components/resistor_values.html
Basically, just look at the E6, E12 and E24 columns. You'll see that 55 is not a standard value, but 56 is - so you can use that.

White: Rlimit >= (11.1v - (3.1v * 3))/20mA
Rlimit >= (11.1 - 9.3) / 0.02
Rlimit >= 1.8 / 0.02
Rlimit >= 90 Ohms
Going back to the standard values chart, we find that 90 is not a standard value, but 91 is (it's a decade table, so you can shift the decimal point to wherever you need it; 910 in this case shows that 91.0 is a standard value)

Blue: Rlimit >= (11.1v - (3.3v * 3))/20mA
Rlimit >= (11.1 - 9.9) / 0.02
Rlimit >= 1.2 / 0.02
Rlimit >= 60 Ohms
And again, 60 Ohms is not a standard value, but 62 (62.0) is.

So, now you have the resistor values you need.
 

SgtWookie

Joined Jul 17, 2007
22,230
OK, going back and looking at the photo of Katie holding up the USA sign (cute pic! :)) I see that you are going to be using 36 red LEDs.

Earlier, I calculated that you could use 5 in one string. However, it'll be easier if the strings are all the same.
Conveniently, 36/4 = 9 strings; so if you cut back from 5 LEDs to 4 LEDs in a string, you'll have a nice even number with no "leftovers".

This means the resistor for each red LED string needs to be re-calculated:
Red: Rlimit >= (11.1v - (2.0v * 4))/20mA
Rlimit >= (11.1 - 8) / 0.02
Rlimit >= 3.1 / 0.02
Rlimit >= 155 Ohms; not a standard value. 160 Ohm is!

I've attached a schematic how to connect up the LEDs for just the RED ones in the "U" so far. Only three of the 9 strings total are shown; but you just keep connecting them up like I have displayed.

The connector marked "ULN2803N" will actually connect directly to one of the ULN2803 outputs, not through the resistors that are already on the board.

 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
OK now, let's look at the white LEDs.

You have 33 LEDs on the "U", and you can run three white LEDs in series with one resistor.
That means 11 strings total. 11*20mA=220mA. I arbitrarily decided on a 200mA limit. You could increase the white LED resistors from 91 to 100 Ohms; that would keep the current under 200mA.

But here's how you would connect them up (only three of the 11 strings shown):

 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
OK, let's look at the blue LEDs. You have 36 of them; that's 12 strings of three.

Earlier, I calculated:
Blue: Rlimit >= (11.1v - (3.3v * 3))/20mA
Rlimit >= (11.1 - 9.9) / 0.02
Rlimit >= 1.2 / 0.02
Rlimit >= 60 Ohms
And again, 60 Ohms is not a standard value, but 62 (62.0) is.
But, we'd wind up with 12*20mA=240mA current. Let's stay below that.
200mA / 12 = 16.67mA
We have 1.2v to drop that we want 16.67mA flowing through
R=E/I
R=1.2v/16.67mA
R=71.98 Ohms

Back to our table of standard values, we find that 72 is not a standard value but 75 is!

You can use the same basic schematic as for the white LEDs, but use 75 ohm resistors.
So now you are ready to wire up all three colors of LEDs.
 

SgtWookie

Joined Jul 17, 2007
22,230
Now for the recap:
Red LEDs: you will have 9 strings, you need 160 Ohm resistors x 9
White: 11 strings, you need 100 Ohm resistors x 11
Blue: 12 strings, you need 75 Ohm resistors x 12

ULN2803: you probably need another one.

Order extras of each; just in case some get damaged or lost.
 

SgtWookie

Joined Jul 17, 2007
22,230
Now, which resistors to get...
I'm just going to give you some links on Digikey for the parts.
160 Ohm; get at least 15 : http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=160QBK-ND
100 Ohm; get 15 or more: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=100QBK-ND
75 Ohm; get 15 or more: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=75QBK-ND

ULN2803A; get a couple: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=ULN2803APG-ND

Have them ship it USPS 1st class, it'll be cheaper than any other way.
 

Thread Starter

szot

Joined Jan 5, 2010
16
SgtWookie...You are amazing! Wow. I am printing this off now and my daughter and I are going to over it (and over it and over it) together as soon as I finish this message. This is so helpful.

She has her practice presentation to the head of the high school science department tomorrow. She just did a couple of dry runs with me and I am so impressed with how much that she has learned through this process. I have 2 ULN2803s that came from Digikey today (along with the replacement 78L05s), and my 30 ohm resistors (ha!). I will order the others now.

Thanks again. I will be back with any questions and a progress update soon!

- Stacy (& Katie who is standing over my shoulder watching me type right now!) ;)
 

Thread Starter

szot

Joined Jan 5, 2010
16
Hi SgtWookie,
We took a little break from the science project last week after Katie nailed her practice presentation to the head of the science dept at her school. She really knocked their socks off apparently (wish I could have been there to see it).

Anyway, she worked all afternoon to get her LEDs soldered to the resistors and we are in the process of connecting them now. Just to make sure that we were doing it correctly, we did a test with 2 strings of 4 red LEDs connected to a wire that leads back to the ULN2803 output (directly as you told us to do) and then each string is connected to a common back to the com pad on the circuit board. It worked like a charm and she is very pleased with how the LEDs look in the holes on the sign itself!

Question: When we connect the 9 strings of 4 red LEDs, ALL of those strings connect via 1 wire to the ULN2803 output...is that correct? Following this set up, we only be using a total of 3 ULN2803 outputs - 1 for red, 1 for white, 1 for blue - leaving essentially 5 outputs with nothing on them. Is that okay or should I spread out the strings to use the outputs as evenly as possible?

Thank you. can't wait to post pics of the finished "USA" sign.
Stacy
 

SgtWookie

Joined Jul 17, 2007
22,230
Hi Stacy,
You must've been reading my mind - I was wondering how this project was going just last night!
We took a little break from the science project last week after Katie nailed her practice presentation to the head of the science dept at her school. She really knocked their socks off apparently (wish I could have been there to see it).
Great - does she understand all of the math behind calculating the current limiting resistors, current in parallel, etc? These are important basics for her to know and understand.

Anyway, she worked all afternoon to get her LEDs soldered to the resistors and we are in the process of connecting them now. Just to make sure that we were doing it correctly, we did a test with 2 strings of 4 red LEDs connected to a wire that leads back to the ULN2803 output (directly as you told us to do) and then each string is connected to a common back to the com pad on the circuit board. It worked like a charm and she is very pleased with how the LEDs look in the holes on the sign itself!
Great! :D You didn't mention the current limiting resistors in each string though - I hope that they are in the circuit, or the LEDs won't last long at all!

Question: When we connect the 9 strings of 4 red LEDs, ALL of those strings connect via 1 wire to the ULN2803 output...is that correct?
Yes.
Following this set up, we only be using a total of 3 ULN2803 outputs - 1 for red, 1 for white, 1 for blue - leaving essentially 5 outputs with nothing on them. Is that okay or should I spread out the strings to use the outputs as evenly as possible?
It is OK; this will make all of the LEDs in one letter flash at the same time.
However, if you want to use some of the different patterns, you could connect part of the LEDs in a letter to a different ULN2803 output.

Thank you. can't wait to post pics of the finished "USA" sign.
Stacy
Can't wait to see it either! :)
 
Last edited:

Thread Starter

szot

Joined Jan 5, 2010
16
Good to hear from you. Yes, we did connect the resistors as shown in your diagram...correct ohms on each this time too!

Katie is still working to grasp the math on the resistor calculations, but she understands the overall concept of why it is important to calculate resistance and that, in my opinion, is the priority given her age/grade level. So, we will keep working.

Thanks for clarifying the ULN2803 connections. I thought that was probably the case, but figured "better safe than sorry." I'll be back in touch soon with more results hopefully!
have a great night.
Stacy
 

hgmjr

Joined Jan 28, 2005
9,027
Its great to hear that your daughter nailed her presentation for her project. Like Sgtwookie, I too had wondered how things were progressing with the project. I just figured you had ordered a few additional parts for the project and it was taking a bit of time to get them delivered.

Looking forward to more pics showing the finished project.

Good Luck,
hgmjr
 
Top