1
\$\begingroup\$

I'm trying to build a circuit which uses three 4094's to give me enough outputs to drive a number of LED's. I've built a few similar circuits before in the past using the same code and schematic, but for some reason this time I'm having problems controlling the shift registers.

The first 4094 is connected to my Arduino UNO using the following outputs:

CD4094_CLOCK  - Digital 2
CD4094_DATA   - Digital 3
CD4094_STROBE - Digital 4

For the sake of testing I've connected the 4094 OEs to +5V, but they will be on a PWM pin in reality. I've connected all the 4094 STROBE and CLOCK inputs as I've done previously, too.

I'm using the following program, however no matter what value I shiftOut to the 4094's most of the outputs stay high:

// CD4094 Constants
#define CD4094_CLOCK    2
#define CD4094_DATA     3
#define CD4094_STROBE   4
//#define CD4094_OE     3

char Display1 = 0, Display2 = 0, Display3 = 0;

void setup() {
    pinMode(CD4094_CLOCK, OUTPUT);
    pinMode(CD4094_STROBE, OUTPUT);
    pinMode(CD4094_DATA, OUTPUT);
    //pinMode(CD4094_OE, OUTPUT);
}

void loop() {
    Display1 = 63;
    Display2 = 6;
    Display3 = 91;

    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display3);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display2);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display1);

    digitalWrite(CD4094_STROBE, HIGH);
    digitalWrite(CD4094_STROBE, LOW);

    delay(3000);

    Display1 = 0;
    Display2 = 0;
    Display3 = 0;

    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display3);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display2);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display1);

    digitalWrite(CD4094_STROBE, HIGH);
    digitalWrite(CD4094_STROBE, LOW);

    delay(3000);
}

Here's a picture of my breadboard too, in case it could help someone?

Breadboard

Does anyone have any suggestions on how I can debug this sort of issue? The only tools I have are my multimeter and Arduino boards. Is there some kind of problem with my code?

\$\endgroup\$
4
  • \$\begingroup\$ You haven't connected the data-output (QSn) of one shift-register, to the data-input (D) of the next shift-register \$\endgroup\$
    – Gerben
    Jun 7, 2014 at 16:52
  • \$\begingroup\$ It also looks like pin 2 is connected to the Data-in, while the code says it should be pin 3. \$\endgroup\$
    – Gerben
    Jun 7, 2014 at 16:54
  • \$\begingroup\$ Forgot the QS connections - thanks! I've moved the outputs for the first 4094 now, CLOCK is on D0, DATA is on D1 and STROBE is on D2 - thanks for pointing that one out too. I've updated my constants accordingly, now when I run the program all my 4094 outputs remain high. \$\endgroup\$
    – edcs
    Jun 7, 2014 at 17:08
  • \$\begingroup\$ Could you update your question with this new data and a new picture? I can't quite follow what you've changed. Also, try to avoid D0 and D1 as they are used for serial/UART, and I think have pull-ups on the Uno board. \$\endgroup\$
    – Gerben
    Jun 7, 2014 at 19:22

2 Answers 2

2
\$\begingroup\$

The strobe signal is configured as output but never initialized as high. The code you provided just flicks it high for a moment then holds it low during transmission. If I understand the datasheet correctly, the strobe must be held high during your data transmission

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thanks for solving the problem! I've changed my code so that strobe is high during shiftOut and I'm getting the expected results :) \$\endgroup\$
    – edcs
    Jun 8, 2014 at 18:13
0
\$\begingroup\$
// CD4094 Constants
#define CD4094_CLOCK    18
#define CD4094_DATA     19
#define CD4094_STROBE   17
#define CD4094_OE     16

char Display1 = 1, Display2 = 2, Display3 = 3;

void setup() {
    pinMode(CD4094_CLOCK, OUTPUT);
    pinMode(CD4094_STROBE, OUTPUT);
    pinMode(CD4094_DATA, OUTPUT);
    //pinMode(CD4094_OE, OUTPUT);
}

void loop() {
    Display1 = 63, 6, 91, 79, 102, 109, 125, 7, 127, 111;
    Display2 = 63, 6, 91, 79, 102, 109, 125, 7, 127, 111;
    Display3 = 63, 6, 91, 79, 102, 109, 125, 7, 127, 111;

    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display3);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display2);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display1);

    digitalWrite(CD4094_STROBE, HIGH);
    digitalWrite(CD4094_STROBE, LOW);

    delay(3000);
    Display1 = 0;
    Display2 = 0;
    Display3 = 0;

    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display3);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display2);
    shiftOut(CD4094_DATA, CD4094_CLOCK, MSBFIRST, Display1);

   digitalWrite(CD4094_STROBE, HIGH);
   digitalWrite(CD4094_STROBE, LOW);
   delay(30);
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.