Choices in power supplies

Go To Last Post
55 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All -

My daughter asked if I could build her a small timer - very simple. Just three 7-segment LED displays and a button - push the button and it wakes up and counts down, then sounds a beeper, and turns itself off.

Simple. Sure, no problem, take no time at all. I'll use a 2313 since I have a pile of them.

Of all things to be a little stuck on, I'm trying to decide how to power the damn thing. It will run off batteries, so I want it to last as long as possible. The LED displays do suck juice when they're on, but they won't be on for more than a couple of minutes when in use, then it shuts itself down. I'll use an NPN in the VCC line - the button will short that to turn the 2313 on, and the first thing that will do is shove VCC to the base to keep it on. To turn off, set it LO, and let a pull-down keep it LO.

As I see it, powering a small battery device devolves down to these initial choices ...

1) Use a 1/2AA 6V battery and run directly off that. Simple, no regulator, fewer parts. Small battery though, don't know how long it would last. And they're expensive.

2) 9V battery. Now need to regulate down to 5V. Could use a simple cheap 7805-type, but that wastes a lot of power. Could use a small switching regulator, like a MAX727 (got a bunch of those too :) More efficient (how much more ?) but needs some more parts.

3) One (or two) 1.5V AA battery with a boost regulator.

What do you think ?

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You seem to have left out the possibility of running it at 3.3V
I don't know if it will run at 3V. I think so. As your LEDs will probably need about 1.8V all the rest will be dissipated in the current limit resistors. So low voltage should be more effective.

As for the supply. of course switching regulator has better efficiency. So up or down it will probably be better than linear.
You don't have to put the AVR to sleep or idle. You can also use a small FET to have the AVR switch itself off after the counter is done.

you can then use the on switch the bridge this FET.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I recently designed a similar project though it isn't a timer.

I don't switch power at all on the AVR. It's "up" all the time though I do use the sleep modes to cut power consumption when not running to negligible amounts.

Sleep modes on the AVRs pull so little current you are approaching shelf life of batteries. You can have yours wake up on interrupt from the pushbutton signal if you wanted to do that. Or even add a plain old switch.

Mine runs off of two AA batteries using a switching regulator to boost to 3.3 volts. The AAs have much more total power in them than a 9 volt battery and are cheaper. Duracell has some really nice voltage/time/power curves that can make battery choice a lot easier. At their website in their technical section.

In my circuit, I light up LEDs too which are the major power consumuer by far. To maximize battery life I fade the LEDs in and out using PWM - that way they spend most of their time off even though there is a more or less continuous display. It's also a pleasing effect to have the digits fade in and and out. The digit update is independent of the fade-in/fade-out routine so that the digits can increment/decrement at any time and not just on whole fade cycles.

It works quite well and under nearly continuous use I get about a month of battery life. On the other hand, I have some other stuff in the circuit which also must always be on that limits the maximum battery lifetime to two months even if no digits are ever displayed.

The only down side is the cost of the switching regulator I chose because I wanted maximum efficiency. But a switcher is generally around 90% or better efficient. A linear regulator on a 9 volt battery is burning about 50 percent of the power through it as heat. The actual value is the voltage drop across the regulator times the current.

But at any rate, I think you want to regulate somehow. The change in battery voltage over battery life will be a significant percentage of the nominal battery voltage. This will give you a corresponding variation in LED brightness. If that is acceptable (a visual indication of when to change the batteries) that's a feature. But without regulation you could monitor battery voltage and modify PWM on the LEDs to achieve a more constant brightness.

It's amazing how complicated the details of such a simple project can get - if you need all the advantages.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
9V battery. Now need to regulate down to 5V. Could use a simple cheap 7805-type, but that wastes a lot of power.

You can use a low power linear regulator, like the LP2950. Have a quiescent current of 75[uA], and are low dropout.

Regards,
Alejandro.
http://www.ocam.cl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
You can use a low power linear regulator, like the LP2950. Have a quiescent current of 75[uA], and are low dropout.

Although it's not wasting as much, you would still be wasting a lot. In this case as well I don't think the low dropout is important, you only care about that if you needed to run it at just over the output voltage.

In Dean's case it's looking to be either 9V or 3V - so using the 9V way you are still droping approximately 4V across the regulator, which would work out to almost 50% of the power as mentinoed...

At any rate - could you use 3/4 AAA batteries to get you to 4.5V/6V? You might not need a regulator at all then.

Regards,

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
At any rate - could you use 3/4 AAA batteries to get you to 4.5V/6V? You might not need a regulator at all then.

The best way will ultimately be decided by the OP, but as Knoppy pointed out - running the system at a higher voltage wastes more power in the LED current limiting resistors - not unlike using a linear regulator to drop the Vcc from 9 volts. But at 6 volts, need to be mindful of absolute maximum ratings.

But in this application that might be moe appropriate since it sounds to be a one-off design and switching regulators really need a proper board layout instead of p-2-p wiring.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

c_oflynn wrote:
Quote:
You can use a low power linear regulator, like the LP2950. Have a quiescent current of 75[uA], and are low dropout.

Although it's not wasting as much, you would still be wasting a lot.

There are linear regulator with lower quiescent current, and depending on
the particular working cycle (how much time the LEDs are on), this current may be neglectible.

Quote:
In this case as well I don't think the low dropout is important, you only care about that if you needed to run it at just over the output voltage.

The first alternative the OP mention is to use a 1/2AA 6V battery. In this case the low dropout is important.

Quote:

At any rate - could you use 3/4 AAA batteries to get you to 4.5V/6V? You might not need a regulator at all then.

I mentioned the low power linear regulator because I think is an alternative worth considering. In this particular case I agree with you that running the circuit directly from the batteries is the best aproach.

Regards,
Alejandro.
http://www.ocam.cl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the opinions and help guys. I hadn't realized that a AA help more power than a 9V - why is that ? How about AAA ?

refields : Good top about fading the LEDs. There's plenty of space, so I'll do that. Every little bit helps.

I have a ton of 2313-10 here. I just testing one in the stk500, and was able to run it all the way down to 2.6V using the stk500 osc at 3.69MHz, so it looks like it will run nicely using two AA or AAA batteries. As has been mentioned, using three at 4.5V would just waste power in the dropping resistors for the LEDs.

Hrm, dropping the speed will drop power consumption as well. Then again, the bulk will be in the LEDs, not the 2313 itself ...

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One way of reducing the power dissapation in the LED dropping resistors is to get rid of them all together. You could use PWM of the AVR through a FET to control the voltage level and brightness and filter it using a small inductor. As the leds are constant current you wouldn't need to monitor the voltage in a closed loop. Just adjust the PWM as to how many segments are lit.

Another option would be to use a switching regulator such as the LTC3455 which is one that I'm am about to have a play with. It has dual switching regulators for CPU's with seperate IO and Core voltages, but there is no reason why you couldn't have one running at 3.3v for the AVR and the other at a suitable voltage for the LEDs to be drivien directly without limiting resistors.

It also has the ability to recharge the Li-Ion battery from either a wall wart or USB connection (or both at the same time)

Tim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dean, go to http://www.duracell.com/oem/prim... and get the Duracell app notes. First thing you should note is that you get less than half of the energy out of a cell before it drops below 1.3 volts (I chose that because your uC works down to 2.6). So if you go with two cells you'll need to boost it. Three cells seem to be ideal, starting at 4.5 volts and end of life at 2.4. AA's have 2.85 AH; AAA have 1.15 AH; and 9V 0.58 AH.

[edit] Maybe leaving half the energy behind isn't a bad thing. They'll still last 'forever' :D

Using power-down mode instead of switching the DC seems most practical. 2 uA standby current won't even be noticed by AA's or AAA's. Even idle mode shouldn't eat batteries that fast if you use a slow crystal. (The data sheet curves are at 4 MHz.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I can fit two AA or three AAA in my little project case. Right now, I'm thinking that two AA at 5.7AH and 3V with a boost regulator to take it up to 3.3V would be the way to go.

It's the highest AH method, so the most "power" available for the duration. Using a boost regulator will allow the setup to work at 3.3V even as the cells drop in voltage below what the 2313 would normally be able to work at.

Except of course I don't *have* any boost regulators here, so that means a Mouser/DigiKey order dang it. Never done a boost regulator before - anyone recommend a good simple small one ? I'm going to go poke around on the Linear and Analog sites now, see what's what.

Otherwise just go with the two AA directly and be done with it.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

w0067814 wrote:
One way of reducing the power dissapation in the LED dropping resistors is to get rid of them all together. You could use PWM of the AVR through a FET to control the voltage level and brightness and filter it using a small inductor. As the leds are constant current you wouldn't need to monitor the voltage in a closed loop. Just adjust the PWM as to how many segments are lit.

Dropping the resistors is probably not such a good idea since the microcontroller could freeze with an LED on and fry the poor thing. Use at least the smallest resistor that will cause a current less than the maximum allowable for you LED.

PWM is a great idea though, you can get the same apparent brightness by pulsing an LED with a short high current as you get by running it full tilt all the time. The brain integrates the flash into a steady light. Isn't the brain great?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may be overlooking using a single 3.6volt lithium primary cell for power. A AA size lithium cell holds over 2000mah of current at 3.6 volt and has a virtually indefinite shelf life. Considering the purpose of this timer it'd spend most of it's time off anyways, so doing what others have suggested and using transistors to switch the power on and off without any standby power and using PWM to dim the LED's to the point where they're still visible but consuming little power (I've found most LED's to be perfectly viewable down to just a couple of mah's of power draw, less than the AVR itself) If you made the circuit and program well the timer would probably outlast it's usefullness on a single cell.

-Curiosity may have killed the cat
-But that's why they have nine lives

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm interesting. Using an inductor with the LEDs gives you sort of a switching power supply per LED. I never thought of that. But indeed it's kind of risky for when the AVR hangs up for some reason.
On the other hand you can maybe just reset the AVR from the voltage drop that will give

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Knoppy : Looks like your post got chopped ...

Sceadwian : Hah - hadn't thought about those 3.6V lithium batteries. That's the way to go.

These 7-segment displays have a 1.8V drop across the LEDs, so to keep the maximum current below say 20mA, I'll use 100ohm resistors. It will burn up a bit of current, but will keep the displays safe from an AVR lockup.

I'll still do the PWM though, since I know I don't need a full 20mA on those LEDs. Port B will be the segment drains (common anode displays). Set up timer0 to trigger as fast as possible, with a static unsigned char variable for the pwm count. #define LEVEL to be the desired brightness.

static unsigned char pwm;

pwm++;
if (pwm == 0) portb = current_segs;
if (pwm == LEVEL) portb = 0xff;

LEDs will be on for 0 -> LEVEL and off from LEVEL-> 255;

LEVEL will be determined experimentally :) That ISR will also be responsible for cycling the digit select transistors on the anodes, and updating the time in seconds.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a lot of worry about what would happen if the AVR locked up. Is this really a problem? I thought the watch dog timer solves this problem? Are there cases where the AVR could crash and the watch dog not reset the device and hence remove the power from the LEDs?

Don't forget that the Li-Ion when fully charged is somewhere in the region of 4.2 volts, and they're not as easly to charge as normal NiCads as they require specialist chargers.

Tim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't mean Lipoly cells. I ment Lithium cells, as a primary. They're commonly refered to as camera batteries. Though they do make Lithium cells that provide standard 1.5 volts per cell voltage a 'natural' lithium cell is about 3.6 volts per cell or thereabouts, more than enough to get any AVR oscilating from any clock source. They have an inactive shelf life of at least 10 years. The chemistry is just more stable, and for a primary cell it's actually capable of sourcing more current over a longer period of time for the same cell size as an alkaline primary, which makes it usefull for motorized cameras or 'high' current draw devices like digital cameras that are drawing around 300ma's for extended periods of time. In this case though the shelf life and high voltage is more usefull. One cell will work where you'd need two alkaline cells to do the same work. And you can get Lithium primary cells in sizes from AA down to coincell.

-Curiosity may have killed the cat
-But that's why they have nine lives

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This may not be in the spirit of creating things from scratch, but have you considered just buying an AVR Butterfly board? It has an LCD display built in, runs on 3.3 Li battery, timers, temperature, and voltage detection built in for $19. :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, got things working here. Nice and simple, but with a bizarre twist. I have a 2313 on the stk500 driving the 3 displays on a breadboard. All three are wired in parallel, each with a 2n3904 feeding the common-anode. There is a 330ohm resistor from PortD.x to each base of the anode NPN. PortB:0-6 controls the segments.

It's using the 3.69MHz osc from the stk500. Here's the timer0 code - very basic.

#define MINUTES    0b00010000
#define TENS_SEC   0b00100000
#define ONE_SEC    0b01000000
#define CLEAR      0b10001111
#define MAX_PWM    40

unsigned char	which_digit = 0; // index to which digit is being displayed
unsigned char	disp[3] = {0, 0, 0}; // actual time - min, 10sec, sec

// Weird. First char is dimmest, then middle, then last.  
// Need individual pwm values for each char.  Bigger = brighter
unsigned char	pwm_digit[3] = {29, 20, 13};

unsigned char	digit_mask[3] = {MINUTES, TENS_SEC, ONE_SEC};

interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
static unsigned char pwm_val = 0;

  pwm_val++;
  if (pwm_val == pwm_digit[which_digit]) {
    PORTD &= CLEAR;  // turn off displayed digit
  }
    
  if (pwm_val == MAX_PWM) {  // has it been on long enough ?
    if (++which_digit == 3) which_digit = 0;
    PORTD &= CLEAR;                    // turn off display
    PORTB = digits[disp[which_digit]]; // set up new digit
    PORTD |= digit_mask[which_digit];  // turn on the right one
    pwm_val = 0;                       // reset for pwm time
  }
}

The PWM is very simple. Initially a digit is on. Each timer0 overflow pwm_val is incremented. When it hits a given value, turn the digit off. When it hits the next value, switch to the next digit, and start over.

The bizarre bit is that each digit is of different brightness. First is dimmest, then number 2, and last one is brightest. I had to implement individual pwm values for each digit to even out the apparent brightness, as you can see from the code above.

It's something in the logic. I've swapped displays, 2n3904s, digit order. It's always 1st=dimmest ... I even changes the scanning order, decrementing which_digit each pass. No change.

Weird.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First thing I notice is that you're driving seven (eight?) segments at 20 mA from a 2N3904. Beware that although this transistor is rated at 200 mA, it's beta is basically useless past 100 mA.

For one-off, try paralleling two 2N3904's or slightly reducing the LED current.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Weirdness abounds. I had some J175/J176 p-ch fets lying around. They work very nicely, delivering more current to the LEDs, so I can reduce the PWM ratio for the same brightness.

But the digits ghost. The code clears the portD anode controls first, turning off all the digits, then sets portB to the new digit segments, then turns on the next digit anode via portD.

With the 2n3904s in place, works fine. With the jfets in place, it's as if the off digits aren't completely turning off. Hrm, doing a totem-pole npn/pnp gate driver would be getting a bit much I think ...

Still no idea about why the are different brightness though. Weird. Story of my life.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First, as I look at the J175 data sheet, it's not completely turned off with zero gate voltage. Timing isn't the problem.

You don't need more drive to the 2N3904, you need more transistor. You can put two in parallel and it will work a lot better than one. This isn't something I'd do in a production design, but one-off it's no big deal. Seperate base resistors are probably needed to promote current sharing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you must use an NPN, you might try the 2n2222 which I believe is better
than the 3904 for this application. I use the PNP 2n2907 to drive the common
anodes of my 7 seg led displays at 50ma per segment in an outdoor system.
At 400ma the 2n2907 is quite happy. I use a base drive of about 10ma with
a 50% duty cycle. Using the emitter follower configuration with a NPN reduces
your available led drive voltage and the transistor's power dissipation is increased
because it is never fully saturated.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mike : Yeah, I dig up a datasheet and started reading. These are the only small p-ch fets I have - all the others are n-ch. ah well.

I have it running now on breadboard with no resistors at all :) The displays and 2n3904s are pulling from 30-55mA depending on how many segments are lit.

Say the segments are receiving 30mA total. With a highly efficient transistor, 29mA comes from the C-E connection, while 1mA comes from the B-E connection, sourced via the 2313 port. Is that better than having 15mA from the C-E and 15mA from the B-E sourced via the 2313 port ?

Does it really matter how effecient the beta of the 2n3904s is ? All the current being supplied is going to light the segments, so whether it flows from C-E or from B-E, it all winds up going through the segments. And it all sources from the 3.6V lithium battery.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It all sources through either the B-e or C-E, but the 2313 is only gonna give you 20 mA and the C-E junction maybe 100 mA if you're lucky. And the voltage drop will be highly dependent on the current, since it's emitter follower.

Do you have any PNP transistors?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hah, I do. Found a bag of 2n3906. I *knew* I had them around somewhere. Let's see how they do ...

Hrm, I also have some MMBTA92 high-voltage pnps as well ...

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go with the 2N3906; it's good to almost 100 mA. The MMBTA92 is probably useless above about 50 mA.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, working nicely now. Using 1k base resistors, so the base current is only about 0.8mA measured. Averaged obviously at meter. Total display usage is about 33mA average - it fluctuates up and down a little, but no more than a few mA. So, total usage will be around 33mA plus whatever the 2313 chews on.

Still have that weird brightness inequality, so still need the individual pwm values. Ah well.

Speaking of PWM, I wasn't sure what the best values to use are, so I sort of guessed. It runs at 4MHz, and timer0 is set with no prescaler, so the pwm_val variable used to determine on/off for a digit is clocked at some 15kHz.

I arbitrarily picked 40 (MAX_PWM) as the pwm period. On time is 20/15/12 counts for each digit, then off for the balance up to 40. Then it switches to the next digit. Using those counts, the displays appear to the naked eye to be pretty much equal brightness.

So digit 1 is running at 50%, digit 2 at 37% and digit 3 at 30%.

I suppose that rather than wait out the balance of the pwm period, I could switch immediately to the next digit. The PWM period then becomes the total of all the pwm counts. That would mean that with the current count values, the pwm percentages would be

digit 1 = 20/47 = 42% change count to 23 to get 50%
digit 2 = 15/47 = 32% change count to 17 to get 37%
digit 3 = 12/47 = 25% change count to 14 to get 30%

I don't know what the "better" method is. Does it make a difference ?

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure about how your schematic is, but, if you use the same PWM output to drive several digits, each digit will need a different PWM cycle, because each digit will have a different number of segments lit, leading to different current consumption. More segments => each segment will have less current during the same period of time. Can't it be the cause for the different brightness issue?

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's the resistance in series with each segment? If the total common-anode current is more than about 100 mA then the 2N3906 might not be saturated with all segments on.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are no resistors for each segment - I'm using Tim's suggestion of just using pwm to control the average current through the displays. Right now using a 3.6V supply the meter shows about 0.75mA of current through each 2n3906 base, being fed from portD on the 2313.

The pwm counter is running at 15.6kHz - digit 1 is using 50% duty cycle, so it's on for 1.28ms and off for 1.28ms. Or thereabouts. I get this from the fact that the pwm period is 40 ticks of the timer0 overflow, which is happening at 15625Hz (4MHz / 256). That gives a period of 2.56ms.

The breadboard has the three displays, 2n3906 switches and base resistors (1k). Putting the meter in series with the power going to that shows about 33mA total to drive the displays. Obviously this is averaged by the meter - the instantaneous current is all over the place depending on the number of segments lit.

