Circuit doesn't power off after disconnecting it's power supply

Hi, lately I've been experimenting some with my newly purchased Arduino. I think that I've managed to get pretty good understanding of how electronic circuits work.

This time though I am very confused about an issue I'm facing and can't seem to come upon any explanation to why my circuit behaves in the following way:

I have a simple circuit that is supposed to probe temperature every 2s and display it on a 4 digit 7 segment display. It's a common anode display, so I am multiplexing power to the leds from 3 arduino pins (3,4,5 on my schematic). I'm also using a shift register to sink current from the 7 cathodes.
Everything is connected nicely on a breadboard, but today while experimenting I disconnected power supply from the breadboard and was very surprised to see that the circuit kept running. It basically doesn't react upon me pulling the 5v cable, when i disconnect GND it still keeps on running although the leds lose some brightness.

My understanding is that 5v is getting supplied from one of the pins I'm multiplexing as all three are never off simultaneously. What I cannot grasp though is what sinks the current. My anodes are behind leds which are supposed to be semi conductors? So after ruling these out all that is left are my 3 pins that communicate with the shift register (latch, clock and serial). When set as LOW I believe they are the same as GND? But is it really possible that the shift register allows reverse currents through it's serial pins?

I understand that my board design isn't the best, I maybe should have used some transistors here and there to prevent this, but most of all I'd like to know why this is happening so that I can avoid this in the future (as I doubt that this is normal behavior??)

Thanks!

Everything is connected nicely on a breadboard, but today while experimenting I disconnected power supply from the breadboard and was very surprised to see that the circuit kept running.

So are you saying that you remove all power and it keeps on running?
You have either invented perpetual motion, or you are not describing your setup fully enough.

That is exactly what happens - I disconnect the 5v and gnd cables that power the power supply rows of the breadboard (leftmost on the breadboard drawing).

Apart from that I have a light sensor and a thermometre, but these are powered through the power supply rows on the breadboard and they only communicate with my arduino through analog pins (each probing voltage).

There is nothing else - it's a pretty simple setup. I can take pictures if needed, but my fritzing drawing is pretty accurate.

I think what you mean is that you're disconnecting the 5v output from the arduini to the power rail on your breadboard?

In which case, that's very very different to 'removing all power'. :stuck_out_tongue_winking_eye:

Regarding why it stays on though, the circuit must simply be drawing current from one of your pins (whichever is logic high at the time).
I would take care that the current draw is not exceeding the maximum draw for each of the arduino pins (which if I recall correctly is around 40mA).
I'm no expert in this, but those are my observations.

Is USB connected to your computer?

Cosford:
I think what you mean is that you're disconnecting the 5v output from the arduini to the power rail on your breadboard?

In which case, that's very very different to 'removing all power'. :stuck_out_tongue_winking_eye:

You're right, I probably wasn't clear enough on that. I'm not trying to power off the arduino itself, I just noticed weird behavior of the circuit on my breadboard after pulling 5v and gnd cables from the power rail.

It seems like it keeps getting power through the serial pins of 74HC595 and that I don't really understand.

When one part of the circuit is powered up, it can provide "parasitic power" to the Arduino through input or output pins connecting the two. This happens often and is rarely a good thing, as you can damage the Arduino pin circuitry. My guess is that the power is coming from the display, since it dims.

All CMOS chips have input protection diodes, you are powering the LED via the 595 input
protection diodes and may alrealy have damaged something since the diodes are there to
deal with static electricity, not power whole circuits. Thus the Arduino and its associated
circuitry should be powered together not separately.

MarkT:
All CMOS chips have input protection diodes, you are powering the LED via the 595 input
protection diodes and may alrealy have damaged something since the diodes are there to
deal with static electricity, not power whole circuits. Thus the Arduino and its associated
circuitry should be powered together not separately.

What do you mean by being powered separately? If you look at my schematic everything is (or at least should be) powered from the 5v pin on the arduino board. When I disconnect that pin from my breadboard the circuit I have on my breadboard keeps on running.

