Small dim light from a turn off Led?

Hey all.

I have sat up a circuit for some multiplexing test.

The circuit is almost identical to this http://www.arduino.cc/en/Tutorial/ShiftOut

Except that I have two rows of 8 leds, and I have two C2120 transistors to pull them to ground.

Every 16 leds have a 280 Ohm resistor, and the power rail for the HC74595 register have a 47uF and a 1uF capacitor. I have also added a 1uF capacitor at the latchpin as suggested in the turorial.

My arduino is hooked op to a 9V battery and I have a voltage regulator giving the circuit 5V through the V1n from the arduino.

My code is below and everything is working. BUT...

When i was going to disconnect the circuit I pulled out the battery first and then the USB, I noticed that my circuit worked without the power from the battery. I googled and found this answer:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235359544

Anotherthing about my circuit is, if I turn the MSB on in the first row and the LSB on the second row, like this

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

You can se that:

1 0 0 0 0 0 0 x x 0 0 0 0 0 0 1

The leds, where I have places the x, is turned on just a little bit. Not much, but just enough to see. I measured around 0,65V over the x Leds.

So my question is: Is my HC74595 damage because I unplug the battery first (2 -3 times) as it says it can be, in the discussion in link 2 - or is my transistors not switching fast enough or my IC not switching fast enough?

Hope all this make sense.

Thanks in advance

// Shh

My code:

//two layer
int layer0 = 2;
int layer1 = 3;


byte data0 = B11100000;
byte data1 = B00000111;

const int dataPin = 11;
const int clockPin = 12;
const int latchPin = 8;

int layerDelay = 5;

void setup()
{
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(layer0, OUTPUT);
  pinMode(layer1, OUTPUT);
}

void loop()
{
  registerWrite(data0);
  digitalWrite(layer0, HIGH);
  delay(layerDelay);
  registerWrite(data1);
  digitalWrite(layer0, LOW);
  
  digitalWrite(layer1, HIGH);
  delay(layerDelay);
  digitalWrite(layer1, LOW);
}

void registerWrite(byte dataOut)
{
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, dataOut);
  digitalWrite(latchPin, HIGH);
}

I have also added a 1uF capacitor at the latchpin as suggested in the turorial.

Disconnect that immediately it is wrong and potentially can damage your arduino. They rearly should change that tutorial.

It is a bit hard to follow what you have, can you post a schematic please.

Hey.

The 1uF cap is remove from the latchpin now. I was just following the toturial.

I have downloadet Eagle and made an ugly drawing of my circuit. But, this is my first time using eagle so I have no idea if it is going to make sense.

The 5 wires with just a green dot is the connection to the arduino.

Hope this help.

http://dl.dropbox.com/u/1777161/Sk%C3%A6rmbillede%202011-07-31%20kl.%2013.22.17.png

Hope this help.

Yes thanks I can see what you are doing. First off you need some resistors in the base of those transistors, 1K to 10K will do. This limits the current the arduino feeds into them to a safe level.

As to your problem, I can't see why the two end ones should be on dimly if it is wired up like you show.

Is my HC74595 damage because I unplug the battery first

No I would say not. It might be that there is some oscillation on the chip so a 0.1uF from power to ground as close to the shift register chip.

I think I spotted something in the software. You are turning on layer 1 before you have clocked the data into the shift register. Try this in the loop:-

void loop()
{
  registerWrite(data0);
  digitalWrite(layer0, HIGH);
  delay(layerDelay);
  digitalWrite(layer0, LOW);

  registerWrite(data1); 
  digitalWrite(layer1, HIGH);
  delay(layerDelay);
  digitalWrite(layer1, LOW);
}

Hi, tha K’s for The help! I do have a 1k resistor between The transistor and The arduino, I just forfor to put it on The drawing.

The circuit is running perfectly now, and more important, I learned slot :wink: