Need Help with Dim 7-Segment LED Displays Using PCF8575

Hi everyone,

I'm currently driving two common anode 7-segment LED displays (common anode) using a PCF8575 16-bit I/O expander. I've connected the common anode of the displays to 5V and am using DigitalWrite(LOW) to activate individual segments. Each segment is connected through a 330 ohm resistor to the PCF8575.

Although the setup is working, the segments are too dim. I understand that the PCF8575 can source only a limited amount of current. From my research, I've learned that it's more effective at sinking current. I found a method involving LED bulbs and the PCF8575 where the anode is connected directly to 5V, and the cathode goes through a resistor to the expander. However, I'm unsure how to apply this to a 7-segment display.

Could anyone guide me on how to improve the brightness of the segments using the PCF8575? Any advice or pointers would be greatly appreciated!

Thank you!

Mod edit:
This reply appears to be AI generated, treat with care.

Solution 1: Use Transistors to Boost Current Sinking

Add NPN transistors (e.g., 2N3904) between the PCF8575 and the segments to handle higher current.

Wiring

  1. Segment CathodesCollector of NPN transistor.
  2. Transistor EmitterGround.
  3. Transistor BasePCF8575 pin via a 1kΩ resistor (limits base current to ~5mA).
  4. Resistors → Move the 330Ω resistors between the segment cathodes and transistor collectors (not between PCF8575 and transistor).

How It Works

  • The PCF8575 now only drives the transistor base (low current).
  • The transistor sinks the full segment current (e.g., 15–20mA), bypassing the PCF8575’s limitations.

Solution 2: Multiplex the Displays

Rapidly alternate between displays to reduce simultaneous current draw.

Steps

  1. Common Anodes → Connect each display’s common anode to a separate GPIO pin (or a PCF8575 pin) via a transistor.
  2. Drive one display at a time:
  • Turn on the first display’s anode (set GPIO to HIGH).
  • Set segments for the first display via the PCF8575.
  • Delay briefly (1–5ms).
  • Turn off the first display and repeat for the second.

Benefits

  • Only 8 segments are active at once, reducing total current draw.
  • Persistence of vision makes both displays appear continuously lit.

Solution 3: Adjust Resistor Values

Recalculate resistor values to maximize brightness within the PCF8575’s limits:

  1. Assume:
  • LED forward voltage: 2V (typical for red segments).
  • PCF8575 sink voltage drop: 0.6V (when active).
  • Desired segment current: 10–15mA.
  1. Resistor Calculation:R=VCC−VLED−VPCFI=5V−2V−0.6V10mA=240ΩR=IVCC​−VLED​−VPCF​​=10mA5V−2V−0.6V​=240ΩUse 240Ω resistors instead of 330Ω for brighter segments.

Recommendation

  • Combine Solutions 1 and 2: Use transistors for current handling and multiplexing for reduced load.
  • Example Circuit:
    Circuit diagram showing PCF8575 driving 7-segment displays via transistors and multiplexing

Code Snippet (Arduino)

cpp

Copy

#include <Wire.h> #include "PCF8575.h" PCF8575 expander(0x20); // I2C address // Pins for display anodes (via transistors) const int anode1 = 2; // GPIO for Display 1 anode const int anode2 = 3; // GPIO for Display 2 anode void setup() { expander.begin(); pinMode(anode1, OUTPUT); pinMode(anode2, OUTPUT); } void loop() { // Display 1 digitalWrite(anode1, HIGH); digitalWrite(anode2, LOW); expander.write16(segments_for_display_1); // Replace with your segment data delay(5); // Display 2 digitalWrite(anode1, LOW); digitalWrite(anode2, HIGH); expander.write16(segments_for_display_2); // Replace with your segment data delay(5); }


Final summary

  • Transistors: Use 2N3904/2N2222 or MOSFETs (e.g., 2N7000) for better efficiency.
  • Power: Ensure your 5V supply can handle the total current (e.g., 8 segments × 15mA = 120mA per display).

By offloading current sinking to transistors and multiplexing, you’ll achieve brighter displays without overloading the PCF8575. :rocket:

Thank you for your reply, I will get some transistor tomorrow. In the mean time, can you see that my set up is correct based on your solution 1?

I being on the lazy side would u se a ULN2804. At 100mA it will only drop about 1 volt. It has 8 drivers in a single package.

You might want to look at this How to get the best out of this forum before you proceed any further.

It will tell you how to post images correctly on this forum.

One thing you should not do is to post links to third party sites like you have appeared to do in your post. If you read under the Example Circuit in your post it says:-

The image you requesting does not exist or is no longer available.

Hi everyone,

I'm currently working on a project involving the PCF8575 I/O expander to control segments of a 7-segment display (common anode) via 2N3904 NPN transistors. However, I'm encountering an unusual behavior: in my understanding, to light up a segment, I will have to send LOW from the output pins, however, segments light up when I set the PCF8575 output pins to HIGH instead of LOW. Given that NPN transistors should conduct when the base is LOW relative to the emitter, I'm puzzled by this behavior.

Here's the basic setup:

Emitter: Connected to ground.
Base: Connected through a 1kΩ resistor to the PCF8575 output pin.
Collector: Connected to the segment's cathode through a 330Ω resistor.

I confirmed that the transistors are indeed 2N3904 (marked as such on the transistors). My expectation is that setting the PCF8575 pin to LOW should turn on the segment by allowing current to flow through the transistor.

Could there be an issue with my PCF8575 setup or possibly something with the internal configuration of the expander that I'm overlooking? Any insights or suggestions would be greatly appreciated as I'm trying to determine whether this behavior is due to a wiring error, a misunderstanding of the PCF8575's characteristics, or a possible issue with the transistors themselves.

Thank you in advance for your help!

No, they conduct when the base voltage is higher then the emitter.

https://www.allaboutcircuits.com/textbook/semiconductors/chpt-4/transistor-switch-bjt/

What type of display are you using? Your frizzy is missing a lot of information.

@edgeg_p ,

Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

Thanks:-)