Controlling LEDs.....and my destiny....

I started this thread for three reasons:

  1. To give thanks and recognition
  2. To tell my story
    and 3. To ask for help.

I want to give thanks to some of the more knowledgeable posters that keep this community going. I first came here looking for a quick fix like most people. I wanted to make some LED stuff. And, it's taken me about 1 year to realize that there are really no short cuts. I've been lurking a lot and can't help but notice a majority of new threads seem to be along the same line of, "I need a quick answer..." or "How do I do something that requires intermediate knowledge but I don't even know the difference between a series circuit and parallel circuit". I see a lot of people trying to help where possible but ultimately knowing that it's not going to do much because the OP lacks even the basic understanding to comprehend the solution. (NOT that this is everyone. There are so many people here smarter than me. I just see very few threads that go past a couple posts) When I first came here I didn't realize the complexity of what I was trying to do but I was helped as best was possible. I'd like to give a big thank you to those of you that spend your time here trying to help others even when its obvious that they need to do some basic education and research on their own in programming and/or electrical engineering before posting. Thank you. I wish this community had more "repeat" posters and more knowledgeable postings and discussions but, and maybe I'm wrong here, but it seems like most posts are along the lines of: "How do I solve my specific problem and then I'll be on my way". And, that was me, and I'm sorry.

Now my story, I did come here looking for a quick fix. And I got it. And like all quick fixes, it turned out to be not what I wanted. But no fault to anyone who helped me. So, realizing this was going to be harder than I expected, I have buckled down and I've been studying at allaboutcircuits.com methodically going through their stuff. I'm almost done with Volume 1 and all the amazing stuff I have learned about Ohms Law, Kirchoffs Voltage Law, DC Network analysis has been amazing. I have learned A LOT and I am excited to really have an understanding about electronics that makes me want to learn more and get my projects completed right.

So, I ended up with a ton of these parallel in/parallel out shift registers thinking, "hey they're just like the 74HC595s that I see all these tutorials for. Should be a snap to get working, right?" Wrong. Well it wasn't. And there aren't any tutorials out there for using a parallel in/parallel out shift register for controlling LEDs. So I soon found out that I was on my own to solve this problem. I even posted here in a lame attempt to try and have someone solve my problem for me, which went unanswered (unsurprisingly). I was on my own. But, determined to forge ahead, I learned what the datasheet was saying and I figured out how to wire everything up, and finally, one night, I finally was able to get it working. SUCCESS! This created a positive feedback loop and soon I was writing code that was manipulating the LEDs how I see fit. And I can't tell you the sense of accomplishment is truly satisfying. So to anyone who is frustrated or feeling hopeless, don't give up. You can do it. There is a solution. But, I encourage you to seek out the answer or the base knowledge to know the answer on your own. The rewards will be much more satisfying.

Schematic Design_ 74ACT299PC - Working Assembly.pdf (63.2 KB)

And now this brings me to where I need help:

I am using these universal parallel in/parallel out shift registers to control RGB LED's.
74ACT299PC 74ACT299PC pdf, 74ACT299PC Description, 74ACT299PC Datasheet, 74ACT299PC view ::: ALLDATASHEET :::

And here is a schematic of how I have everything configured:

I attached the image to save space.

Now when I do simple chase sequences in my prototype assembly, I'm seeing a lot of flickering from the LEDs that are supposed to be off while the sequence is running. My understanding of the operation of the universal shift register is that when using it in the serial in/parallel out mode, the data is shown on the output as soon as it is pushed through each stage on the rising edge of the clock. And since is there is no latch pin to control when to show the LEDs, this would explain what is happening. But, I also thought that it might be decoupling. I haven't gotten to the decoupling part of my studies yet, and if it is, then I'm okay with getting to that part to understand what I need to fix the problem (instead of asking for a quick fix answer that I don't understand). But, if this is the normal function of the universal shift register and I've done everything correct, then I am a bit saddened, because this won't work for my LED applications. And, that's okay because I'm sure I can find an use for them. Just not what I want for right now.

