LED Sign using HCF4094 and ULN2003A

Hello,
I now have two LED signs that are roughly 4 ft long that are missing their control keyboard. I'm trying to 'hack' these signs to slide in an Arduino Uno to control them. Since I'm pretty new to electronics, I'm starting by replicating the circuits that I have to work with inside the LED signs.

These signs have four panels. Each panel has 48 LEDs columns, and 14 LEDs rows (they are grouped in quads). This sign uses HSC4094 Shift Registers, and ULN2003A Darlington Arrays. I'm trying to use the power supply that came with the signs, which is providing 20 volts. There is also a TIP42C transistor that is pulling to ground. There is a 100 Ohm resistor between the ULN2003 and the bank of LEDs.

For my initial plan, I'm hoping to just light one LED; and, build up from there. While attempting this before, I crashed/burned/got really frustrated, as I didn't understand what needed to be done, but I'm thinking that I was taking on too much at once. I studied Grumpy_Mike's LED pages, I'm hoping that a fresh start and starting small will help!!

Since I will openly admit that I do not understand all of this, I'm hoping that someone might look at my really rough sketch... and tell me if I have things wired up right so far? I have not applied power yet, as I do not want to burn up the Arduino!!

Here is a link to the scan of my initial sketch: https://plus.google.com/109235379059492734779/posts/ToJLePfFwoi

Thank you very much for your time and input! (please don't beat me up too bad!!).

Bryan

Post a hardware schematic also.

I'm not sure what that is :frowning: ... can you give me more information, and I'll make it happen!!

Here is a link to some photos and some of my 'ugly' days of trying to get this to work...
https://plus.google.com/109235379059492734779/posts/J7tjcyjcsbf

Thanks!
Bryan

You don't know what a schematic is? That's the name given to the drawing that will show how all your components connect together.
An example created in Eagle for a 12 shift register board:

Sorry, I guess I didn't understand what a hardware schematic was.

I will draw something up in a cad system that is similar to what you have.

Thank you for your time and clarification!

Bryan

Why not use a schematic capture tool?
www.expresspcb.com is easy to figure out & use.

Alright, I used ExpressPCB, and this is what I have:

I'm only trying to light one light for now, so there is not a whole lot to it. The reason I'm using the components that I am, is because they match the LED board that I'm eventually trying to get to work with the arduino. Sorry for being so new to this stuff.

I really appreciate your time, and knowledge!!

Bryan

Ok, next time, use Reply, then Additional Options, Browse to your file and Attach it.
As drawn that will not work. ULN2003 is a current sink, not a current source.
You're going to need a setup more like this, with PNPs providing current to rows, and ULN2003s or ULN2803s sinking current from columns.

LEDmuxing.sch (35.3 KB)

HSC4094, HCF4094: probably better off using 74HC595 in their place instead of the older obsolete parts. Can use TPIC6B595 in place of shift register/ULN2003 combo also.

You'll have to figure out how the existing LEDs are connected so you drive them appropriately.

Cool... I will try to setup my breadboard to match your suggestion.

Unfortunately, I'm kinda stuck with the HCF4094, as it is soldered on to the LED board that I'm trying to tie into. All of the parts that I'm using are a part of that original LED board. As I'm not experienced enough to change these components out, I'm hoping to just tap in.

Thank you again, and I'll try this!

Bryan

Thank you for the information on Sinking vs Sourcing. That cleared up a lot of confusion I was having regarding the flow of power!

Another question... as always... I'm wondering if I can drive the transistors (PNP TIP42C) with directly from the Arduino, or if it is better to use the shift register. I ask this, because when the four boards of the LED panel come together, I'm unsure if I need to have four shift registers, or just one to drive the seven transistors for the seven rows? I'm pretty sure that doesn't make sense... but not sure how else to explain it. Frustrating being new to this stuff (just wish I would have taken more micro-electronic classes in college).

Thank you again for your time, input, and knowledge!! I really appreciate all that you have given me so far!!

Bryan

I'm wondering if I can drive the transistors (PNP TIP42C) with directly from the Arduino,

Yes.

Well, you will never believe this... but, IT WORKS!

Someone up above must be looking down upon me at the moment, but : LED test - YouTube

it actually lights the LED!

Thank you guys so much for your time and input! The worst part is, I actually kinda understand why it works (SCARY!).

Nothing is hot, so I'm assuming that I have it wired correctly. Now I just need to figure out how to get it to work for 2700 LEDs! :relaxed:

I'll be back, I'm positive!

Thanks again for your time and input!! I really appreciate it!!

Bryan

Alright, I need help again. This time it is with code. I will attach the PDF of what my board looks like drawn in ExpressPCB.

Here is my code so far. The tP1/tP2/tP3/tP4 are my transistor pins. I'm only running 4x4 of my 8x8 LED block. This will shift down the row. My goal now is to isolate a single LED to light up. I'm not sure how to time the column and row so that this happens :~

int latchPin = 12;
int clockPin = 11;
int dataPin = 13;
int tP1 = 1;
int tP2 = 2;
int tP3 = 3;
int tP4 = 4;


void setup() {
	pinMode(latchPin, OUTPUT);
	pinMode(clockPin, OUTPUT);
	pinMode(dataPin, OUTPUT);
        pinMode(tP1, OUTPUT);
        pinMode(tP2, OUTPUT);
        pinMode(tP3, OUTPUT);
        pinMode(tP4, OUTPUT);
        digitalWrite (tP1, LOW);
        digitalWrite (tP2, LOW);
        digitalWrite (tP3, LOW);
        digitalWrite (tP4, LOW);
                                
        digitalWrite(latchPin, LOW); //make sure data isn't latched
	}
void loop() {
	unsigned int outputpattern =0xff; //stores the output pattern as an unsigned int, that is, two bytes
	int pattern_LSB; //the least significant byte (LSB) of the pattern
	int pattern_MSB; //the most significant byte (MSB) of the pattern
	for (int i=0 ; i< 16; i++){
		pattern_MSB = outputpattern >>8; //extract the MSB of the pattern by shifting all the bits over by 8
		pattern_LSB = outputpattern & 0x0f; //extract the LSB of the pattern by bitwise AND
		shiftOut(dataPin, clockPin, MSBFIRST, (byte) pattern_MSB);
		shiftOut(dataPin, clockPin, MSBFIRST, (byte) pattern_LSB);
		digitalWrite(latchPin, 1); // flick the latch to put the data on the output pins
		delay(100);
		digitalWrite(latchPin, 0);
		delay(100);
		outputpattern = outputpattern <<1; // shift the outputpattern left by one bit
	}
}

Can anyone give me some insight??

Thank you, in advance!!!

Bryan

ExpressPCB.pdf (20.2 KB)

Note: this turns all the PNPs on at once:
digitalWrite (tP1, LOW);
digitalWrite (tP2, LOW);
digitalWrite (tP3, LOW);
digitalWrite (tP4, LOW);

That's the fun of multiplexing.
As drawn, you would drive the 5 PNP transistors, and turn on one output of the ULN2003. Let that sit for a mS, turn off the ULN2003, send the next column's worth of data, let it sit for a mS, etc. Repeat until all the columns were turned on one at a time, then repeat.
Have the data in an array, and have the shift register data in an array.
If the PNP drives were all in port, that makes it easy:

// time for an update? use blink without delay to check
columnCount = columnCount +1;
if (columnCount == 6){ // assume 0-1-2-3-4-5 are columns
columnCount = 0;
}

digitalWrite(ss4094, LOW);
SPI.transfer(0); // turn off all cathodes
digitalWrite(ss4094, HIGH);

PORTD = dataArray[columnCount];  // maybe fancier so D0, D1 not impacted if Serial is in use

digitalWrite(ss4094, LOW);
SPI.transfer(cathodeArray[columnCount]); // turn on next cathode
digitalWrite(ss4094, HIGH);


with cathodeArray[] = {0b00000001, 0b00000010, 0b00000100, 0b00001000, 0b00010000, 0b00100000,};
so only 1 output at a time is turned on

Hello,

I have my sign starting to work. I just have a row at the moment that scans from top to bottom, or I can reverse it.

I'm just having an issue with driving the transistors. I'm using TIP42C - PNP to supply positive voltage (I have it reduced down to 6 volts). The transistors work! I have a 100ohm resistor between the base and the arduino. But, the arduino or my code is not playing nice. Whether I change the pin from high or to low, current still flows. If I pull the base, current stops. If I reconnect it, current turns back on. But, my code/Arduino is not doing this :frowning:

I'm pretty confident that it is my code that is causing this failure. This is what I have so far!

Can anyone help me?

Thanks!!
Bryan

int DATA = 12;
int CLOCK = 11;
int LATCH = 13;
int COUNTER = 0;
int T1PIN = 2;
int T2PIN = 4;
int T3PIN = 5;
int T4PIN = 6;
int T5PIN = 7;
int T6PIN = 8;
int T7PIN = 9;


void setup ()
{  
 pinMode (DATA, OUTPUT);
 pinMode (CLOCK, OUTPUT);
 pinMode (LATCH, OUTPUT); 
 pinMode (T1PIN, OUTPUT); 
 pinMode (T2PIN, OUTPUT);
 pinMode (T3PIN, OUTPUT);
 pinMode (T4PIN, OUTPUT);
 pinMode (T5PIN, OUTPUT);
 pinMode (T6PIN, OUTPUT);
 pinMode (T7PIN, OUTPUT);
 digitalWrite (T1PIN, HIGH);
 digitalWrite (T2PIN, HIGH);
 digitalWrite (T3PIN, HIGH);
 digitalWrite (T4PIN, LOW);
 digitalWrite (T5PIN, LOW);
 digitalWrite (T6PIN, LOW);
 digitalWrite (T7PIN, LOW);
}//end setup

void loop ()
{
  if (COUNTER == 0)    
    shiftOut(DATA, CLOCK, MSBFIRST, 0);
  else if (COUNTER == 1)
      shiftOut(DATA, CLOCK, MSBFIRST, 1);
  else if (COUNTER == 2)
      shiftOut(DATA, CLOCK, MSBFIRST, 2);
  else if (COUNTER == 3)
      shiftOut(DATA, CLOCK, MSBFIRST, 4);  
  else if (COUNTER == 4)
      shiftOut(DATA, CLOCK, MSBFIRST, 8);  
  else if (COUNTER == 5)
      shiftOut(DATA, CLOCK, MSBFIRST, 16);
  else if (COUNTER == 6)
      shiftOut(DATA, CLOCK, MSBFIRST, 32);
  else if (COUNTER == 7)
      shiftOut(DATA, CLOCK, MSBFIRST, 64);      
  //end if
  if (COUNTER == 7)
    COUNTER = 0;
  
  COUNTER++;  
  digitalWrite(LATCH, HIGH);
//  delay(1);
  digitalWrite(LATCH, LOW);
  delay(100);
}//end loop

I think I solved this. The voltage going into the system was higher the the arduino voltage. So, I put a resistor in-between the positive of the source and the board. This cut my voltage down to 4.5v. Everything seems to be working now.

Just have to code patterns now! :~

Thank you for your continued help!!

Bryan

Sounds like you're progressing nicely. Good luck with the patterns
Be sure to store them in progmem so you don't run yourself out of SRAM.

The voltage going into the system was higher the the arduino voltage. So, I put a resistor in-between the positive of the source and the board. This cut my voltage down to 4.5v.

Can you post a schematic of this? It sounds dubious.

Sure. Here is the latest print and code. I ended up skipping Pin 3 on my arduino, as it was not behaving properly. Thank you all, for your insight, time, and everything else. As I am still learning my way through this, I really appreciate your experience!!

Bryan

int DATA = 12;
int CLOCK = 11;
int LATCH = 13;
int COUNTER = 0;
int SWITCH = 0;
int ROW = 0;
int T1PIN = 2;
int T2PIN = 4;
int T3PIN = 5;
int T4PIN = 6;
int T5PIN = 7;
int T6PIN = 8;
int T7PIN = 9;


void setup ()
{  
 pinMode (DATA, OUTPUT);
 pinMode (CLOCK, OUTPUT);
 pinMode (LATCH, OUTPUT); 
 pinMode (T1PIN, OUTPUT); 
 pinMode (T2PIN, OUTPUT);
 pinMode (T3PIN, OUTPUT);
 pinMode (T4PIN, OUTPUT);
 pinMode (T5PIN, OUTPUT);
 pinMode (T6PIN, OUTPUT);
 pinMode (T7PIN, OUTPUT);
 digitalWrite (T1PIN, HIGH);
 digitalWrite (T2PIN, HIGH);
 digitalWrite (T3PIN, HIGH);
 digitalWrite (T4PIN, HIGH);
 digitalWrite (T5PIN, HIGH);
 digitalWrite (T6PIN, HIGH);
 digitalWrite (T7PIN, HIGH);
 Serial.begin(9600);
}//end setup

void loop ()
{
    for (int i = 1; i <= 7; i++)
    {
      if (i == 1)  
        digitalWrite (T1PIN, LOW);
      else if (i == 2)
        digitalWrite (T2PIN, LOW);
      else if (i == 3)
        digitalWrite (T3PIN, LOW);
      else if (i == 4)
        digitalWrite (T4PIN, LOW);
      else if (i == 5)
        digitalWrite (T5PIN, LOW);
      else if (i == 6)
        digitalWrite (T6PIN, LOW);
      else if (i == 7)
        digitalWrite (T7PIN, LOW);
      
      for (int j = 1; j <= 7; j++)
      {
        
        if (j == 1)
          shiftOut(DATA, CLOCK, MSBFIRST, 1);
        else if (j == 2)
          shiftOut(DATA, CLOCK, MSBFIRST, 2);        
        else if (j == 3)
          shiftOut(DATA, CLOCK, MSBFIRST, 4);        
        else if (j == 4)
          shiftOut(DATA, CLOCK, MSBFIRST, 8);        
        else if (j == 5)
          shiftOut(DATA, CLOCK, MSBFIRST, 16);        
        else if (j == 6)
          shiftOut(DATA, CLOCK, MSBFIRST, 32);        
        else if (j == 7)        
          shiftOut(DATA, CLOCK, MSBFIRST, 64);   
        
        digitalWrite (LATCH, HIGH);
        delay(100);
        digitalWrite (LATCH, LOW);          
      }//next 
    
    
    
    
    if (i == 1)  
        digitalWrite (T1PIN, HIGH);
      else if (i == 2)
        digitalWrite (T2PIN, HIGH);
      else if (i == 3)
        digitalWrite (T3PIN, HIGH);
      else if (i == 4)
        digitalWrite (T4PIN, HIGH);
      else if (i == 5)
        digitalWrite (T5PIN, HIGH);
      else if (i == 6)
        digitalWrite (T6PIN, HIGH);
      else if (i == 7)
        digitalWrite (T7PIN, HIGH);
    }//next
        
        
        
}//end loop

ExpressPCB.pdf (38.1 KB)