Unexpected data on a 7-Segment Display, using SevSeg. Library

Hello to everybody,

i’ve a few problems with the control of a 7-segment display with 4 digits, and i hope, that maybe someone could help me with it.
A short introduction of me: I’m new here, but i’ve done a lot with arduinos, µControler, electronics, pcbs… but maybe not allways the professional way :wink:

First the Hardware :
The display: LFD5524V-10/SP8-2 (47 Segments with a common anode) (a similiar is shown here http://pdf.directindustry.com/pdf/plus-opto/ligitek-display-shortform/35040-83087-_24.html)

*My circuit (have a look at the attached picture ) uses PNP-transistors, to drive the current for all segements (>40mA). So all in all I use 4 PNP-BJT, one for each digit.

The software:
*I want to use the Library “SevSeg” from https://playground.arduino.cc/Main/SevenSegmentLibrary

The test-software (summarized from an example):

#include "SevSeg.h"
SevSeg sevseg; //Instantiate a seven segment controller object

void setup() {
  byte numDigits = 4;
  byte digitPins[] = {2, 3, 4, 5};
  byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
  bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
  byte hardwareConfig = NP_COMMON_ANODE; // See README.md for options
  bool updateWithDelays = false; // Default. Recommended
  bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
  
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
  sevseg.setBrightness(90);
}

void loop() {

    sevseg.setNumber(0, 1);
    sevseg.refreshDisplay(); // Must run repeatedly
}

The Problem is, that with this code it is NOT “0.” shown on the display, but instead it shows “8.8.” on the digit 3 and 4.

I tried each possible configuration “COMMON_ANODE, COMMON_CATHODE, NP_COMMON_ANODE, NP_COMMON_CATHODE”, but it doesn’t worked.
In my opinion “NP_COMMON_ANODE” should be the right config.

Ok, my next idea: Are there problems with the connections?
With this test Code i tried each segment of each digit.

void setup() {

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);


}

void loop() {

  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);

  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  digitalWrite(12, HIGH);
  digitalWrite(13, LOW);


}

All segments on each digit worked correctly, and with this last code the display shows “0.”, as it was expected in the first code.

Did one of you had the same behavior?

I think, that the Library has some Problems with my pcb, and has some problems with the signals OFF=HIGH und ON=LOW (for the digit control as well as as for the segment control)?

Are there some other libraries, which would work better?

It would be a big help for me, if somebody could give some advices for this problem…
Thank you for it!

Greetings from Germany
puzzlr

Example from your link: sevseg.setNumber(3141,3 ) ; // Displays '3.141'

You want to display ‘0.’ that is zero followed by a dot.

Following the example, you’d have to say: sevseg.setNumber(0,0 ) ;

However, that would then signal an integer, ie no decimal point. Further, in the setup(), you have specified no leading zeros but with ‘0.’ you apparently want to print one.

From your tests and report of the ‘8.8’ I’d say there is no fault with your wiring, but what you are trying to show ‘0.’ is undefined in the library.

If you have special requirements, it is quite easy to control a seven segment display without a library. The key element is an array of 10 bytes with each byte representing a digit. The bits in each byte correspond to the display segments.