Author Topic: Switching 7 Segment Display 2.0V with 3.3V Source  (Read 8342 times)

0 Members and 1 Guest are viewing this topic.

Offline ulixTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: de
Switching 7 Segment Display 2.0V with 3.3V Source
« on: April 29, 2016, 07:09:20 pm »
Hi,

I want to multiplex a 4 digit 7 segment display. The display will be created out of the Kingbright ACSA03-41SYKWA-F01 (2V, 10mA).
I have two questions:

-Can I Multiplex every segment as well as every digit?
- The Display will be mounted on a PCB, which is for education. Every Segment will be controlled by a MCU pin.
  The Problem is, how can I limit the current which flows trough the enable Pin for every digit? When there are 2 or 3 Segments turned on, the   enable pin would have a current of 10-80mA flowing trough, which will destroy the mcu.

Would a circut like this help me?
Thank you


 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: gb
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #1 on: April 29, 2016, 07:51:08 pm »
Not entirely sure what your problem is.. but, the standard way of driving seven-segment displays is to have a resistor for each segment LED, and use a transistor (npn fpr common cathode, pnp for common anode) for each digit.  Some designs just use an IO for each common, and rely on the fact for a four digit display, each digit is on 25% duty and just hope the IO doesn't blow.
 

Offline ulixTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: de
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #2 on: April 29, 2016, 07:55:41 pm »
Hi,
my problem is the voltage drop. I can't get 2V vor the display and run the transistor at saturation, with a 3.3V Source!
Yes, I need for my display a pnp transistor....
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: gb
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #3 on: April 29, 2016, 09:54:49 pm »
I'm still unsure why you can't just use something like this:



The resistors will limit the current for each segment.  So for 2.0V forward drop of LED, 3.3-2 = 1.3V across the resistor.  A 100ohm resistor gives 13 mA per segment.
A 10k resistor would work jsut for for driving the transistors, and would mean the IO current for those is I = V/R = 3.3 - 0.6 / 10k = 2.7/10k = 0.27mA.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #4 on: April 29, 2016, 10:16:55 pm »
You want the transistors to be in hard saturation, so you need excess base current.  i.e HFE*Ib>IF_LED  I.d go for a factor of two excess.   You need to push IF_LED fairly close to its abs. max. limit to get adequate brightness as the duty cycle will only be 25%.   Its likely that you will need lower base resistors than 10K.   

When calculting the series resistors in each segment line, you need to allow for the transistor Vce_sat and the I/O pin's saturation voltage at the desired current.   If the I/O pind aren't rated to drive >20mA with less than 1V drop, you'll need a NPN common emitter transistor as a buffer for each segment line.   

N.B. the series resistors for the segments are highly dependent on the supply voltage.  Making it operate at both 3.3V and 5V would be a lot more complex.
 

Offline mmagin

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #5 on: April 29, 2016, 10:22:47 pm »
I think the darlingtons in a ULN2803 would be pretty good for this.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19520
  • Country: gb
  • 0999
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #6 on: April 29, 2016, 10:23:44 pm »
Hi,
my problem is the voltage drop. I can't get 2V vor the display and run the transistor at saturation, with a 3.3V Source!
Yes, I need for my display a pnp transistor....
You've got it configured as an emitter follower which will work, as long as the base-emitter voltage drop is taken count of when calculating resistor values.

The LED current in the attached schematic will be about 20mA.
 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2185
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #7 on: April 30, 2016, 12:25:11 am »
Generally the idea of multiplexing is to lower the pins required and/or simplify the circuit.

You are somewhat locked into multiplexing a digit at a time because the part you mention is a common anode.  4 digits are very easy to multiplex.

The short of this is that when that anode is switched/connected to VCC, you can then switch any of that digit's segments to ground through a resistor to light them.  You want the resistor on the segment side because a single resistor on the anode side would make one segment bright, two segments less bright, three segments even less bright, etc.

Typically you can switch the cathode side through the MCU directly - 10mA is workable for most port pins.  You are right that multiplying that by 8 would be too much.  That is when you'll need in your case a "high side driver" to switch the anode of each digit on and off.  That could be as simple as a logic level FET or a PNP transistor with a base drive resistor.

You may find that the LED's are bright enough even at a low enough current to drive the anode pin directly from the mcu.  Some AVR"s can drive 40mA, so say 35mA / 8 = 4.375mA per segment.  Multiplexing will dim that because you are only running each digit 25% of the time though, but depending on the display it might be workable.