So my questions are: Is what I'm seeing just the normal operation of the universal shift register? There is no latch pin so this is it? Thoughts? Suggestions?

So, here is a video of what I'm seeing:

I've got the LED inside of a ping pong ball and you can see that its flashing with the Red LED very quickly and then you'll see it come on at full light as the sequence runs through the LED. Then I pan over to the other LEDs and you can see the chase sequence working but when the LEDs are off they are flickering pretty strongly.

And here is the code that I've written. I understand that it's not the most elegant code but it works which is good enough for now. I apologize that it's not labeled and commented accordingly.

int datapin = 3;
int clockpin = 4;
int timer = 150;

byte MyArray11a[] = {0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
byte MyArray12a[] = {1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
byte MyArray13a[] = {1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
byte MyArray14a[] = {1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1};
byte MyArray15a[] = {1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1};
byte MyArray16a[] = {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0};
byte MyArray17a[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1};
byte MyArray18a[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1};


void setup(){
  
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  
}


void loop(){

//---------------------------------------Output Array Values 
// The for loop cycles through each value in the 24-value array and sends that data
// to the shift register on the rising edge of the clock. Repeat 24 times then exit
// the for loop and move to the next one.

  for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray11a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
  
 //-------------------------------------Output next array
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray12a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
  
 //-------------------------------------Output next array 
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray13a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
 
 //-------------------------------------Output next array
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray14a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
  
  //-------------------------------------Output next array
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray15a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
  
  //-------------------------------------Output next array
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray16a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
  
  //-------------------------------------Output next array
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray17a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);
  
  //-------------------------------------Output next array
    for(int x = 24; x >= 0; x--){
    
    digitalWrite(datapin, MyArray18a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }
  
  delay(timer);

  
}

Schematic Design_ 74ACT299PC - Working Assembly.pdf (63.2 KB)

When I first came here I didn't realize the complexity of what I was trying to do but I was helped as best was possible. I'd like to give a big thank you to those of you that spend your time here trying to help others even when its obvious that they need to do some basic education and research on their own in programming and/or electrical engineering before posting.

That is an insightful comment. You are right, but that applies to all of us. Sometime we just don't know how complex things are going to get until we attempt them. :slight_smile:

I'll take a look at your actual problem in a minute. It helps to give all the details. :slight_smile:

  for(int x = 24; x >= 0; x--){

    digitalWrite(datapin, MyArray11a[x]);
    digitalWrite(clockpin, HIGH);
    digitalWrite(clockpin, LOW);
  }

Array position 24 does not exist. They are 0 to 23.

Hmmm.....

I have 8 RGB LEDs.

8 RGB LEDs = 24 pins.

On the initial iteration of the for-loop, x = 24.

On each subsequent iteration, x = x - 1.

Until, x >= 0. But since x always will be greater than zero until it equals zero, I guess the "greater than or equal to" could be changed just to an "equal to" no?

Iteration 1: x == 24
Iteration 2: x == 23
Iteration 3: x == 22
.........
Iteration 24: x == 1

On Iteration 25, x == 0. -> exit for-loop

On the initial iteration of the for-loop, x = 24.
On each subsequent iteration, x = x - 1.
Until, x >= 0. But since x always will be greater than zero until it equals zero, I guess the "greater than or equal to" could be changed just to an "equal to" no?

No, you should start at 23. The 24th element is element 23. The first element is 0.

There is no latch pin so this is it?

True but there is an output enable pin. You hold this so the outputs are disabled while you are shifting in the bit pattern and then you enable the outputs, so it sort of acts like a latch.

Grumpy_Mike:

There is no latch pin so this is it?

True but there is an output enable pin. You hold this so the outputs are disabled while you are shifting in the bit pattern and then you enable the outputs, so it sort of acts like a latch.

A HA! I got it. Thank you sir!
:grin: :grin: :grin: :grin: :grin: