Hi. Control 24V LED strip by Multiplexing. HELP Please!!

Hello Reader
Please can I have your help!

I currently making a large scale Digital timer made with 24V LED strips and an Arduino mega to control them. I have previously made a stop watch using a similar method that worked. I believe this to be because I was using a IC4026 chip to control the 24VLED strips as they counted up. I followed these instructions if you are interested

https://www.homemadecircuitsprojects.com/2015/11/making-automatic-stopwatch-for-runners.html#In_Arduino_we_assign_hardware_interrupt_as

But now I want to be able to control the LED strips with a multiplex display system. I thought I would be able to achieve this by simply replacing where a regular LED would be with a transistor connected to a 24V led strip.

But I am having all sorts of issues.
1.LED’s stay
2.LED’s very really turn off
3.multplexing has no effect

Please if anyone know a solution I would be very grateful for any advise 

Thanks

circut design.pdf (126 KB)

timer2.ino (10.8 KB)

Advice? No problem! Post your schematic and code. Read the forum guide in the sticky post to find out how.

ok i've added that now.
Sorry for the bad diagram i have never done one before hope that it is ok. if there is anything you don't understand please ask :slight_smile:

"24v transformer"

"transistor"

"power pack"

Post your code. Read the forum guide in the sticky post to find out how.

I cannot understand your schematic, sorry. Can you improve it please? If much is repeated, show one example clearly. Label all components.

ok i've posted the code, for some reason there is [[ and ]] but ignore that.

i'll have a ago at redoing some of it. what is it that you don't understand exactly?

Where is your code? I don't see it at all.

I can't understand how you have connected the transistors for each led strip.

How many LEDs on each strip?

ok even when i press the code button </> it keeps saying it is over the 9000 character limit im not sure why. >:(

i will redraw that better for you now.

there will be a total = 30 LED strips each 15cm long each with 18 LED's
LED Strip

I have wired the system Just like a regular multiplex display, using 4 separate 7 segment displays. BUT now instead of an LED i have replaced that with a transistor that is supposed to set of a 24V LED strip.

hope that makes sense.
that is the first half of the code

/*
Arduino 4 digits 7 segments LED countdown timer with buzzerm from
electronicsblog.net. If You share/use this code elsewhere on the internet
please meantion this code source.
*/

// segment | Arduino board PIN number 

#define G 1
#define F 2
#define A 3
#define B 4
#define E 5
#define D 6
#define C 7
#define DP 13

// Commonn cathodes control
#define GND1 8
#define GND2 9
#define GND3 10
#define GND4 11

#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978
// buttons
/*
Button_start - start/pause timer and in setup mode inreases minutes
and seconds values
Button_set - if timer is paused it resets timer to start. Long press
activates setup mode in which button is for going through minutes, seconds setup
and leaving setup mode.


*/


#define Button_start 22
#define Button_set 24

///
#define Buzzer 12
#define LED 13 // or relay insted




int i=0; 
char run=0; // shows if timer is runnig
int b=0;  //for buttons
int c=0;
int d=0; // for buzzer
char set_mode=0; // shows if timer is in setup mode
char alarm =0;  // if "1" buzzer is on
int melody[] = {
  NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  4, 8, 8, 4, 4, 4, 4, 4
};


//timer variables

// user setted and "turn on" values
int default_Sec=03;
int default_Min=00;

// current values
int Sec;
int Min;

//timer interrupt

ISR(TIMER1_OVF_vect) {
Sec--; // timer values decreases
TCNT1=0x0BDC;
  
}


// functions to display digits



void digit0 () {
// for 0 needed to turn ON F A B C D E segments, so:

digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, HIGH);

//////////////////////// G segment should be turn OFF
digitalWrite(G, LOW);



};



void digit1 () {


digitalWrite(A,LOW);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
};

void digit2 () {


digitalWrite(A,HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
};


void digit3 () {


digitalWrite(A,HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
};

void digit4 () {


digitalWrite(A,LOW);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
};

void digit5 () {


digitalWrite(A,HIGH);
digitalWrite(B, LOW);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, LOW); 
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
};

void digit6 () {


digitalWrite(A,HIGH);
digitalWrite(B, LOW);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH); 
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
};

void digit7 () {


digitalWrite(A,HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW); 
digitalWrite(F, LOW);
digitalWrite(G, LOW);
};


void digit8 () {


digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);



};

void digit9 () {


digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);



};

second half of the code

//function to display digit from inputed int

void showdigit (int digit)

{
  
 switch (digit) {
 
 case 0:
 digit0 ();
 break;
 
 case 1:
 digit1 ();
 break;
 
 case 2:
 digit2 ();
 break;
 
 case 3:
 digit3 ();
 break;
 
 case 4:
 digit4 ();
 break;
 
 case 5:
 digit5 ();
 break;
 
 case 6:
 digit6 ();
 break;
 
 case 7:
 digit7 ();
 break;
 
 case 8:
 digit8 ();
 break;
 
 case 9:
 digit9 ();
 break;
 
 default:

 
 
 break;
 
 
 
 }; 

};


// showing 4 digits
//  not only shows 4 digit number, but also there is option to turn on
//only selected digits and decimal point.

void showdigits (int number, char digit_on, char  decimal_point) 
{

  

digitalWrite(GND4, LOW);
  // e.g. we have "1234"
showdigit(number/1000);  // segments are set to display "1"
if (decimal_point&8) {digitalWrite(DP, HIGH);} else {digitalWrite(DP, LOW);};
 if (digit_on&8) {
digitalWrite(GND1, HIGH); // first digit on,
digitalWrite(GND2, LOW); // other off
digitalWrite(GND3, LOW);
 }
 delay (1);


number = number%1000;  // remainder of 1234/1000 is 234
digitalWrite(GND1, LOW); // first digit is off
 showdigit(number/100); //// segments are set to display "2"
if (decimal_point&4) {digitalWrite(DP, HIGH);} else {digitalWrite(DP, LOW);};
 if (digit_on&4) {
digitalWrite(GND2, HIGH); // second digit is on
  } delay (1);// and so on....
 
number =number%100;    
digitalWrite(GND2, LOW);
showdigit(number/10);
if (decimal_point&2) {digitalWrite(DP, HIGH);} else {digitalWrite(DP, LOW);};
 if (digit_on&2) {
digitalWrite(GND3, HIGH);
 }
 delay (1);

number =number%10; 
digitalWrite(GND3, LOW);
showdigit(number); 
if (decimal_point&1) {digitalWrite(DP, HIGH);} else {digitalWrite(DP, LOW);};
 if (digit_on&1) {
digitalWrite(GND4, HIGH); 
  }
  delay (1);

}; 

void setup()


{
  

 
  
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
pinMode(E, OUTPUT);
pinMode(F, OUTPUT);
pinMode(G, OUTPUT);
pinMode(DP, OUTPUT);

pinMode(GND1, OUTPUT);
pinMode(GND2, OUTPUT);
pinMode(GND3, OUTPUT);
pinMode(GND4, OUTPUT);


pinMode(Button_start, INPUT);
digitalWrite(Button_start, HIGH); //pull up resistor

pinMode(Button_set, INPUT);
digitalWrite(Button_set, HIGH); //pull up resistor

pinMode(Buzzer, OUTPUT);
pinMode(LED, OUTPUT);

TIMSK1=0x01; // enabled global and timer overflow interrupt;
TCCR1A = 0x00; // normal operation 148 page (mode0);

TCNT1=0x0BDC;

TCCR1B = 0x00; // stop hardware timer

// loading default timer values

Sec = default_Sec ; 
Min = default_Min ;



};
void loop ()