Am I wrong to think that the leds in the 7 segment display cannot drain the current (because they are semiconductors and could therefore only possibly supply current to rest of the circuit). So with 5v rail and gnd disconnected from the breadboard it can only be drained by one of three serial inputs that go to the 595. Is this really supposed to happen? The protective diodes that you mention - shouldn't they protect from reversed current through the latch/serial/clock pins?

I think that many of you have misunderstood me. I'm trying to understand how this actually is possible and which way the current flows after the power rails + and - are disconnected. Sorry if my explanation earlier was a little bit messy, I am still new to all this :slight_smile:

gregk:
I think that many of you have misunderstood me. I'm trying to understand how this actually is possible and which way the current flows after the power rails + and - are disconnected. Sorry if my explanation earlier was a little bit messy, I am still new to all this :slight_smile:

No, the problem is that your schematic has some errors in it and you have not explained; when you say you disconnect the power from the Arduino, just what part of your circuit is still connected to some power source? - because if as someone has said, if it keeps operating with no source of power at all, that certainly is something new for science!

Paul__B:
No, the problem is that your schematic has some errors in it and you have not explained; when you say you disconnect the power from the Arduino, just what part of your circuit is still connected to some power source? - because if as someone has said, if it keeps operating with no source of power at all, that certainly is something new for science!

In total 8 cables go from Arduino to the circuit. 2 cables: 5v and gnd connected to power rail -> powering the shift register. The shift register is used to sink current from the 7 segments accordingly to what i want to display. 3 cables go to the common anodes of my 7 segment display ( I only use 3 digits ) - at any time, 1 of these 3 is set to HIGH and the two others to LOW in order to multiplex.
Remaining 3 cables go to my shift register, these are latch/serial/clock and are intermittently set to HIGH/LOW to shift the register.

What I do is disconnect the 2 first mentioned cables from the breadboard (5v and gnd). Intended effect is to simply cut the supply from the breadboard, but to my surprise it doesn't work.

I am not saying that there is no source of power, only that there is none that is intended. Therefore I try to understand how to fix this. I have never seen anyone running serial/latch/clock to the 595 through diodes and that is the only solution I can come up with? Is my 595 defect or something?

Apart from that I have a light sensor and a thermometre, but these are powered through the power supply rows on the breadboard and they only communicate with my arduino through analog pins (each probing voltage).

There is your power source, as mentioned through the ESD protection diodes in the IC.

That is what is meant by powering it all from a single supply. Use one source of power for -everything- connected, the light sensor and thermometer, included.

polymorph:

Apart from that I have a light sensor and a thermometre, but these are powered through the power supply rows on the breadboard and they only communicate with my arduino through analog pins (each probing voltage).

There is your power source, as mentioned through the ESD protection diodes in the IC.

That is what is meant by powering it all from a single supply. Use one source of power for -everything- connected, the light sensor and thermometer, included.

No, that's not true. The Arduino is the only supply of current to the whole circuit. To clarify: what I meant by "power supply rows" on was the power rail which in turn is powered by the 5v pin from arduino. And after that 5v output is removed, everything, even the sensors keep on running.

I've thought some more about it today. 5v must be getting supplied either through one of 595's serial pins or through the display. I believe I could solve the latter by using transistors instead of supplying current directly to the display's digits. On the other hand, I don't actually believe that the display is supplying the current because the only contact it has with the 595 are the Q1-Q7 pins which are supposed to sink the current. So the 595 should stop running due to power loss, but it doesn't.

AND that doesn't solve the other issue. Because there also must be something that is sinking the current, right?. And the only things that can sink current are 595's latch/clock/serial connections while set to LOW (because no reverse current is allowed through the display's LEDs). So my question is, why does this happen and is this intended behavior of the 595?

Also, could someone please elaborate on the input protection diodes in the IC. How would these create a power circuit through the i/o pins connected to the 595 from arduino?

gregk:
Also, could someone please elaborate on the input protection diodes in the IC. How would these create a power circuit through the i/o pins connected to the 595 from Arduino?

The diagram in the post just before yours, showing the protection diodes which are built in to each IC in your circuit, including the 74HC595s as well as the Arduino, is precisely your answer - any input to any IC which is pulled HIGH by whatever means will (to a variable extent) provide power to the positive supply (and a LOW correspondingly to the ground rail) of that IC and whatever else is still connected to that supply terminal.

The "take home message" of this is - you are creating a fault condition that is very likely to cause damage by exceeding the specifications of many devices.

Just - Do not do it! It's bad enough if it happens by accident. If you want to shut down certain functions, design it properly.

The attached diagram might help.

Paul__B:
The diagram in the post just before yours, showing the protection diodes which are built in to each IC in your circuit, including the 74HC595s as well as the Arduino, is precisely your answer - any input to any IC which is pulled HIGH by whatever means will (to a variable extent) provide power to the positive supply (and a LOW correspondingly to the ground rail) of that IC and whatever else is still connected to that supply terminal.

Okay, thanks a lot. I think it all starts to align in my head now.

So every pin on the 595, or any IC whatsoever is connected to its 5v and gnd terminals to be able to take care of eventual static electricity discharges. And it's bad to use that network to provide current to the whole circuit.

One more question: Do these IC protection diodes have particularily high resistance or something else to prevent this from happening under normal function? Because even when having rest of my circuit powered up, they will still be creating a parallel supply network, right?

Wrong,

When correctly powered these diodes can not conduct. Only when you are stupid enough to remove the power from the rails and still have it on the input connections can they conduct.

gregk:
One more question: Do these IC protection diodes have particularly high resistance or something else to prevent this from happening under normal function? Because even when having rest of my circuit powered up, they will still be creating a parallel supply network, right?

No, they are after all, diodes, they only conduct if a voltage on an I/O pin is higher than the supply voltage (or lower than ground). Under normal operation, the supply is the highest voltage and ground the lowest, so no normal voltage causes them to conduct. In fact, they have about a 0.5 to 0.65V drop, so will not conduct until the I/O pin is taken that far beyond the supply voltage.

Getting back to your problem, it seems you want to shut down part of the circuit and leave other parts running, presumably to minimise current consumption from a battery? The real question is what exactly do you want to do? CMOS circuits do not need to be shut down (by disconnecting the power) as when they are not clocked, they draw essentially zero power. To what extent you can "sleep" the microcontroller so that it draws negligible current, is a separate and often-discussed topic on these forums.

Grumpy_Mike:
Wrong,

When correctly powered these diodes can not conduct. Only when you are stupid enough to remove the power from the rails and still have it on the input connections can they conduct.

Well, in hindsight, I admit that it maybe wasn't the smartest move on my part. On the other hand, if I never removed the power from the rails I would probably never become aware that these diodes even existed :wink:

Paul__B:
No, they are after all, diodes, they only conduct if a voltage on an I/O pin is higher than the supply voltage (or lower than ground). Under normal operation, the supply is the highest voltage and ground the lowest, so no normal voltage causes them to conduct. In fact, they have about a 0.5 to 0.65V drop, so will not conduct until the I/O pin is taken that far beyond the supply voltage.

Getting back to your problem, it seems you want to shut down part of the circuit and leave other parts running, presumably to minimise current consumption from a battery? The real question is what exactly do you want to do? CMOS circuits do not need to be shut down (by disconnecting the power) as when they are not clocked, they draw essentially zero power. To what extent you can "sleep" the microcontroller so that it draws negligible current, is a separate and often-discussed topic on these forums.

Ok, that makes perfect sense. It was actually an accident. At first I wanted to see what the default setting of the IC was when powered off - would it default the Q1-Q7 to LOW or HIGH. So to test that I tried disconnecting the 5v output to the breadboard rail. My thought was that the IC would power off while the display would still be running if Q1-Q7 were still sinking the current. That was exactly what happened (although probably not due to the same reason as I expected). So next step was removing GND to verify my "hypothesis" in order to also remove the sinking capability, which I though would result in the display powering off. That didn't happen though.

So while this was caused out of pure curiosity, the result was quite intriguing and I couldn't manage to understand it on my own, so I decided to ask here.

Thanks for all the help! :slight_smile:

BTW powering a CMOS chip through its protection diodes is a classic
way to trigger CMOS latch-up (if the current is high enough).

For this reason its often a good idea to add resistors to external signal
connections to limit the current (4k7 or so?).