2
\$\begingroup\$

I have a 7 segment display with a common anode which takes around 12 V. There's a 330 Ω resistor connecting each data pin to an ESP8266. To display each number, I'm just tying the requisite pins low. The issue I'm noticing is that the segments that are off are still dimly lit when they're off.

My guess is that since 12 V are coming in and each pin on the microcontroller can only output 3.3 V, there's still current flowing through the LED's because there's too much of a voltage difference (please correct me if I'm wrong).

What are some potential solutions to this problem? I've thought about possibly using a transistor and essentially tying the data pins back to 12 V when the microcontroller emits a positive voltage. That way the voltage different would be 0.

Let me know your thoughts. Thanks!

\$\endgroup\$
0

1 Answer 1

5
\$\begingroup\$

I think you may have damaged your protection diodes (\$D_2\$ and \$D_3\$ below.) It's likely that \$D_2\$ (for each I/O pin) isn't healthy, now.

schematic

simulate this circuit – Schematic created using CircuitLab

And yes, transistors (or an IC that has them) will be needed. The easiest method would be to reverse your logic so that emitting a 1 turns the LED segment ON and emitting a 0 turns it off. If that's acceptable, then a simple current sink will be fine:

schematic

simulate this circuit

This will limit the LED segment current without taxing your I/O pin's ability to source or sink current and the always-reverse-biased BC junction of the BJT will protect your I/O pin. I'm guessing about the required display segment current -- guessing at around \$20\:\text{mA}\$. If that's not right adjust the value of the emitter resistor, appropriately. (I can't tell from your writing but if the \$330\:\Omega\$ resistor is already built into the LED display device and you can't remove it, that should still be fine.)

\$\endgroup\$
18
  • 1
    \$\begingroup\$ R1 should be between the transistors collector and the LED. This can't work as you show it, it would raise the transistors emitter above the I/O voltage output. 20mA * 150 ohms + 0.7V = 3.7V A 1k resistor from I/O to base would be appropriate also (as we don't know the output impedance of that I/O....) \$\endgroup\$
    – Kyle B
    Commented Jan 20, 2023 at 7:47
  • 2
    \$\begingroup\$ It's not likely damaged so long as you really had that 330 ohm resistor in series with the LED ... you're just leaking current through it. Make the circuit described above with the changes I mention, it will work for you. \$\endgroup\$
    – Kyle B
    Commented Jan 20, 2023 at 7:50
  • 4
    \$\begingroup\$ @KyleB There's no problem. And no, in this case the resistor is exactly where it belongs. Think about it. \$\endgroup\$ Commented Jan 20, 2023 at 8:00
  • 2
    \$\begingroup\$ @KyleB If the I/O pin sits at 3.3 V, the emitter will sit about one diode drop below that. Think about what that means. \$\endgroup\$ Commented Jan 20, 2023 at 8:03
  • 3
    \$\begingroup\$ @KyleB It creates a very nice current sink. The 2.7 V will sit over the 150 ohm resistor and deliver 18 mA of collector current, independent of the collector load -- up to a point. If 18 mA is enough current to cause too much of a voltage drop then the collector would be driven below the base and that could be a problem. However, this doesn't appear to be the case for this load. \$\endgroup\$ Commented Jan 20, 2023 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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