{
 //////////// button_start////////// 
  if (!digitalRead(Button_start)&&!b) {
  
  if (!set_mode) { if (run) {TCCR1B=0x00; run=0;} else {TCCR1B=0x04; run=1;}}
  
  if (set_mode==1) {Min++;} 
  
   if (set_mode==2) {Sec++;} 
      
   if (set_mode) {b=25;} else b=100;
  
         };
         
 if (!digitalRead(Button_start)&&b==1) {
     
        };       


if (!b==0) b--;

 //////////// button_set///////// 
 if (!digitalRead(Button_set)&&!c) {
  
   if(!run&&!set_mode) {Min=default_Min; Sec=default_Sec;}
            
  if (set_mode>0) set_mode++;
  
  if (set_mode==3) {set_mode=0;  default_Sec = Sec ;
default_Min = Min; }
  
   c=100;      };   
   
 if (!digitalRead(Button_set)&&c==1&&!run) {
   
     set_mode=1;
     
     c=100;
   
        };       


if (!c==0) c--;
////////////////////////////

if (set_mode) {if (Sec==60) {Sec=00;} 

 if (Min==100) {Min=0;} }

      
       else {
 
 if (Sec==-1) {Min--;Sec=59;} 
 
 }  
 
 
//decimal point indication control 

if (!set_mode) {
  
  
  if (!(Sec%2)) { showdigits (Min*100+Sec,0x0F,0x04); } //0X00

else  {showdigits (Min*100+Sec,0x0F,0x00); }; //0000

} else {
  
  if (set_mode==1) {
  
  showdigits (Min*100+Sec,0x0F,0x0C);   //XX00
                                } else { 
                     
                     
                     
                     showdigits (Min*100+Sec,0x0F,0x03);      } //00XX

}
if (run) {  // to do while timer is running; e.g. control relay 

digitalWrite(LED, HIGH);


} else digitalWrite(LED, LOW);



if ((Min==0)&&(Sec==0)&&run) {
run=0;
TCCR1B=0x00; //stop timer

//// to do after count down is finished e.g. start alarm as in this example


alarm=1;
d=100;

}

// Alarm part
if (alarm) { if (!(d%100)) {  ;

  for (int thisNote = 0; thisNote < 8; thisNote++) {
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
digitalWrite(GND1, HIGH);
digitalWrite(GND2, HIGH);
digitalWrite(GND3, HIGH);
digitalWrite(GND4, HIGH);


    // to calculate the note duration, take one second divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000 / noteDurations[thisNote];
    tone(Buzzer, melody[thisNote], noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(Buzzer);
  } }
  d--; 
  if (d==0) {alarm=0; Sec = default_Sec ;
  Min = default_Min ; // After alarm is off, timer goes to start
          }
    }  
  
};

hope this helps

circut design detail.pdf (95.1 KB)

Your more simple schematic does not make much sense to me. The transistor symbols are not correct and I cannot tell which is the collector and which is the emitter. I do not understand the purpose of the second transistor. I do not understand how you will multiplex with this circuit. Normally it is necessary to have transistors on the anode side and the cathode side when multiplexing.

For your code, you have tried to put too many things into the sketch at once. You should develop small sketches to get each part working separately, then combine the sketches. So please remove from your sketch every part that is not for multiplexing the display, and post that.

Hi Paul

The reason you might not understand is because my work might be completely wrong. i'm not sure of the correct way to use the transistors for what i need them to do.

I have made a working timer circuit with code that works. that is all fine. all I am having trouble with is now making that same peace of hardware work with a Higher voltage display

diagram

so instead of these display's a small single LED. I need a high powered LED strip

something i was looking at using are CMOS devices
is that something i could use to just switch the single from my Arduino to trigger and 24v system then back of again?

mosfet

Thanks

I am currently working on a 4-digit 7-segment display made from 12V led strips, 6 LEDs per segment. My display will not be multiplexed. Each digit will be driven by a tpic6b595 chip.

Right this sounds like what i need to do

how versatile is the Tpic6b595, can it control each part of the segment display so that in there you can display shapes as well as numbers? can i count up as well as down?

Yes, you will have individual control over each segment. Tpic6b595 is very much the same as 74hc595 shift register, but with MOSFETs built in to the chip. Each channel can sink up to 150mA and up to 50V, which should be more than enough for your segments.

BRILLIANT! :smiley:

I've just ordered 4 new ones. do you know of some good websites I can read to learn more about them, something simple and easy for beginners to read would be preferred.

also I would really appreciate it if I can have a look at the code you will be using for project, as I guess I will be changing mine to communicate with the Tpic6b595, or possible we could work on something together?

Yes, we can work together. The code will be simple. You can look for circuits driving 7-seg displays using 74hc595 to understand the principles. Do not be concerned about multiplexing, simply circuits in which one 74hc595 drives each digit.

Hi mate

i've been having a look this weekend and found this potential set up for a circuit.

Just wondering, do you think we would be better to run each SER IN pin on the TPIC6596
from its own data pin on the Arduino rather then running them in a daisy chain as shown ?

Circuit

Have you found anything better?

Just wondering, do you think we would be better to run each SER IN pin on the TPIC6596
from its own data pin on the Arduino rather then running them in a daisy chain as shown ?

This is an instructables article, and they are nearly always crap. Two things about this one is :-

  1. This is not multiplexing. So that shows you how much the author dosn't know.
  2. There is no decoupling capacitors on any of the shift register, so it will be unreliable.

Just wondering, do you think we would be better to run each SER IN pin on the TPIC6596
from its own data pin on the Arduino rather then running them in a daisy chain as shown ?

You don't gain a lot and it makes the software more complicated.

Have you found anything better?

Anything without instructables in the URL stands a 50% chance of being better.

This is a standard multiplexing circuit for common cathode displays.
seven seg bus.png

For common anode displays use PNP transistors or P-channel FETs.

For a voltage greater than 5V you have to drive the PNP transistor with an NPN one.

Hi Mike

So i'm using 24V LED strip, how would that curcit look?

For a voltage greater than 5V you have to drive the PNP transistor with an NPN one

I don't know what that looks like either

The instructable you found is interesting because the author gives lots of great and very sensible advice, such as buying common anode displays, or advantages and limitations of various types of shift register. And yet in other respects he clearly hasn't much idea of what he is talking about. As Mike pointed out, he does not seem to understand what multiplexing is, and his observations on Charlieplexing are just plain wrong.

The problem with Instructables is that the moderators are very strict and don't allow any criticism of the articles posted, even when those articles are dumb, or wrong, or even verging on dangerous.