Connect with us

The Results of everyones help.

Discussion in 'Electronic Basics' started by Chris W, Mar 15, 2005.

Scroll to continue with content
  1. Chris W

    Chris W Guest

    I would like to thank everyone for all the help over the past little
    while. I thought I would share the results of that help.

    I have put together my 256 light controller on prototype boards. Right
    now it only controls 32 lights. It is expandable in 16 light
    increments. It is made up of 3 basic parts. First there are up to 16
    "Light boards", each will be stackable and control 16 lights. Then
    there is the light board addresser. That will be on a PCB with the
    micro controller and it will send a signal to each of the 16 light
    boards. Finally the micro controller. I decided on the Rabbit
    RCM3100. I know it is over kill, but I wanted to be able to program it
    in C. Here are the details.

    The "light boards" each have a 4 to 16 line decoder (CD74HCT4514) and 16
    D type flip flops (SN74HCT74) wired up as toggle flip flops. All of
    the, up to 16, light boards have the 4 LSB from an 8 bit output on the
    RCM3100 hooked to the input of the 4 to 16 line decoder. The output of
    the flip flops will go to either solid state relays or a transistors of
    some kind to drive higher current loads.

    The light board addresser has a slightly different 4 to 16 line decoder
    (CD74HC154) the out puts of which go low instead of high. It gets it's
    input from the 4 MSB of the 8bit output on the RCM3100. It's 16 outputs
    each go to the enable input on the one of the CD74HCT4514s on the 16
    light boards.

    I can then program the RCM3100 to flash the lights in any pattern I can
    dream up and I have dreamed up quite a few already. Of course I now
    need to layout a PCB and have some made. First I need to design the
    circuit that the RCM3100 will go in, with some kind of power supply
    regulator and a few buttons to select different modes. The prototype
    board is way too big for what I want to do with this other wise I could
    just solder on a pin header and hook my boards to that.

    The final result will be a remote control airplane that will be lit up
    in manor that will put any Christmas tree to shame. I then plan to have
    some fun flying it at night. The reason I want to have the lights flash
    in all kinds of different patterns, is I intend on using the flashing
    pattern as well as the LED colors to help keep track of the orientation
    of the plane. Of course there is also the "cool factor" :)

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
  2. Lord Garth

    Lord Garth Guest

    Chris, don't omit .1uF capacitors as near to the chip power pins as
    The caps will help absorb power supply spikes that will screw the FF's up.

    BTW, how big is this remote controlled plane? How many lights are to be on
    board the plane? An EPROM would be far simpler when used to store patterns
  3. Chris W

    Chris W Guest

    It will probably have a wing span of around 6 feet, and be in the 7 lbs
    range. It depends on the number of wing ribs(one set of LEDs between
    each rib), but probably about 30 in each wing, maybe a few more down the
    length of the fuselage. Then a few more in other various places like the
    wing tip, vertical and horizontal stabilizer tips. For the wing, I will
    have one or two in the leading edge and one or 2 behind the main spar
    with a transparent film on the top and bottom of the back half of the
    wing, between each rib. For the fuselage I will probably have one set
    down the bottom and one down the length of each side. So probably some
    where near 100 total. Wow that is a lot

    I'm having a hard time understanding how a simple eprom could do what I
    am doing. So far I am up to about 240 lines of C code. I am a pretty
    good programmer and I don't think I could cut down on that count by very
    much and still do what I am doing. It is pretty hard to describe the
    patterns I am trying to do, I could post the C code that will run from
    a command prompt and display the wing light patterns with - and O for
    off and on. Maybe you could look at that and tell me if I could use eproms.

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want

  4. Chris,

    I may have missed a part of the discussion but looking at your hardware I
    can't say but you're using a hell of a lot of electronics just to light some
    LEDs. The classic way to light this amount of LEDs is by multiplexing. To
    light 256 LEDs you need 32 output lines either directly from the
    microcontroller or via registers like the HCT374. If you use four of the
    latter you only need twelve output lines from the micro. The general idea is
    to build a sixteen by sixteen matrix. So sixteen rows and sixteen columns.
    On every point they cross you mount a LED that conducts from - let's say -
    row to column. To switch the LEDs off, you keep the rows low and the columns
    high, so all LEDs are blocked. Now to switch on some LEDS in a particular
    column, you bring the corresponding rows high and then pull down the column.
    You keep it that way for let's say 2ms then switch all off and select the
    LEDs of the next column. On the electronic side of the project you need to
    make the rows to be able to provide the current a LED needs along with a
    current limiting resistor. The column driver need to be able to sink the
    current for sixteen LEDs. Using discrete transistors is the easiest way. All
    of the rest can be done in software, which seems to be your better skill.

    petrus bitbyter
  5. Lord Garth

    Lord Garth Guest

    Granted that you don't get out of using LED drive transistors but the idea
    to determine the longest pattern you wish to repeat, thus determining your
    counter length. Next you address, in parallel, as many EPROMs as you need
    to light the number of LED's onboard, 8 outputs per EPROM.

    Example for a 2k 2716:

    11 bits
    address data EPROM1 data EPROM2
    00000000000 00000001 00000000
    00000000001 00000010 00000000
    00000000010 00000100 00000000
    00000000011 00001000 00000000
    00000000100 00010000 00000000
    00000000101 00100000 00000000
    00000000110 01000000 00000000
    00000000111 10000000 00000000
    00000001000 00000000 00000001
    00000001001 00000000 00000010
    00000001010 00000000 00000100
    00000001011 00000000 00001000
    00000001100 00000000 00010000
    00000001101 00000000 00100000
    00000001110 00000000 01000000
    00000001111 00000000 10000000
  6. Rich Grise

    Rich Grise Guest

    Very impressive!
    I'd say, arrange them 8 x 32, and put them on the side of an RC blimp;
    then sell ad space. ;-)

    (The first time I saw the lights on the Goodyear blimp, I was with my
    brother, in a line of cars waiting to get into the state fair; it was
    the first time either of us had ever seen the lit-up blimp, and we
    were stoned at the time. Apparently, so were the kids in nearby cars -
    just about everybody had got out of their cars and were marveling at the
    lights in the sky... %-} )

  7. John Fields

    John Fields Guest

    I hate to bust your bubble so far downstream, but you can control all
    16 LEDs on one light board with a single chip, an Allegro Microsystems

    and you can control _all_ of the LEDs with just 3 IO's from your µC.

    If you want to store the patterns in ROM, just write them into a
    serial EEPROM and download the patterns as 256 bit 'pages' into the 16
    chip A6276 array.

    Total chip count? sixteen A6276's, one µC, and one or more serial
    EEPROMs, depending on how many patterns you want to store/display.

    Also, zero (instead of 256) LED driver transistors, and 16 LED current
    setting resistors instead of 256 base resitors and 256 current
    limiting resistors.

    Plus, your display would be static, so no multiplexing problems.

    Code to do the whole thing should run less than about a hundred lines
    or so of assembler.

    Hard to resist, huh?-)
  8. Chris W

    Chris W Guest

    No bubble busting here. I am glad to hear of easier and better ways. I
    am new to this and don't have much of an idea as to what I am doing.
    Building it this was was a learning experience. I just hope to find the
    easiest way before I have the PCBs made. What I would really like to
    have is one of these. . .

    in a single 36 pin chip. Even half of it in an 18 pin chip would be nice.
    Thanks for the data sheet. I just found some in stock at Arrow
    Electronics, and ordered them.
    What do you mean by "base resistors"? I was going to use the output of
    the flip flop to control a transistor gate, then have a DC to DC
    switching regulator power the LEDs with the voltage they want. That way
    I didn't think I needed any resistors for the LEDs.
    That is a plus I don't like the idea of multiplexing, especially since I
    also would like to use the same circuit to switch larger loads via a relay.
    Very hard to resist. However I do see a few down sides. I don't think
    they are that big of a deal though.

    1) I don't see anyway to turn on all lights as a test with just the push
    of a button.
    2) Once all 256 lights are in the state I want them, to change that
    state I need to disable the output, write 256 bits of data back in, and
    then re enable the outputs. I guess that's not that big of a deal since
    even at a modest rate of 1 mhz, it would take less than 1ms to send the
    256 bits through, I think. With it that fast I guess I don't even need
    to disable the output since it would change to the next state so fast
    that you couldn't see the changes.

    An advantage though is that it looks as though this has virtually
    unlimited expandability by just chaining more and more chips together.

    Once I figure out all the patterns I want to use, the eprom sounds like
    an interesting idea. I think I would need 10k bytes, or more though.
    Some of the sequences have several patterns, and there could be as many
    as 6 different sequences going at once.

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
  9. John Fields

    John Fields Guest

    LEDs don't want voltage, they want a certain amount of current, and
    when that much current is flowing through them the voltage across them
    will be the specified Vf, or forward voltage. Same thing with the
    transistor bases. Basically what you do is say how much current you
    want flowing in the collector-emitter junction, divide that by ten and
    allow that much current to flow in the base-emitter junction with
    about 0.7V across it. That's called running the transistor with a
    "forced beta" of ten, and will make sure the transistor is running
    with the collector saturated. So, to do it that way you'd need a
    current limiting resistor from each of the flip-flop outputs to the
    base of each transistor, and in series with each LED in order to limit
    the current through them.
    Either poll the IO a switch is hooked to or let the switch trigger an
    interrupt and then when the switch is pressed send 256 zeroes to the
    array if you use A6276's, since they're sinks.
    No, you leave the outputs alone, clock the new data in serially and
    then, when the array is full and all the new data is lined up with the
    outout latches, strobe the output latches and all the new data will
    overwrite the old data and appear all at once.
    I think it's better to strobe the outputs since you'll only be be
    changing the supply current once per frame instead of 256 times per
    frame with, I think, less high-frequency noise because of that.
    Yes, but don't forget your power supply. 256 LEDs times 20mA per LED
    means 5.12 _amperes_ when all the LEDs are on!
    OK. Considering a byte to be 8 bits and a frame to be 256 bits, that
    means you'd need 32 bytes per frame, so even 8k (8192) bytes of EEPROM
    would get you 256 frames. Then, for six different sequences you could
    have about 42 different patterns for each sequence with that amount of
  10. Chris W

    Chris W Guest

    I know that Vf is different for different LEDs, but doesn't E = I*R
    apply to LED's. I don't suppose you can measure the resistance of an
    LED with an ohm meter, but if the data sheet for the led says If is 20
    mA and Vf is 3.5V and I then hook that LED to a 3.5V source, will it not
    draw 20 mA? I know for other color LEDs it will require a different
    Vf. I was planing on white, green, and red. I am pretty sure I can
    find green and white that have the same, or very close Vf, so I will
    need one regulator for green and white, and one for the red.

    So is that 1/10 I ratio one the base the minimum current required to get
    yeah I knew I could do it that way, but I just like the idea of a dumb
    switch that doesn't have to trigger any kind of logic to turn the lights
    on for a test. With the flip flops I have all the sets and resets tied
    together and I ground the set to turn them all off and the reset to turn
    them all on. Not that big of a deal either way though.

    Thanks for the clarification, I will have to read that data sheet more
    carefully while I am waiting for the UPS man to come.

    for landing and take off all of the wing leading edge LED's will be on
    at once but the rest of the LED's will be flashing and during flight the
    leading edge LED's will be flashing too. I think for the R/C airplane
    application I will use about 100 LED's, so a few AA NiMHs or NiCds
    should do just fine.
    I just did a rough guess, from your calculation, 8K sounds like it would
    be plenty.

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
  11. Rich Grise

    Rich Grise Guest

    No, it does not. An LED is not an ohmic device, it's a PN junction,
    which is not only nonlinear, it's exponential.
    Very probably not.

    A quick google turns up this page with a graph of volts vs current:

    scroll down a screen or so, and look at that graph that's almost vertical
    on its right - that's the part of the curve where you're operating - a
    very very small change in voltage maps to a very large change in current -
    an LED has almost no resistance at all in this region, so the current
    _must_ be controlled by the driving circuit.

    And with a really, really stiff supply, you'll eventually blow the LED,
    since they draw exponentially more current with temperature.
    Nope. If you use a current regulator, the Vf will almost take care of
    itself. With just constant voltage and a resistor, you'd have to select
    the resistor for the Vf.
    Not necessarily, in fact, very unlikely. In fact it's maybe ten times
    as much as you need to get the tranny to actually saturate, so it's
    overkill, so that you _know_ that puppy's _saturated_! :)

  12. John Fields

    John Fields Guest

    Yes, but if you take a look at the forward conduction curve for a
    diode you'll see that the current increases exponentially as the
    forward voltage across the junction increases linearly.
    Not necessarily. What they're saying is that if you allow 20mA to
    flow through the LED there will be a voltage drop across the LED of
    3.5V (plus or minus the spec).
    No, but it's pretty much guaranteed to be with transistors like
    2N4401s and 2N4403s, which have betas of between 100 and 300. 1:20 is
    also a pretty safe bet, but the closer you get to Ib = Ic/beta the
    iffier it gets.
    Well, you're still triggering logic <G> but, right; once the code's
    done and you push the button and all the LEDs go on, who cares?
    Depends on how long you want the LEDs to run, or how long you can fly.
    Four cells will get you up to about 4.8V, and if they're rated at
    1000mAH, 100 20mA LEDs on for 50% of the time will draw an average of
    1000mA, so if you get some heavy-duty cells, the battery will last for
    about 45 minutes to an hour.

  13. R is simply the ratio of voltage to current. For a resistor, R is
    designed to be nearly constant. However, this is not true for almost
    anything else you can put current through.

    The current of an LED is given by the Shockley diode equation:

    I = Is * (exp(-Vf/(N*Vt)) - 1)

    It's obvious from this that the voltage over current isn't anywhere near
    constant for any LED. If the diode is conducting, and the voltage goes
    up a tiny bit, the current will go up alot. Raising the voltage
    something like 60mV will increase the current tenfold!

    Thus, it's not practical to attach a diode to a voltage source without
    some other way to limit the current which isn't so fussy about voltage
    vs current. Usually, one uses a resistor in series with the diode.
    However, there are other ways to go, like a constant current source.

    Robert Monsen

    "Your Highness, I have no need of this hypothesis."
    - Pierre Laplace (1749-1827), to Napoleon,
    on why his works on celestial mechanics make no mention of God.
  14. Maybe this explanation is simple enough to understand for beginners:

    Think of current as a waterflow. A battery is like a water reservoir at a
    certain height (voltage) over the sea level (the negative side of the

    If you connect the reservoir with the sea with a pipe a certain current
    will flow through the pipe. If the pipe is narrow it will present a big
    resistance to the flow, so only a little amount of water per second will
    flow. With a wide pipe a lot of water will flow per second.

    The pipe is like a resistor, thin pipes are high resistance, wide pipes
    are low resistance. We could probably develop an equation similar to Ohms
    law for pipe dimension, water flow and the height of the reservoir.
    (resistance, current and voltage)

    Now, an LED behaves like a dam, the water has to reach a certain level
    before any water at all flows over the dam wall.

    If the water level is one centimeter higher than the dam a certain amount
    of water will flow over the dam wall every second.

    That is like a 3.52 Volt battery connected to a 3.51 Volt LED, and the
    result may be that the LED works as it should.

    Imagine what will happen if the water reservoir level is raised to 3.54

    Enormous amounts of water/current will flow and the LED will burn up in a

    The LED voltage you read in a data sheet is this voltage which separates
    no current at all from enormous amounts of current.

    So it is not wise to rely on the battery voltage, or to rely on supply
    voltage at all. It is better to regulate the current, and let the LED
    develop the voltage it is built for when that current goes through it.

    If we return to our water analogy you should use a water reservoir which
    is a bit higher up than the voltage/dam-height you expect the LED will
    use, and connect the LED with the reservoir through a pipe/resistor which
    gives the current you need, usually 20mA or so.

    The data sheet tells you the LED voltage, not because you are to connect
    such a voltage to it, but to help you calculate the resistor value you
    need to create the current you need.

    If your battery is 3 Volt, and the green LED creates a voltage of 1.9
    Volt, then you need a resistor to take care 3-1.9=1.1Volt and 20mA.

    1.1Volt=0.020*R (Ohms law for the resistor) R=1.1/0.020=55Ohm

    So, put a 55Ohm resistor in series with your green LED and you will get a
    current of 20mA through the resistor and the same current will run
    through the LED.

    If the battery voltage changes a little now it doesn't change the current
    very much, because the resistor will still have roughly 1.1 Volt over it,
    which allows a current of roughly 20mA through it, and your LED is safe
    for some variation of the battery voltage.

    (this analogy is not correct in several ways, but maybe it is good enough
    to understand why LED's need a current regulating resistor)
  15. Chris W

    Chris W Guest

    A little condescending don't you think? Just because I don't have any
    real education or experience in electronics, doesn't mean I'm an idiot.
    I have had well over the the spec voltage drooped across an LED goofing
    off one time, with a 5V voltage source that was capable of delivering 1
    A, and it didn't burn up. Granted it wasn't hooked up for long, but it
    was a heck of a lot longer than a millisecond. Just to be clear, I'm
    not saying that I sunk 1 A through an LED and it survived, just that the
    5V voltage source could have delivered 1 A if it were "asked" to.

    The mathematical relationship of If vs Vf in an LED would have been
    sufficient, and taken a lot less typing.

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
  16. Chris W

    Chris W Guest

    Thanks, that makes it very clear. It's not that I can't supply the
    correct voltage to get the correct current, just that the value is very
    critical and probably varies from batch to batch, with temperature and
    other factors beyond the control of my voltage supply. In this case I
    am looking to get as much light out of the LED's as I can, but if I
    weren't, couldn't I just supply a voltage that was enough lower than the
    Vf to guarantee If was below 20ma and still get plenty of light for a
    indicator or just testing on a prototype board? That way I wouldn't
    have to have a resistor for every LED.

    I'm glad I am getting this information before I get a regulator to
    regulate the battery power going to my the LED's and circuit to control
    the LED's in my RC plane.

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
  17. You forgot the smiley...
    One problem with putting an LED on a voltage source is that the forward
    voltage of the LED decreases as it heats up. Thus, if it starts to heat
    up, it'll pass *more* current, causing it to heat up even more. This can
    lead to failure.

    Also, if you put a bunch of LEDs in parallel, one of them may pass
    slightly more current, and will heat up, possibly leading to the runaway
    scenario given above. Some will be dim. You just don't know. Also,
    passing more current through an LED leads to premature dimming.

    However, they are your LEDs. It may work if the voltage is adjusted just
    right. I'll bet that the LEDs won't be consistently bright, but give it
    a try, and let us know what happens.

    Robert Monsen

    "Your Highness, I have no need of this hypothesis."
    - Pierre Laplace (1749-1827), to Napoleon,
    on why his works on celestial mechanics make no mention of God.
  18. John Fields

    John Fields Guest

    You could, but unless you use a couple of different supplies you could
    run into problems driving the logic with the reduced voltage you'd be
    using to run the LEDs. If you decide to use the Allegro parts, though,
    you'll sidestep the problem since you'll only need one resistor to set
    the current into all 16 LEDs each chip drives.
  19. No. I don't have that kind of personality. I never feel offended by too
    simple explanations. I like such explanations which let me work as
    little as possible to understand something. And if I already understand
    that issue I just jump to the next chapter.

    If you are not a beginner, why do you read an article which starts with
    the line above? And if you do, why complain when you find that it is
    exactly that, an explanation for beginners?
    I have no idea who you are or what education you have. I don't know if
    you are the person who started this thread or somebody else. I reply to
    questions in a newsgroup called sci.electronics.basics, intended for
    beginners and hobbyists, and try to develop ways to explain things for
    people with very little knowledge.

    If you don't like explanations for beginners you can use a newsgroup
    where you are expected to know the basics already, like

    The most common question in sci.electronics.basics is "how do I use
    an LED?" We see it seven times a week. So we try to find out how to reply
    to that question in the most enlightening way possible, to people who
    don't know anything about electronics, or about Google.

    And especially to all the people with little knowledge who try to feed a
    voltage instead of a current to a LED.

    I don't talk to just one person when I write, there are other readers,
    and people who search the usenet archives in the future, and I talk to
    all of them. This is not email or a chatroom, it is usenet and I write
    articles for all the readers, in the present and in the future.

    I assume that other writers in the field of electronics read my
    articles as well as I read their articles, and we learn new teacher
    tricks and explanations from each other all the time. It is like an
    experimental workshop in technical writing, and the person who started a
    thread, usually referred to as "the other person" or the OP, because we
    are too lazy to remember the names of all people who pass by, is maybe
    less important than he thinks.
  20. Chris W

    Chris W Guest

    for this circuit it isn't an issue but I was thinking of future projects.

    Lets say I use a 4 cell NiCd pack. Fully charged the voltage can be as
    high 5.8. By the time it reaches 4.4 under load, it is almost dead.
    From what I was reading about that LED driver chip, it sounds like it
    uses what would be considered a liner regulator. It says that if Vf on
    the LED's is much higher than it is needed the chip will be dissipating
    a lot of power. To avoid wasting battery power heating up that chip, I
    was thinking of having using 2 switching regulators, one set at 4V for
    the white LEDs and one at around 2.5 for the other colors. Also the
    RCM3100 that I am using requires 3.15 to 3.45V. The 6276 chip lists the
    typical 4.5 to 5.5 supply voltage limits, since the battery will very
    quickly drop from 5.8 to less than 5.5 once a load is applied, I guess
    battery voltage will run that chip fine. Unless you took the battery
    off the charger less than an hour before hooking it up to the circuit,
    it will probably be below 5.5v before you put a load on it anyway. I
    guess that means 3 regulators. Maybe I will drive the lower voltage
    LEDs with the same 3.3V I supply to the RCM3100, that will keep it to
    just 2 regulators.

    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day