Schematic is dead simple. PortB goes directly to the ganged cathodes of the displays. PortD 4,5,6 go to 1k resistors, which then go to the base of each of the 2n3906 pnp transistors. Emitters to 3.6V, collectors to the anode of each display.

There is a minimal, but detectable, variation in brightness in a digit depending on the number of segments lit. That's to be expected - there's a set average current available to be split among the segments. But there's an overall difference between the digits that I can't explain.

It's not dependant on the individual display, transistor or base resistor. I've swapped them all around, and used other ones. It doesn't depend on the digit scanning order either - I tried scanning 0-1-2 as well as 2-1-0. Nor port dependant - I changed which port drives which display anode transistor.

Each segment of the displays is ganged with the same segment of the other displays. The portB connections are made to display 0, then jumpers connect to display 1 and then to display 2. For a moment I thought resistance in that chain was it ! Except that it's backwards. Display 0 is the dimmest one, display 2 the brightest.

Jeez, for such a simple bloody quick-n-dirty project, this has generated a ton of head-scratching and discussion :)

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what are you prototyping on? Perhaps you have a resistive problem on your proto-board.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nuno wrote:
I'm not sure about how your schematic is, but, if you use the same PWM output to drive several digits, each digit will need a different PWM cycle, because each digit will have a different number of segments lit, leading to different current consumption. More segments => each segment will have less current during the same period of time. Can't it be the cause for the different brightness issue?

I think that should only be the case if the anode transistors are running in the linear region or near it. The anode transistors should be driven hard so that they have minimum voltage drop and so that the LEDs can have all the current they want.

This is an interesting case though. I think we need a schematic to have the clearest picture of what's up.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With no cathode resistance, the LEDs want a lot of current. The base drive of 3 mA should be good enough to get peak currents of 100 mA or so. But since the LED current is unregulated (except for the beta limit of the anode driver) there'll always be variation in brightness.

That's why PWM is not a substitute for cathode resistors. By running unregulated current through the LEDs, they're wasting current (they don't get any brighter once their max is reached).

Is this schematic correct?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The LED brightness is almost directly proportional to their forward current for about the whole useful current rage.
Power dissipated by the LED however, is the product of current and voltage. This means that efficiency gets lower when the current gets higher. So it's not very useful to run the LED at the highest possible current.

If you don't count on the transistor to limit the current by not driving it entirely open the total supply voltage will be applied to the LED. At a supply voltage of only 3.0V an average red LED will already have a current of more than 100mA! As you use multiple LEDs per cycle this means a big load on your humble supply.

So indeed you have to limit the LED current. It is possible to drive the transistor less, but you will have different currents then, as the transistor gain can differ a lot from one to another.
If you really want to save energy, you should be able to use inductors on each LED instead of resistors. When using fast enough PWM the inductance will slow the current change down to a steady rise and fall.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd like to see an example of inductors in a multiplexed display. Techniques I can think of require a raft of diodes to protect the drivers and microcontroller I/O.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I don't know the exact idea. Someone else came with it. I figure the AVR protection diodes could do something in this. But now that you mention it, the driver transistor does not.

Anyway, in my opinion some kind of current limitation will have to be used.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mike: Yup, that schematic is exactly it. Well, I'm only connecting to one anode pin on the displays, but they're internally connected as I can see through the translucent potting material in the back.

As I vary the pwm ratio (n/40) the brightness, the average current drawn by the displays varies appropriately. I suppose the instant by instant current is probably much higher, but the average seems to be controllable via pwm.

I have to go do Honey-DO list items for a while, but I'll play with it tonight. I'll put in segment current-limiting resistors, and check the drawn current. I'll bet I have to up the pwm ratio though - it will be interesting to see what the average looks like.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The instant by instant current is the problem for the transistor. The "absolute maximum" isn't being approached, but during those brief times that the transistor is on, it's not in an ideal operating region. The transistor will forgive you for excess peak power if you let it cool down between pulses (so it won't blow up). But the beta (gain) won't give you any allowance at all for that time it was off.

When you have current limit for the LEDs (I would guess 10 mA is a good place to start unlesss you have a data sheet for the LED) you will probably find your PWM duty cycle needs to increase. You should see your average current be less (for the same brightness) because your LEDs are operating in their most efficient region.

We haven't discussed power supply bypassing.... you need at least 10 uF tantalum (or low ESR electrolytic) across the 3.6V, as near as you can to the 2N3906's.

If your active power averages 20 mA, this thing will have a battery life of 100 hours (power down time not included) from a 2000 mAH battery. If this is an "egg timer" or similar, that's a lot of eggs!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The schematic you have given isn't quite what I hThe schematic you have given isn't quite what I had in mind but close. I was thinking using PWM to make a simple open loop buck regulator to generate an intermediate smoothed rail of around 1.8 volts or what ever your displays need. You could then hang your LEDs from that.

OK I can see two problems here.

Firstly there is no energy storage before the displays. I'd recommend either a series inductor or capacitor (this will smooth the voltage at the anode of the displays - if using an inductor don't forget to catch the fly back voltage when turning off the cathode). At the moment the LEDs have to absorb the energy of the full 3.6 volts. This may be stressing them. It will also be causing sever sags in the 3.6v rail.

Secondly there is no current limiting so the instantaneous current is likely to be hundreds of milliamps. This will be going straight through your micro. The AVR can't handle this. You’ll probably find that the AVR output transistor is saturating and limiting the current. You must use npn transistor on the base too. Annoying I know but Sorry!

You may find that reducing the speed of your scan rate of the displays may help. The LED will spend relatively less time when the voltage is ramping up or down and more when the element is illuminated.
ad in mind but close. I was thinking using PWM to make a simple open loop buck regulator to generate an intermediate rail of around 1.8 volts or what ever your displays need. Yopu could then hang your LEDs from that.

OK I can see two problems here.

Firstly there is no energy storage before the displays. I'd recommand either a series inductor or capacitor. At the moment the LEDs are having to absorbe the energy of the full 3.6 volts. This may be stressing them.

Secondly there is not current limiting so the instantanious cirrent is likely to be hundreds of milliamps. This will be going straight through your micro. The AVR can't handle this. Yoiu muts use npn transistor on the base too. Sorry.