If it is for education you are going to want to make sure that even if it stops multiplexing, that the current maximum of each digit is not surpassed.

The general idea of multiplexing is going to be an ISR based on a timer in the mcu that does this:

take anodes of all digits LOW (with a high side driver/PNP this might be take the mcu pins for the 4 anodes HIGH).
digit++
if digit=4 then digit=0
set pins for the values to be lit for the current digit
take anode of the current digit HIGH

Good luck!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #8 on: April 30, 2016, 12:55:28 am »
Here's the more complex segment driver for applications where the supply voltage may vary.  It drives the LED with an approximately constant current set by the emitter resistor.  It also loads the MCU I/O pin a lot less than direct drive, about 1mA @5V and considerably less at 3.3V.


N.B. it wont work well with displays with a high Vf with a 3.3V supply, there just isn't enough headroom once you've given up approx 1.3V to the constant current circuit.  However with a typical low Vf red display, it will work nicely and will tolerate most forms of student abuse.
« Last Edit: April 30, 2016, 01:00:54 am by Ian.M »
 

Offline ulixTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: de
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #9 on: April 30, 2016, 06:24:32 pm »
Thank you all for the great reply!

I tried it out, it does work but very bad.
What did i do? I multiplexed every segment and every digit. But when there are more digits involved, the intensity goes down. When only one segment is on, the brightness is ok (could be better).
As LED to Ground Resistor I used 22Ohms and no Base Resisitor, this is what brought the best brightness. But it is not good.

What to do now?  :palm:
 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2185
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #10 on: April 30, 2016, 07:05:17 pm »
Thank you all for the great reply!
I tried it out, it does work but very bad.
What did i do? I multiplexed every segment and every digit. But when there are more digits involved, the intensity goes down. When only one segment is on, the brightness is ok (could be better).
As LED to Ground Resistor I used 22Ohms and no Base Resisitor, this is what brought the best brightness. But it is not good.
What to do now?  :palm:

Post your source code and schematic.  You will want a base resistor.  What transistor type and part number are you using?
 

Offline ulixTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: de
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #11 on: April 30, 2016, 07:36:51 pm »
Hi,
I use for this (red leds - Common Anode) a 2n3904.
Every Collector of a single Tranistor is connected with Source (3.3V), Emitter to Anode of the display and the Base to the mcu (msp430).
Every Cathode of the display is connected to the mcu with a series resistor of 22Ohms

The one digit multiplexing looks like this:
Code: [Select]
#include "io430.h"

int main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;
  int i=0;
 
  P1DIR = BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
  P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);
  P1OUT |= (BIT2 + BIT3 + BIT4 + BIT5);
 
  while(1)
  {
  P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);
  P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT &=  ~(BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT |= BIT0;
  for (i=0; i<100; i++);

  P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);
  P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT &=  ~(BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT |= BIT1;
  for (i=0; i<100; i++);
 
  P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);
  P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT &=  ~(BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT |= BIT6;
  for (i=0; i<100; i++);
 
  P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);
  P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT &=  ~(BIT2 + BIT3 + BIT4 + BIT5);
  P1OUT |= BIT7;
  for (i=0; i<100; i++);
 
  }
  return 0;
}

The code for the Segment Multiplexing looks the same, I only switch on one segment and one digit, then the other segment..... next digit...
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #12 on: April 30, 2016, 07:53:32 pm »
Usually there should be 7 or 8 resistors for the segments to the IO pins. So all 7/8 LEDs of one digit can light together.

The common anodes are controlled by PNP transistors of P-channel low level MOSFETs (could be difficult to get). There is no more resistor for the Anodes, just the base resistor for PNPs.

So there is something like a 100 mV loss for the PNPs. For a 10 mA segment current this would mean about 120 Ohms  for the resistors and the IO port ouput resistance. Depending on the µC this means something like 30-100 Ohms for the resistors.

Darlington drivers like ULN2003 are a poor choice at such a low voltage.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #13 on: May 01, 2016, 05:39:17 am »
if brightness is not an issue, no transistor (direct mcu) will do... i use this setup (picture below), visibility is ok. 5V, 1Kohm to each lcd cathode (7 of them). max current source and sink = (5/1K)*7 = 35mA.


Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19520
  • Country: gb
  • 0999
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #14 on: May 01, 2016, 09:32:51 am »
Thank you all for the great reply!
I tried it out, it does work but very bad.
What did i do? I multiplexed every segment and every digit. But when there are more digits involved, the intensity goes down. When only one segment is on, the brightness is ok (could be better).
As LED to Ground Resistor I used 22Ohms and no Base Resisitor, this is what brought the best brightness. But it is not good.
What to do now?  :palm:

Post your source code and schematic.  You will want a base resistor.  What transistor type and part number are you using?
You're right about the need for code and a schematic, in order to help but whether a base resistor is required or not, depends on how the transistor is configured. If it's an emitter follower (see my previous post) then there's no need for a base resistor which would just increase the voltage loss.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #15 on: May 01, 2016, 10:11:21 am »
What are the specs of the port pins of the MCU you are using?  IIRC most MSP430 series chips have fairly wimpy output source/sink current ratings and a fairly low per port or per chip limit that will cause problems direct driving the display if all segments are on.
See: https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/94929
 

Offline ulixTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: de
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #16 on: May 05, 2016, 12:32:48 pm »
Hi,

the circuit would look like this.The PNPs because of the higher Current...
 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2185
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #17 on: May 05, 2016, 01:54:55 pm »
What kind of PNP are you using?  Make sure it is not Darlington.  I haven't had a chance to look at the code you posted.  I often use 1K for the base drive resistor.  Also, to prevent one from bleeding into the next you may have to give the transistor time to turn off before changing the active segments so a little delay might need to be added.
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2254
  • Country: ca
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #18 on: May 05, 2016, 02:30:14 pm »
Hi,
my problem is the voltage drop. I can't get 2V vor the display and run the transistor at saturation, with a 3.3V Source!
Yes, I need for my display a pnp transistor....
2 V is the forward voltage drop across the LEDs in the display. You don't need to supply 2 V, but you use this voltage to determine an appropriate current limiting resistor.  R = (3.3 V - 2 V) / IF, where IF is the desired forward current, probably 5 mA or so (the 10 mA spec for the display is the maximum). Then, R = 270 ohm would be a good choice. Once it works, you can determine if you want it a little more or less bright and adjust accordingly.
 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2185
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #19 on: May 05, 2016, 02:49:58 pm »
I'll add that you also have to take into account what the duty cycle is.  If you like how a segment looks at 1mA at 100% duty cycle, you may have to up it to 3mA at 25% duty cycle.
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: gb
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #20 on: May 05, 2016, 03:47:21 pm »
I'm so confused why there is so many posts about this.  The OP must have different requirements or just not understanding what people are saying.

From what I gather in the posts from the OP, his seven-segment displays LED's have a forward voltage of 2V.  He has a power supply of 3.3V.  Almost every seven segment display circuit on the web uses a resistor per segment, and a transistor driver for the common anodes/cathodes.  The latest schematic he posted is just fine. And yes, one has to take into account the fact that each display is only 'on' for a a fraction of the total dispaly refresh time, usually (but not always) 1/no. of displays.  In his case, for 4 digits, a 25% duty cycle.  This means it will appear about half as bright (non-linearity of the human eye).  Therefore, the resistors should be chosen to provide maximum current to the LED segments when on, in order to get the highest brightness whilst not going over the limit.

An equation I've posted to this guy twice now..

R = (Vsupply - Vf)/LED current.   Where Vf is the forward voltage of the LED (2.0V apparently).  Vsupply is his 3.3V, and LED current, often given at 20mA for continuous.
R = 3.3 - 2 / 0.02. = 1.2/0.02 = 60ohm.  Nearest = 68 ohm.  I would just go for 100 ohm unless the display is in full sunlight, but then there's no hope of reading it without expensive polarising filters.
 

Offline ulixTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: de
Re: Switching 7 Segment Display 2.0V with 3.3V Source
« Reply #21 on: May 05, 2016, 06:03:01 pm »
Hi,

thanks again for all your replys! The problem isn't that I don't understand the basic concept, I did, but talked to one professor of ours and he said it won't work! I was really really unsure! :palm:
This is why I asked if every segment and every digit could be multiplexed, not only each digit. => I will multiplex only every digit! (See before)

Sorry, I missed to add the name of the Transistor, will use a PNP 2N3906.

Thanks a lot,  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf