TLC5940NT with 7 segment

Hello everyone,

I'm newbie in the arduino projects. So i have a question. I need to connect 7 segment 1 digit display( 5161BS) to TLC5940NT and controlling with arduino uno. Do you have any example diagram or code for that ? When i look at the exapmles of TLC5940 they are generally working with led diodes. Now you can ask why am i using tlc for 1 digit but further of the project i'll connect more than 1 digit. 2 or 4 to tlc as i can

Hello. Why not use MAX7219? Yes, this is common cathode display driver, but it is much easier to operate and cheaper. You can use either 1 digit or 2 or more - up to a total of 8.


If you need more than 8 numbers, just connect 1 or more MAX7219 chips in series and you're done.

Yes, the TLC5940 seems to be a bit of an orphan in the Arduino world and while it may have the capability of driving LEDs, like the more economical PCA9685, its primary application would seem to be controlling servos.

Better to chase up the module flashko recommends.

The version with the displays soldered in place

is cheaper than the version with removable displays:

The removable displays allow you to select some colour other than red.

The TLC chip isn't normally used for driving 7-seg displays. The chip's "special superpower" is dimming the LEDs on each of it's outputs individually and with a fine level of control. That isn't normally something you want or need to do with 7-seg displays. But there is no reason it cannot drive 7-seg displays. The displays need to be common anode. Fortunately, 5161BS is common anode.

Are you using bare tlc chips or some module with the chip soldered on? If a module, please post a link. In either case, please post a schematic diagram showing how you plan to wire everything up, and we can check it for you.

after i open this article i understand that i couldnt manage 7 segment 4 digit with tlc so i build a led rows and columns and i'll work on it i'm not in a bad situation right now but i couldnt make what i want. If i cant solve that issue let you know and want your help again thanks for every reply, answer so far <3

#include "Tlc5940.h"  
#define RowOne 2     //Gate of 1.MOSFET which connects to Row "a" (anodes of all LEDs in Row "a")
#define RowTwo 7     //Gate of 2.MOSFET which connects to Row "b" (anodes of all LEDS in Row "b")
#define RowThree 4    //Gate of 3.MOSFET which connects to Row "c" (anodes of all LEDs in Row "c")
#define RowFour 5     //Gate of 4.MOSFET which connects to Row "d" (anodes of all LEDs in Row "d")
#define RowFive 6     //Gate of 5.MOSFET which connects to Row "e" (anodes of all LEDs in Row "e")
#define Ach 0 //defines the "A" column for the tlc5940 -->OUTPUT 0
#define Bch 1 //defines the "B" column for the tlc5940 -->OUTPUT 1
#define Cch 2 //defines the "C" column for the tlc5940 -->OUTPUT 2
#define Dch 3 //defines the "D" column for the tlc5940 -->OUTPUT 3
#define Ech 4 //defines the "E" column for the tlc5940 -->OUTPUT 4
#define Fch 5 //defines the "F" column for the tlc5940 -->OUTPUT 5
#define Gch 6 //defines the "G" column for the tlc5940 -->OUTPUT 6
#define Hch 7 //defines the "H" column for the tlc5940 -->OUTPUT 7



void setup()
{
  pinMode(RowOne, OUTPUT);  // declare arduino nano pin 8(RowOne) as OUTPUT
  pinMode(RowTwo, OUTPUT);  // declare arduino nano pin 7(RowTwo) as OUTPUT
  pinMode(RowThree, OUTPUT);// declare arduino nano pin 6(RowThree) as OUTPUT
  pinMode(RowFour, OUTPUT); // declare arduino nano pin 5(RowFour) as OUTPUT
  pinMode(RowFive, OUTPUT); // declare arduino nano pin 4(RowFive) as OUTPUT
  Tlc.init();               // configures the arduino to use the tlc5940, be sure to connect the arduino correctly to the tlc 
 
 /*          ARDUINO                                         TLC5940                            
              13|-> SCLK (pin 25)           OUT1 Column "B" |1     28| OUT0 Column "A"
              12|                           OUT2 Column "C" |2     27|-> GND (VPRG)
              11|-> SIN (pin 26)            OUT3 Column "D" |3     26|-> SIN (pin 11)
              10|-> BLANK (pin 23)          OUT4 Column "E" |4     25|-> SCLK (pin 13)
               9|-> XLAT (pin 24)           OUT5 Column "F" |5     24|-> XLAT (pin 9)
               8|                           OUT6 Column "G" |6     23|-> BLANK (pin 10)
               7|                           OUT7 Column "H" |7     22|-> GND
               6|                           OUT8 Column "I" |8     21|-> VCC (+5V)
               5|                           OUT9 Column "J" |9     20|-> 2K Resistor -> GND
               4|                           OUT10           |10    19|-> +5V (DCPRG)
               3|-> GSCLK (pin 18)          OUT11           |11    18|-> GSCLK (pin 3)
               2|                           OUT12           |12    17|-> SOUT (only used when you want to use more than one tlc5940)
               1|                           OUT13           |13    16|-> XERR (can be used as error report, but not necessary)
               0|                           OUT14           |14    15| OUT15        */
  }

void loop(){
  
                                        // waits until RowDuration is reached and than goes through cycle
                                   // updates oldMicros value by adding the micros() with RowDuration
   


  //Eletter1();}//pos1();}  
  // shows first static picture when count==0, so right at the beginng .
  digitalWrite(RowOne, HIGH);
  digitalWrite(RowTwo, LOW);   // sets RowTwo (pin 7) High (not active)--> Row two OFF
    digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
    digitalWrite(RowFour, LOW);  // sets RowFour (pin 5) High (not active)--> Row four OFF
    digitalWrite(RowFive, LOW); 

  Tlc.set(Ach, 2000); 
  Tlc.set(Bch, 2000); 
    Tlc.set(Cch, 2000); 
  Tlc.update();

  Tlc.set(Ach, 0); 
  Tlc.set(Bch, 0); 
    Tlc.set(Cch, 0); 
  delay(5);

  digitalWrite(RowOne, LOW);
  digitalWrite(RowTwo, HIGH);   // sets RowTwo (pin 7) High (not active)--> Row two OFF
    digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
    digitalWrite(RowFour, LOW);  // sets RowFour (pin 5) High (not active)--> Row four OFF
    digitalWrite(RowFive, LOW); 

  Tlc.set(Ach, 2000); 
 
  Tlc.update();

  Tlc.set(Ach, 0); 
  delay(5);
digitalWrite(RowOne, LOW);
  digitalWrite(RowTwo, LOW);   // sets RowTwo (pin 7) High (not active)--> Row two OFF
    digitalWrite(RowThree, HIGH); // sets RowThree (pin 6) High (not active)--> Row three OFF
    digitalWrite(RowFour, LOW);  // sets RowFour (pin 5) High (not active)--> Row four OFF
    digitalWrite(RowFive, LOW); 

  Tlc.set(Ach, 2000); 
  Tlc.set(Bch, 2000); 
    Tlc.set(Cch, 2000); 
  Tlc.update();

  Tlc.set(Ach, 0); 
  Tlc.set(Bch, 0); 
    Tlc.set(Cch, 0); 
  delay(5);
  digitalWrite(RowOne, LOW);
  digitalWrite(RowTwo, LOW);   // sets RowTwo (pin 7) High (not active)--> Row two OFF
    digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
    digitalWrite(RowFour, HIGH);  // sets RowFour (pin 5) High (not active)--> Row four OFF
    digitalWrite(RowFive, LOW); 
    Tlc.set(Cch, 2000); 
  Tlc.update();

    Tlc.set(Cch, 0); 
  delay(5);

  digitalWrite(RowOne, LOW);
  digitalWrite(RowTwo, LOW);   // sets RowTwo (pin 7) High (not active)--> Row two OFF
    digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
    digitalWrite(RowFour, LOW);  // sets RowFour (pin 5) High (not active)--> Row four OFF
    digitalWrite(RowFive, HIGH); 

  Tlc.set(Ach, 2000); 
  Tlc.set(Bch, 2000); 
    Tlc.set(Cch, 2000); 
  Tlc.update();

  Tlc.set(Ach, 0); 
  Tlc.set(Bch, 0); 
    Tlc.set(Cch, 0); 
  delay(5);
            // set Da brightness to Bch OUTPUT(OUTPUT 1);

  


}

   

 

    

   
 
 


I wrote the code for 8x5 led it's work for 3x5 i've tried to make the number of 5 display but it's blinking i change delay and brightness lot's of time but couldnt find to solve this


AAA
AOO(2 led blink here)
AAA
OOA (2 led blink here)
AAA


A's represent the light is stable O's represent blinking

how can i solve that issue ?

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

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

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

I'm sorry but i want to change title to the direct question because when i open this post i was thinking to make 7 segment 1 digit with tlc5940 but after that i understood that i need to make with leds so set this setup and had a issue i wouldnt contuinue with this article because it's different that's why i open new. Already 1 day passed and no answer here so far for my question.

That's OK, you can change the title if you have a more appropriate one. Just look for the "edit" icon at the bottom of your first post.

But this is one project, so it is critical that you keep all the information relating to it in one place.

Did you read the instructions Bob gave you?

I saw your post and passed over it because you didn't give any hardware details. I often spend most of my time here begging people for details, so the motivation to ask had expired.

Right now, all the information I have from you is that it is, " a led rows and columns". Not much to go on.

Actually i mentioned it , I'm using Arduino Uno connected with TLC5940NT and anode's and katode's of leds are connected with arduino and TLC

That could damage the Arduino, depending how you wired circuit.

So the point here is that you have basically given no definitive information on how you have wired the circuit.

All right, perhaps we can compensate for that by guessing how someone who clearly does not understand the hardware would attempt to do this. You have mentioned a 5161BS display which is a common anode display and a TLC5940 current sink driver. You refer to "using Arduino UNO connected with TLC5940NT and anodes and cathodes of LEDs are connected with Arduino and TLC".

This suggests that you are connecting the segment cathodes of the display to the TLC5940 and the common anodes of the digits to the Arduino however your code refers to using FETs which might be appropriate except that the code sets each digit (confusingly referred to as a "Row" - you have the meaning of rows and columns swapped in your description!) HIGH and the others LOW which is wrong for using a FET but right for directly connecting the Arduino pin to a common anode.

A FET - which would have to be a logic-level P-channel FET - would permit a decent current drive to the common anode but the Arduino UNO itself can only drive about 30 mA which shared over eight segments (including the decimal) means you must program the TLC5940 for 4 mA per segment using R(IREF) of 10k.

Perhaps the most obvious problem is that you are attempting (very badly) to multiplex the digits in code but also - if I understand the "TLC.set" command correctly - attempting to use PWM. This in itself is most unlikely to work in any useful manner. You cannot use hardware PWM with software multiplexing.

So i fear you have just about everything wrong! Wrong hardware choice, wrong circuit design, wrong code! :astonished: We often hear the proposition here "I know this is not practically efficient or useful but it is a learning exercise for me!" Well, I honestly cannot see how this can be made to work in this case, so I seriously suggest you put the TLC5940 away for use where it is appropriate and if you want to use a multi-digit display, obtain a proper one as described in #2 and #3.

Seriously! :face_with_raised_eyebrow:

Thank you for every reply i read them and i'm going to apply them to my project if needed. I'm changing my setup and continue with the right one as you suggest thanks for everything and your attention.