7x6 Bicolor LED using 3 4017?

Hi everyone,

I am currently trying to make a 7x6 LED array with bicolor (3-legged) LEDs. I am just planning to make it programmable (noscrolling, etc.) for making a Connect 4 game.

Here is the current circuit that I made in TinkerCAD. Since TinkerCAD doesn't have any bicolor LED, I am using RGB led for this diagram. (Click for imgur link):

(Link to TinkerCAD)

Since I am planning to add additional 15 buttons (later) and this LED arrangement already need around 19 pins (CMIIW), I am multiplexing this with the help of 3 Johnson decade counter (4017). This is my first time using decade counter, so I don't know much about it yet despite reading tutorials.

If you try to simulate it, you can see that the third row is turned on. That kinda puzzled me. But, I am sure that my circuit design is not right, let alone the code.

Can anyone help me to point out what's wrong and what should I do with the circuit? I would really appreciate your help, thank you so much! :slight_smile:


(If you're wondering about my current code, this is my code):

int cathodeClockPin = 5;
int cathodeResetPin = 4;

int blueClockPin = 3;
int blueResetPin = 2;

int greenClockPin = 7;
int greenResetPin = 6;

void setup()
{
  pinMode(cathodeClockPin, OUTPUT);
  pinMode(blueClockPin, OUTPUT);
  pinMode(greenClockPin, OUTPUT);
  
  pinMode(cathodeResetPin, OUTPUT);
  pinMode(blueResetPin, OUTPUT);
  pinMode(greenResetPin, OUTPUT);
  
  // Reset 4017s
  digitalWrite(cathodeResetPin, HIGH);
  digitalWrite(blueResetPin, HIGH);
  digitalWrite(greenResetPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(cathodeResetPin, LOW);
  digitalWrite(blueResetPin, LOW);
  digitalWrite(greenResetPin, LOW);
}

void clock() 
{
  // Commented out.
  /*
  digitalWrite(cathodeClockPin,HIGH);
  digitalWrite(blueClockPin,HIGH);
  delay(1);
  digitalWrite(cathodeClockPin,LOW);
  digitalWrite(blueClockPin,LOW);
  PORTD=B00000000;
  */
}

void loop()
{
  clock();
  // Delay a little bit to improve simulation performance
  // (Comment from TinkerCAD)
  delay(10); 
}

The first thing I spotted is that power supply for the right hand most 4017 is going through a resistor, it needs to be connected directly, and in the real world each of those chips needs a 0.1uF ceramic across the power and ground pins.

Grumpy_Mike:
The first thing I spotted is that power supply for the right hand most 4017 is going through a resistor, it needs to be connected directly

Is it the leftmost resistor with red cables? It is a 0 Ohm resistor that I use only to manage the cables in the CAD. I've just updated the TinkerCAD to not use it. But, the result is still the same.

Post' image and link were also just updated, thanks!

Grumpy_Mike:
and in the real world each of those chips needs a 0.1uF ceramic across the power and ground pins.

What do you mean by across power and ground pins - where should it be? And why is it needed?

Thank you!

What do you mean by across power and ground pins

One end of the capacitor is on the power, 5V pin of the chip and the other end of the capacitor is on the ground or 0V of the chip.

why is it needed?

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
These things are NOT optional in the real world.

Also why have you got a separate reset pin for each 4017 chip? One Arduino pin to all three chips is all you need.

You need to look at the data sheet for the 4017, you are using the Q0 pin, you don't want to do that, look at the timing diagram in the data sheet. You need to be using Q1 to Q8

The other thing is that you need a source and a sink to light an LED, this would mean inverting the outputs of one of the counters.

I think it is time to go back to the beginning and design it again. Maybe see:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html