3
\$\begingroup\$

I'm building a formicarium to have below my monitor. With a Pi pico 2 W as controller, powered by a USB3 port on the monitor.

I'm a software developer, but new to electronics.

The schematic below is what I currently have. Allowing me to control both heating and LEDs.
However when I switch the heating, the brightness of the LEDs changes.
How can I stabilize the LED output (current, as I understand it?) and be able to switch the heating?

When measuring, I can see that the Voltage drops by around 100mV - 150mV for each active transistor. (Over V1, so 5V becomes 4.9V) Which leads to a change in current of about 3 mA.

I have a collection of transistors, resistors, LEDs, capacitors and a multimeter. And I would prefer a solution that doesn't involve ordering any extra parts, if at all possible...

The 47 and 100 Ohm resistors are 1W rated.
Transistors are BC337.
5V comes from the Vbus pin on the pico, which is powered by USB.

  • Lighting: 2x 30cm led filament (2.4 Vf when measured) controlled via PWM using a single transistor. Just want some light that I can control via a web application. Will probably be on most of the day @ around 60 - 80% power (PWM duty cycle)

  • Heating: 4x 100 Ohm resistors, switched in pairs with a transistor. The goal is to heat a small box (less than 1L, plywood and acrylic) to about a few degrees over room temperature. This should be around 1W of heating, which is overkill, but that is the point. (Testing for future projects)

schematic

simulate this circuit – Schematic created using CircuitLab

Edit: This is all on a breadboard at the moment. If I skip the transistors and switch with a jumper wire I get a change in brightness too.
However the transistors seem to amplify the effect.

Edit 2: I cut an old, thick USB cable and used that to power everything.
And I separated the Pico and the heater and the LEDs so they had their own cables to 5V and ground. (instead of sourcing 5V from the Pico's V_bus, I am now providing 5V to it) The voltage drop on the 5V was almost halved like this. But the LEDs were still too flickery for my liking.
The circuit from the accepted answer (using a red LED as a constant-voltage reference) did fix the flickering.

New contributor
Adriaan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
15
  • 1
    \$\begingroup\$ It's a PSU issue, it can't supply such demand. \$\endgroup\$ Commented Dec 10 at 12:48
  • \$\begingroup\$ "This should be around 1W of heating" depending on mechanical arrangement, don't forget the power from LED1/2&R5/6. \$\endgroup\$ Commented Dec 10 at 13:12
  • 1
    \$\begingroup\$ @greybeard The voltage over V1. 5V becomes 4.9V. I did consider the power consumed by the LEDs with resistor. Should there be an unusual summer heat wave, the box will be dark... \$\endgroup\$ Commented Dec 10 at 13:48
  • \$\begingroup\$ Are you sure the LEDs should have that much current? 20mA max is standard for most circuit board LEDs. \$\endgroup\$ Commented Dec 10 at 13:53
  • \$\begingroup\$ And in general: you do not want stable current, you want stable voltage. A voltage regulator is a device that can maintain a steady voltage even under different loads. Therefore: if there is a dip in the supply voltage when loads change, that means that the voltage regulator isn't working as intended. \$\endgroup\$ Commented Dec 10 at 13:58

4 Answers 4

3
\$\begingroup\$

@Davide Andrea's answer is expanded here, especially how to implement his current-source idea.

You should find the origin of USB's +5V source, and measure. It may be poorly regulated: that is, when more current flows (like when you turn on the heater) its output voltage drops. In that case, regulating LED current is the only solution possible to maintain constant brightness.

That USB +5V source may be well-regulated and the problem involves the current path through all the wiring and connectors between it and the LED, heater. That path has small resistance that causes voltage drop when current flows. By reducing this resistance with beefy wires, you can nearly eliminate LED brightness variation when extra heater current flows. Or you can provide separate power wires for LEDs and for heater. Both +5V and GND paths need those extra wires.

schematic

simulate this circuit – Schematic created using CircuitLab


For the case where +5V USB sags, LED current regulation for constant brightness is the go-to solution. A local voltage regulator provides a constant-voltage reference for the current source - in this case, a +2.5V regulator, for example LM4040. If you want to go cheap, a RED LED can serve as the voltage reference (you may have to tweak value of R1, R2).
The PICO's GPIO should be able to provide enough current for both regulator, and transistor base. I'm assuming that the base-to-emitter drop will be about 0.7V, so that the voltage across R1 or R2 will be 2.5V - 0.7V = 1.8V. If R1,R2 are 36 ohms, emitter current will be near 50 mA, constant...so will LED current. :

schematic

simulate this circuit


These transistors are barely operating as current sources - almost operating as saturated switches. This way, they don't get hot. But it means that if V_USB sags a lot, so that the transistor collector voltage falls below 2.5V, current source operation fails and LED current begins to sag too.
In that case, it may be better to use a voltage regulator smaller than 2.5V. If you use a 1.25V regulator instead, then R1, R2 have to be scaled down to 12 ohms, so that near-50mA LED current flows.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you for expanding and helping OP so thoroughly. \$\endgroup\$ Commented 2 days ago
  • \$\begingroup\$ We are talking about a couple of 100mA here though. Voltage drop isn't an issue even if they picked AWG26 or so. Unless the cables are very long. \$\endgroup\$ Commented 2 days ago
3
\$\begingroup\$

Since the heater runs off 5V, it's creating a dip in that 5V output. So, you want a way to run the LED current that mainly depends on the other power supply (that 3.3V one) to set the LED current. This will do it:

schematic

simulate this circuit – Schematic created using CircuitLab

If the LED is red, you might get away with R4=0, and omit R3. There will be some temperature dependence because of the transistor V_BE drop, if the R3/R4 is inserted, and less dependence (but closer to transistor saturation/loss of regulation) otherwise. Voltage headroom becomes 5V-3.3 -0.2+ 0.6V (roughly 2V) and that's plenty if your LED isn't a blue or white one, and if those power supply numbers don't vary too much.

\$\endgroup\$
2
\$\begingroup\$

How can I stabilize the LED output (current, as I understand it?) and be able to switch the heating?

  1. Use a regulated power supply that can supply the total current without dropping the voltage.
  2. Use shorter, larger gauge wires so the voltage drop across them is minimal.
  3. Run a separate positive wire from the heating resistors to the power supply instead of sharing the same wire as the LEDs.

If the above is inconvenient, here is another solution:

Instead of using Q3 as an on/off switch, redesign it as a current source by placing a resistor in series with the emitter and driving a single LED. Duplicate the circuit for the second LED.

\$\endgroup\$
1
  • \$\begingroup\$ also run a separate negative wire, doubling the positive wire only solves half the problem. \$\endgroup\$ Commented yesterday
0
\$\begingroup\$

Here's one I prepared earlier.

enter image description here

This is for "12V" operation (in practice as little as 7V at the end of a long wire), for 4 to 5V use only one LED in series.

The input is a 3.3V logic signal.

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.