0
\$\begingroup\$

I need to control 12 LEDs that are powered by 6V (4 AAA batteries). I'm using a PIC18F25K40 microcontroller that will be powered by 3V (2 of the AAA batteries). Because of the different power supplies, I can't charlieplex. There are enough IO pins available to individually address the LEDs.

Because I will rely on persistence of vision, the LEDs will be powered ONE at a time, so I'm expecting it to be fine to arrange them in parallel with a single current-limiting resistor.

To turn on an LED, the corresponding IO pin will be set to Output LOW in order to sink current. To turn off an LED, the IO pin will be set as an input (high impedance). Schematic shown below.

The issue is that the PIC documentation says that any applied voltage to the pins must not exceed Vdd + 0.3V. With the LEDs off, a voltage of about 3.8V will placed on the pins. (6V - 2.2V = 3.8V). 2.2V is the forward voltage of the LEDs, and Vdd is 3V.

In order to address this, I'm adding a series diode to the current limiting resistor, in order to drop the voltage placed on the IO pin to be below 3V. (Shown in schematic).

My questions:

  1. Will this circuit function as intended (over the range of battery life 1.0V-1.5V)?

  2. Will a Zener diode be better for producing a definitive voltage drop?

  3. Are there better ways to accomplish this? (The PIC needs to remain powered by 2 batteries. Other parts of the system require 6V, so can't route the remaining 2 batteries to be in parallel with the first pair.).

Additional info:

The use of 4 batteries to power the LEDs is to spread the power consumption, as well as to ensure that the LEDs can still be powered even when the individual batteries deplete to below 1.1V. Otherwise 2 x 1.1V will barely meet the 2.2V forward voltage. Please note that the 6V is required for other parts of the system; not just for the LEDs.

Haven't been able to find Zener diodes of 1V. Using standard diodes will provide a 0.7V drop, which doesn't leave much margin for preventing damage, especially if the initial battery voltage is a bit higher than 1.5V each.

PCB space is VERY tight. Strong preference to keep part count to a minimum. ie. no room for a handful of transistors or additional power regulators.

Thanks in advance for the guidance!

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ It is a pretty crappy solution to have LEDs that give different light depending on battery life. If you get rid of D2 and squeeze in a small regulator, you solve a lot of problems at once. \$\endgroup\$ – Lundin Dec 21 '17 at 15:47
  • \$\begingroup\$ There are no specs on your design, yet this topology will poor with current shared R3 thus poor intensity control and poor restrictions. Instead of poor questions on poor design, always start with specs on how it should perform for each LED and range of Vbat, etc \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Dec 21 '17 at 17:51
2
\$\begingroup\$

What you suggest is very wasteful of the batteries, and also quite dependent on battery voltage. You need to re-think your whole power architecture.

The first thing I'd do is use a buck converter to make 3.3 V from the 4-6 V battery. Your PIC runs at full speed with as low as 3.0 V, so shooting for 3.3 V is good. Now use that 3.3 V to run the PIC and the LEDs.

Each LED drops 2.2 V, so that leaves 1.1 V for whatever else is in series with it and the 3.3 V supply. You want to control each LED individually, so use a separate transistor for each one:

If we figure the transistor will drop about 200 mV C-E when on, then there will be about 900 mV across R2. That means the current will be 19 mA. Unless you are trying to squeeze every last bit of brightness from the LED, I recommend using the next higher common size for R2 of 51 Ω. That still gives you over 17 mA, but leaves more margin for other values to be off a bit. You wouldn't be able to see the difference between 17.5 and 19 mA thru identical LEDs in a side by side comparison.

Figure worst case the transistor drops 750 mV B-E. That results in just under 1 mA. Worst case, we are asking for less than a gain of 25 from the transistor. There are many small signal transistors that can easily guarantee that at these voltages and currents.

Using this power scheme has several advantages over what you propose:

  1. It is more efficient. Since you are using batteries, this extends battery life. 3.3 V is closer to the LED voltage than 4 or 6 V, so less power will be wasted in the series resistor.

  2. It is consistent across the expected battery range of 4 to 6 V. The LEDs will be the same brightness regardless of the state of the battery.

  3. It uses the batteries evenly. Tapping into the middle of a battery pack is a bad idea as some batteries get drained more than others. Users will generally replace all batteries when things look like they stop working. With a tap, some of the batteries will have some unused energy in them when they get replaced. If the user replaces the battery groups separately, then you have a mix of fresh and worn batteries. All around, draining batteries unevenly is a bad idea.

Another issue is that you plan to drive one LED at a time, even though you say you have enough I/O pins to drive each individually. Don't do that.

To get the same overall brightness, you'd have to run the LEDs for 12x the current at 1/12 the time. Not only would the LEDs be less efficient at 12x the current, that is likely beyond the maximum pulse current spec. Just turn on each LED individually when you want it lit. As a bonus, it also simplifies the firmware.

\$\endgroup\$
  • \$\begingroup\$ I think he'd be better off using an n-channel logic-level MOSFET instead of a BJT. This would provide more efficiency, reduce the load on the PIC pins, and possibly allow him to eliminate R1 (from your diagram). \$\endgroup\$ – kjgregory Dec 21 '17 at 19:14
  • \$\begingroup\$ @kjg: Yes, a MOSFET would allow eliminating R1. However, it would not increase efficiency by much. The LED current still comes from the same 3.3 V source. The elimination of the C-E drop would just be made up with a larger series resistor. The only efficiency gain would be loss of the base current. \$\endgroup\$ – Olin Lathrop Dec 21 '17 at 19:20
  • \$\begingroup\$ True. Nonetheless, I think it's a better choice for this application. \$\endgroup\$ – kjgregory Dec 21 '17 at 19:22
  • \$\begingroup\$ @kjg: It's a space/cost tradeoff. If this is a high volume product, then the lower cost of the BJTs is important. Otherwise, I agree that MOSFETs would take less space. I showed a BJT above, because that's what I'd go with given no particular pressure either way. \$\endgroup\$ – Olin Lathrop Dec 21 '17 at 19:37
  • \$\begingroup\$ Why wouldn't you just source or sink the LED current from the PIC pins and avoid the transistors? (assuming the current requirements meet the micro's specs). \$\endgroup\$ – Amir Dec 21 '17 at 20:14
1
\$\begingroup\$

With the LEDs off, a voltage of about 3.8V will placed on the pins. (6V - 2.2V = 3.8V). 2.2V is the forward voltage of the LEDs, and Vdd is 3V.

No, the forward voltage drop of 2.2V is at the nominal current of 20mA. At lower currents, you will see a much smaller voltage drop, causing problems.

The proper way of handling this is simply using transistors.

A NPN like the 2n3904 with a nominal gate resistance of 1KΩ should be enough. One pair for each led you want to control. If space is tight, look at smd resistor packs and transistor arrays. Or use a voltage regulator, so you can avoid the voltage drop issue. SMD or 3 pin regulators that don't need capacitors are everywhere. Look at the On Semi NCP4588 200mA linear regulator. Only needs a 0.1µF cap and itself.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the feedback! A quick test of applying voltage to one leg of an LED, while keeping the negative leg floating, showed that the floating leg had a drop of more than 1V. This is with zero current flow. I'd like to learn why this couldn't be relied on. And what (if any) is the mechanism of power/efficiency loss through this? \$\endgroup\$ – Amir Dec 21 '17 at 20:26
-1
\$\begingroup\$

A more tolerant design that works from 4.1 to 7V, with current regulation.

schematic

simulate this circuit – Schematic created using CircuitLab

A 100mA 0.1 dropout 4V LDO will also work but at about 10mA per string using 5000 mcd . This relies on a good choice of LEDs .

\$\endgroup\$
  • \$\begingroup\$ If you would rather have poor regulation, poor efficiency, poor battery life, Avoid this design. If you can't fit these parts in radial mode, there is something wrong with your plan. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Dec 21 '17 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.