Do I really need a current limiting resistor for charlieplexing?

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Nov 21, 2012.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    I am looking at charlieplexing a bunch of 7 segment displays.

    The outputs of my pic can source 25ma.
    My supply voltage will be 3V.
    The forward current of each led segment is 20ma with a forward voltage of 2.2V.

    If I did my calculations correctly, my current limiting resistor is 10Ω. Is that enough to worry about adding the current limiting resistors? Would the fact I am charlieplexing help with current limits?


    If I have to add the resistors, can I get away with just adding one to each cathode?
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Absolutely fine, you won't actually reach 25mA anyway.
    This is from the 16F628 datasheet but I don't imagine it will be much different for other PICs
    [​IMG]
     
  3. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Thanks. I need to learn to read these datasheets in much finer detail Thanks for the tip.

    But the datasheet I have for my pic does not have those tables. Looks like it is a prelim datasheet. I should go to microchip and see if there are updates.
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Are you using the current limiting resistor, the current limiting resistor, or the current limiting resistor?

    No accurate answer is possible without a schematic.
     
  5. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    It's very rare for 7 seg displays to have 2 wires for every LED segment, they are always matrixed using one common wire plus one wire for each segment.

    If they are normal 7-seg displays then they are multiplexed (not charlieplexed), so can you please clarify which you mean? :)

    If they are typical multiplexed displays they generally need a resistor per segment pin (7 resistors) then the displays are driven one digit at a time. Again we need to know more, like your schematic (as ErnieM said) or at least a better description.
     
  6. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
  7. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    One thing to beware of is that each LED segment only gets the opportunity to be on 1/8 of the time. That means that its brightness may be rather poor. You also have to think about how much current each pin of the PIC can supply and how many segments it has to drive, and how much current the chip is supplying altogether; there is a spec for current per pin, but there's a limit on the total, also. This might work better if you use external drivers.
     
  8. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Yeah I know about the brightness problem John. And current limiting was the purpose of this whole thread.
     
  9. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Don't bother about resistors when you drive a 7seg using 16F at 3V.

    I built a circuit with 2x 4-digit 7segs (hardwired internally for regular phase multiplex). The segments are connected directly to a PORT (16f884). And the two displays are connected in parallel.

    The 8 cathode rails are connected to another port.

    It works fine with only a very little brightness variation. Both 3V and 5V were tested over quite a long while. There are no resistors used at all.

    Recently I actually made a matrix using 5x 10 LED bargraphs. Two shifting registers + 5x MOSFETs are used. During the debugging phase, there was erroneous output, so all the MOSFETs were turned ON + All the LEDs.

    The 74HC595 chips turned VERY hot and I mean VERY hot. Too hot to touch! But they survived. So as long as your PIC remains relatively cool, you do not need to worry about current limiting. Upto 40C are normal. Think of hard drives, how hot they become during normal operation. However, they never turn so hot that you could not hold them into your hand.

    This is a good rule of thumb. As long as it is fine to touch it or hold it in your hand, the temperature development is OK.

    Small SMD parts also are more prone to blow, means a small hole will burst open. This is because they have MUCH less mass, so even a short overloading will cause a very fast temp. rise. Larger SMD chips or DIL (PDIP) chips don't heat up so fast. I made this experience when I used very tiny SMD diodes. It worked fine for about 20 minutes but then suddenly the diode bursted non-recoverable.
     
  10. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Just wanted to point out that many manufacturers have two digit and four digit 7-segment displays in two different pin configurations. One configuration is the "multiplexed" type of matrix that I believe you're referring to with the A-F and DP segments from each digit all tied together and brought out to a single set of eight pins along with one pin for the common anodes or common cathodes on each digit. The other configuration brings out the eight segment lines for each digit onto separate pins. Only the latter type of two digit or four digit display module could be used in a Charlieplexed 7-segment matrix. For example, here's how I wired up the Fairchild MSD4410C 2-digit displays on my little single chip Charlie Clock project many years ago;

    [​IMG]
     
    Last edited: Nov 24, 2012
  11. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    That is a Charlieplexed display.

    I'd like to mention that if you change the wiring scheme slightly, as shown in my six digit example above, to use what I call the "float pin" wiring scheme, the display is much easier to drive in software. Basically, since you share the same I/O pins for both columns and rows in a Charlieplexed matrix, you can't connect an LED at the points in the matrix where the column and row would be the same I/O pin. Instead, you connect the LED at that position in the matrix to the column pin and the "float" row pin. As it turns out, it's relatively easy to determine when you need to turn on the "float" pin in the driver using simple logic, and, the driver uses only a couple more instructions compared to a traditional multiplexed display driver. If you're interested, here's an example interrupt driver excerpt (in BoostC) for the six digit Charlieplexed display shown in the previous post;

    Code ( (Unknown Language)):
    1. char disp[] = { 0,1,2,3,4,5 };  // display data, 0..9
    2.  
    3. #define r08 const rom unsigned char
    4.  
    5. r08 segdata[] = { 0b00111111,   // "0"   -|-|F|E|D|C|B|A
    6.                   0b00000110,   // "1"   -|-|-|-|-|C|B|-
    7.                   0b01011011,   // "2"   -|G|-|E|D|-|B|A
    8.                   0b01001111,   // "3"   -|G|-|-|D|C|B|A
    9.                   0b01100110,   // "4"   -|G|F|-|-|C|B|-
    10.                   0b01101101,   // "5"   -|G|F|-|D|C|-|A
    11.                   0b01111101,   // "6"   -|G|F|E|D|C|-|A
    12.                   0b00000111,   // "7"   -|-|-|-|-|C|B|A
    13.                   0b01111111,   // "8"   -|G|F|E|D|C|B|A
    14.                   0b01101111 }; // "9"   -|G|F|-|D|C|B|A
    15.  
    Code ( (Unknown Language)):
    1. void interrupt()                // 1-mS TMR2 interrupts
    2. { static char colsel = 1;       // column select bit mask
    3.   static char column = 0;       // column number, 0..5
    4.   unsigned char data;           //
    5.   pir1.TMR2IF = 0;              // clear timer 2 interrupt flag
    6.  /*                                                                 *
    7.   *  refresh the CA display (~166 Hz refresh rate)                  *
    8.   *                                                                 */
    9.   data = segdata[disp[column]]; // new digit segment data
    10.   trisb = 0xFF;                 // blank the display
    11.   portb = colsel;               // select new column (digit)
    12.   if(data & colsel)             // if LED row = column
    13.     data.7 = 1;                 // set the 'float' pin (RB7)
    14.   data |= colsel;               // pick up column select bit
    15.   trisb = ~data;                // display new column (digit)
    16.   if(colsel.5)                  // if last column (RB5)
    17.   { column = 0;                 // reset column number
    18.     colsel = 1;                 // reset column select bit (RB0)
    19.   }
    20.   else                          // else
    21.   { column++;                   // increment column number
    22.     colsel <<= 1;               // shift column select bit
    23.   }
    24. }
    I hope you find the example interesting.

    Have fun.

    Happy Holidays and cheerful regards, Mike
     
    Last edited: Nov 26, 2012
  12. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Thanks!

    Isn't that pretty much what I have here?

    [​IMG]

    One difference I see is I should start my "cathode" pin from C0, it might make addressing each display a little more straight forward.

    Why are you using transistors on the cathodes? Is it so the mcu pin does not need to sink the current of the display?
     
    • Seg7.PNG
      Seg7.PNG
      File size:
      34.5 KB
      Views:
      124
  13. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    It's similar in that they're both Charlieplexed matrices but the wiring and segment mapping are not the same. Your (and Jose's) wiring scheme requires different segment mapping for each individual digit whereas the "float pin" or "floating row" scheme uses the same segment mapping for each digit, which makes the display with the "floating row" wiring scheme much easier to drive.

    That doesn't matter much with either wiring scheme.

    Those transistors are on the common anodes, and, yes, they provide much more current than you could get directly from an I/O pin, which allows for a brighter display with more even brightness on all the lighted segments.
     
  14. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988


    Sorry for being so dense. Which row is "floating". I am seeing each segment in your example connected to a different pin.


    For example Segment A.

    Col 0 connected to RB7
    Col1-Col5 connected to RB0

    that is a difference in mapping to me. What is not passing through my thick skull here?



    There goes my dyslexia again. (cathode / anode anode cathode :)
     
  15. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Thanks Spinnaker, my mistake. :) That is "Charlieplexing" true enough in that it bidirectional current control from 2 PIC pins with other pins left high impedance.

    It's a complex system to drive and you don't gain that much compared to multiplexing. Also it means you can't use a multidigit 7-seg display (like most common types) because all their segment pins are connected in parallel (always segA to segA etc). That means you are forced to use single digit displays and lots of fiddly specialised wiring.

    I think you are much better off to use normal multiplexing even though it costs d-1 more pins (so costs 3 more PIC pins for a 4 digit display).

    If you are mainly concerned with saving parts you can still do multiplexing with no parts other than the PIC and display, here is one I did earlier and the text covers some of the issues with the PIC pin peak and average currents;

    [​IMG]
    http://www.romanblack.com/led_none.htm
     
  16. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    RB0 is column 0 and segment A, RB1 is column 1 and segment B, RB2 is column 2 and segment C, RB3 is column 3 and segment D, RB4 is column 4 and segment E, RB5 is column 5 and segment F, RB6 is column 6 and segment G, and RB7 is the float pin.

    RB0 cannot drive column 0 and segment A at the same time so segment A on column 0 is connected to the "float" pin. RB1 cannot drive column 1 and segment B at the same time so segment B on column 1 is connected to the "float" pin, and so on...

    Well, as someone mentioned, Charlieplexing may seem like a "complex system" but perhaps it may seem less complex after some study and experimentation. Anyway, the Charlieplexed wiring scheme you've chosen requires the software driver to shift or map segment bits into different bit positions on the port for each digit. The "float pin" scheme on the other hand only requires the software driver to turn on the "float" pin when a lighted segment row equals column. The difference in driver complexity may not be apparent until you study the drivers for both wiring schemes.

    I can think of a number of situations where the advantage of using a Charlieplexed display over a multiplexed display, in order to reduce the number of I/O pins required for a particular design, may outweigh the disadvantage of the funky Charlieplexed display wiring. Please note that, contrary to the suggestion that you can only use single digit displays in a Charlieplexed matrix, several manufacturers produce dual digit and quad digit displays with non-multiplexed pinouts which can be used quite effectively in a Charlieplexed matrix. Also, instead of telling you you're better off using one multiplexing method over another, I'd like to suggest it's more important to learn how to exploit the advantages of one method or the other and to know when to use either method to your advantage and to meet your project design goals.

    Have fun and good luck with your project...
     
    Last edited: Nov 25, 2012
  17. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    I am already at my max for pins. I did consider using shift registers to drive the segments to which I have had success before.

    But I wanted to keep the footprint low and since I am limited on pins, multiplexing was pretty much the only way to go.

    But I think your right, I need to get my hands on it. I think I will whip up a test board with just the display.
     
  18. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Is this schematic right? In Col 1, you have both segments A and G wired to RB6.
     
  19. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    That's definitely a mistake. I'll go back and post a corrected drawing. Thanks for pointing out the error...

    [​IMG]
     
  20. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Which PIC are you using? Are you just doing a four digit display? And, are you going to skip the column driver transistors?
     
    Last edited: Nov 24, 2012
Loading...