Tim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about this.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh yeah, and another thing (can you tell it's getting late (01:10am))

I'd recommend using FETs rather that bipolar. The voltage drop of 0.6v for a bipolar transistor is too high for an effecient battery product. If you are using 2 trasistors for the LED drive you're loosing 1.2 volts accross them. You may have well just used the dropping resistor!

Also be aware that when you turn off the LEDs if the PWM is still running the output voltage will build up as there is no sensing of the lines. If you turn off the LED when there is current flowing in the inductor there will be no where for it to go other than to charge the cap. Make sure that is is big enough to absorbe the energy from the inductor other wise you'll get a huge voltage spike on the output as it will effectivly become a boost converter instead of a buck.

Hopefully the last post for tonight!

Tim
;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, got 100ohm limiting resistors on the segments now. Stabilizes the intensity, so it doesn't vary depending on what number is being displayed. Dims it quite a bit, as expected. Still have that bizarre inequality in brightness though ...

To get the digit brightness even, the pwm ratio for the digits is 100%, 50%, 38%. Experimentally determined values, and still need a tiny bit more tweaking. These are yellow HP 5082-7660 displays.

Tim: OK, now I see what you were driving at. More effort than just adding 7 segment resistors I think, though it's a cool idea. I didn't measure the 2313 current consumption, as it's still in the stk500. Hrm, I have some 1.2ohm resistors - I could put one across the VTarget jumper and watch it with a scope, see how much it jumps around.

I've included a photo below showing the effect. The top one is with some desk light, the bottom one without - that one shows the variation best I think. Left side is with pwm enabled to stabilize the brightness, and right is without.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's an open loop buck regulator, and it works on the assumption that all LEDs have the same V/I characteristics. A battery design is a compromise between efficiency and complexity, and although this design is workable, it's at the far end of the complexity spectrum.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have a scope - and it's a 2-channel scope - why not put it in differential mode and see where you are getting the voltage drops? You can show the same digit on all displays, PWM or not (since you are using a scope). And with the current limit resistors in place, you can also measure current in real time - redundant information I believe but still may be useful in figuring out where the uneven brightness is coming from.

And even with multiplexing the digits, I would think a DVM would get you the same thing. A little less precise since it will be averaging over the on and off time, but should also ferret out who's got the big voltage drop.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey, just a quick update, and another question.

More playing around turned up that the damn displays were NOT all equal. Some were brighter than others. Don't know how I missed that. But it doesn't completely explain the brightness difference - there's still something else going on in there.

This is truly the weird project. I have the whole thing built on protoboard, and it works fine. Little messy, but works fine. I wanted to see exactly how much current it was pulling - pretty easy ...

One lead of multimeter to power supply +ve
Other lead of multimeter to +ve on board
-ve of power supply to -ve on board.

Power up.

It goes through a little splash screen, just cycling a segment around the display, not muxed. Then goes into the muxing to display the time count. Damn thing resets when it starts the muxing. No matter what voltage ... I ran it all the way up to 6V.

I thought perhaps the power was a little glitchy, but it does it with the 3.6V lithium battery too. If the meter is in series with it, it resets. No meter, runs perfectly.

This is going to be something so damn simple, I just know it ....

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you tried the "EE's last desperate fix" adding a big honking capacitor right between the the microprocessors power and ground pins? Maybe 10uF or something? I'm not sure of the exact layout you are using, but power supply glitching seems a likely candidate this reset problem.

Do you have a resistor between the cathodes and the AVR? If I remember correctly your multiplex scheme sinks the current into 7 AVR pins. I think they only handle 20mA. Could this be a problem?

Do you have a schematic of your current design that you can post?

Good Luck

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

smileymicros wrote:
Maybe 10uF or something?

You should have a 0.1 uF tantalum capacitor connected between each VCC and GND pin as close as possible to the processor.

Do you have a 10K resistor connected between RESET and VCC? Atmel also suggests a 0.01 uF capacitor from RESET to GND.

See AVR024: AVR Hardware Design Considerations.

Don

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because you are using a proto board, get the power to the AVR from as close as possible to the point at which you bring power to the board (do the same for ground). Use a slightly larger bypass cap there as well (.1uF at each VCC pin, and a 10u at the VCC entry point). This is because you have a linear power path, instead of a planar one. Your Displays will have a huge impact on other devices that are inline with them on the same current path. Try placing the power entry point inbetween the micro and the display, instead of at one end of the board.

As for your display, it may just be poor contacts in your protoboard, I've seen this happen before. Shifting up or down one position often fixes this. Also instead of using the power rails, use wires to get the power from a single point. I find protoboards to be very unreliable, especially when you get into higher currents for things like displays.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Caps did the trick. Added a 10uF 'lytic at the battery, and a 0.1uF at the 2313. Nice stable display now with the meter. I wonder why having the meter in series was enough to reset it. Anyway, it runs rock stable on battery without anything on the reset pin. If it act up, I'll add a pullup and maybe another cap.

Below is a pdf of the schematic of it as built. So damn simple it hurts :) It's wired up on protoboard, albeit a bit messily, and working fine. Aside from the brightness vagaries that is :P

It's a simple little two-minute countdown timer. Hitting the button wakes it up via low-level int. It counts to two minutes, then sounds the beeper for three 300ms bursts, then goes to sleep again.

In operation it pulls from 30-42mA, depending on segments lit. Should last a good long while on the 2100mAH lithium battery ...

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Schematic is nice looking -- what did you create it in?

Are you trying to figure out the brightness issue now? I'm curious to find out the answer.

Pages