Questions About Permanently Powering an Arduino plus a Separate Circuit

I've got a few questions about the proper way to power an electronic circuit on a prototype board that I intend to control with an arduino.

The circuit is one of those fun 8x8x8 led projects. I've experimented with building it on a prototype board, have measured some of its parallel segments and have some uncertainties. The basic theory is 64 leds can be on at a time. Given the persistence of vision, cycling through the layers at a decent rate makes them appear as if they are all on. Their cathodes are bent horizontally and connected into a layer while their anodes will be connected to the led in a column above and below. The 64 led's will be controlled by a set of 8 shift registers with synchronized clock and latch buses and independent data lines. Lastly, a layer will be activated by applying voltage to the base of a transistor that closes the circuit for the given layer.

A really hacked up version of the circuit is here(I don't have proper circuit drawing software as of yet and this is just meant to give you an idea of what I'm doing rather than be definitive). I'm using blue LED's that have a forward drop of around 3-3.4V, current limiting resistors of 100 Ohms, and transistors capable of switching 800mA+. I've read quite clearly that you don't draw more than 40mA from an arduino pin or sink more than 200mA into its ground.

My concerns are around powering this properly.

How do you permanently power a circuit that needs 5V and power an arduino from the same power supply at the same time when the circuit draws significantly more current than the arduino?

Issue 1 - Did I construct my parallel circuit correctly
I hooked up a regulated 5V breadboard power supply and wired it to the VIN of the arduino which I understand goes through the regulator on the board. I connected the power directly to the shift registers to power them and brought the ground of the IC's and the LED's back to the power's ground directly. The arduino itself is hooked up to a set of buses that control the clock and latch pins on the IC's, send data to each register and activate the transistors' bases. I tested what I believe are the separate parallel elements of the circuit by sticking an ammeter in series right before the ground of each: the arduino gnd & the power supply (~35mA), the LEDs gnd to the power supply (~95mA) for 8 LED's, the IC's gnd's (seemingly 0mA). Three questions: do the numbers make common sense? Second, is it silly to think that I'd power an IC directly yet have some of its pins (latch/clock/data) hooked up to the arduino? Also, the shift registers say not to ground more than 70mA into them. As far as I can tell they are outputing (per measurement) as much as ~95mA but the current is grounded straight to the power supply and not the IC and when I try to measure the current grounded into the chip, I get a 0 reading. Does this make sense?

Issue 2 - How do I avoid the USB inadvertently powering the whole thing and melting the arduino? For context, I intend to be able to have the cube hooked up to the USB port to read animations that are too complicated to load onto the arduino. When I hook it up to a USB, I believe the arduino prefers to be powered from that. If, say, the external power to the cube is off, in this state since the VIN appears to be bidirectional, the current flows from the USB through the VIN to the LED's. Thoughts on how to approach this problem?

Issue 3 - The docs say to power the arduino with a source that's 7-12V. I think the onboard regulator steps this down a bit. But, if the circuit calls for 5V as well and you want to power it directly(i.e. have one power supply), that seems like an unfortunate happenstance if you can't wired 5V regulated power source to the VIN and expect the arduino to "behave" well. FWIW, mine did, but I don't want to count on that for the long run. How do people approach this problem? Having a separate power for the arduino vs. the circuit is certainly possible but I've got to believe that people don't do this. One thought I had was to wired the 5V regulated supply directly to the 5V pin of the arduino. The docs say pretty clearly not to do this however because it bypasses the regulator. However, if the supply is regulated, should I care?

Issue 4 - External power considerations. All designs that I'm emulating call for some decoupling capacitors. I've been studying how some power is provided to projects and would it be safe to say that regulated power supplies are designed to provide constant voltage but have no buffering capability that capacitors provide and I need to put them in my circuit for smooth operation?

Issue 5 - capacitor sizing. I'd like to understand how one should think about this circuit snippet. Consider that I may draw between 0 and 1A pretty quickly to light the cube. I see what I believe are 3 capacitors that are put on right in front of the other, I guess in parallel across vcc & gnd that go 1000uf,100uf,10uf. After that, do you just create a pair of power and ground buses for the circuit and arduino to tap? Also, is the theory that a set of successively smaller capacitors provide faster stored charge as the power supply may not be keeping up. Can folks share how they think of this, how big of a capacitor or set of capacitors would be put after the main power supply? If you have a regulated power supply, isn't part of it's raison d'etre to provide constant current and why would you even need capacitors?

I understand this is a big pile of questions and am grateful for some input.

David

dvberger:
How do you permanently power a circuit that needs 5V and power an arduino from the same power supply at the same time when the circuit draws significantly more current than the arduino?

One thought I had was to wired the 5V regulated supply directly to the 5V pin of the arduino. The docs say pretty clearly not to do this however because it bypasses the regulator. However, if the supply is regulated, should I care?

Hi Dave.

You buy a regulated 5V power supply with comfortably more current than your cube will draw, plus 50~100mA on top for Arduino. Then you take separate 5V and Ground lines from the PSU to the Arduino and the same to rest of the circuit in parallel, so that the current for the leds is not passing through the Arduino. You connect the 5V supply to the Arduino using its 5V input pin (rather than the barrel connector). This bypasses the Arduino's on-board regulator.

The advice about not using the 5V pin is to prevent beginners frying their Arduino by connecting unregulated power to it or anything over about 5.5V.

Looking at your circuit, there are some things I don't quite get. I can't see how the layers are switched. I take it you plan to use the shift registers, chained, instead of that 74138 which is used to direct the clock to one of the 8 buffer chips?

Don't get rid of all those caps, they are needed to keep the power smooth while all those leds get switched on/off at high speed.

As for your current measurements, if the shift registers are sourcing current to the leds rather than sinking current from the leds, then could that explain why you don't see much current flowing from those chips to ground? Is the high current in fact flowing from 5V into the shift registers?

If you exceed the 70mA limit, the life of the chips will be reduced, but not dramatically if you exceed it only by a few mA. Hard to say how long they will last with an extra 20mA getting drawn.

Sorry I have not answered all your questions. You did ramble a bit. Better to make a numbered list of short questions, I have found!

For drawing schematics, I would recommend Cadsoft Eagle. It has some quirks but it is well respected on this forum (unlike Fritzing, perhaps a little undeservedly) so you can get lots of help using it, and its free (although there are limits on how big a circuit you can build on the free version, but big enough for beginners projects, including yours).

Paul

Thanks, Paul! Very helpful response.

To continue a little bit.

As a small service to others, I found this line of reasoning about programmatically detecting where voltage is coming from.

Thanks for pointing out that I'm drawing beyond the max Vcc in on the chips. That should be easy to dial down with larger resistors with the LED's and I can double check the draw on the chip's input. I had measured after the LED's and to the common ground rather than before the chip's Vcc.

The way I'm controlling the layers is to use 8 chips with a common clock & common latch not daisy chained together but with 8 separate pins directly to each data-in for the chip. I will let me load a byte at a time across chips and load all 64 LED's in 8 iterations of a loop rather than 64 if I daisy chained them together -- a small optimization at the expense of using more wires. The actually closing of the circuit is done by applying some current to the base of one of 8 transistors that switches the layer to the power's ground. That wasn't pictured. It'll look something like this

Any particular thoughts on sizing capacitors relative to current draw?

Also, all the internal circuit diagrams for regulated power supplies that I see have capacitors in them. Shouldn't the "regulation" feature of a regulated power supply account for fast drawing of the LED's. Fwiw, I have no objection to including the caps.

Thanks,

David

dvberger:
Thanks for pointing out that I'm drawing beyond the max Vcc in on the chips. That should be easy to dial down with larger resistors with the LED's and I can double check the draw on the chip's input.

Do you think it will still be bright enough with less current? Don't forget that with 1:8 multiplexing, the average current will be one eighth of the instantaneous current. Its the average current that governs the brightness.

dvberger:
The way I'm controlling the layers is to use 8 chips with a common clock & common latch not daisy chained together but with 8 separate pins directly to each data-in for the chip. I will let me load a byte at a time across chips and load all 64 LED's in 8 iterations of a loop rather than 64 if I daisy chained them together -- a small optimization at the expense of using more wires.

Definitely not worth the expense of more wires in my opinion. Daisy chaining and using the Arduino's SPI outputs will be 100's of times faster than you need for 8 shift registers. The SPI bus can go up to 8MHz, i.e. 1 million bytes per second in theory, even on basic Arduinos. You probably need to output 8*8 bytes, around 50~100 times per second, which is only 3~6 KB/s. Even if you decide to use bit-angle modulation to fade the leds individually, you would only need at most 8 times more speed than that, and SPI is still 20 times faster than that.

dvberger:
Any particular thoughts on sizing capacitors relative to current draw?

Also, all the internal circuit diagrams for regulated power supplies that I see have capacitors in them. Shouldn't the "regulation" feature of a regulated power supply account for fast drawing of the LED's. Fwiw, I have no objection to including the caps.

I'm not an expert on this, perhaps someone else on the forum can give guidance. I would probably use a 1000uF cap to smooth the power, plus 8 x 0.1uF caps, one on each shift register, close their power pins for decoupling.

dvberger:
The actually closing of the circuit is done by applying some current to the base of one of 8 transistors that switches the layer to the power's ground. That wasn't pictured. It'll look something like this

David, it would be simpler to use a 9th shift register to control those low-side switching transistors. It can just be chained to the others. I'm not sure 2 x transistors per layer will be needed. In theory the max current they will need to switch is what can be sourced from 8 74hc595 shift registers, i.e. 8*70 = 560mA. But I would use BC337 rather than 2N2222 for a bit more headroom.

Clever idea using a 9th switch register and btw, thanks for prodding me to do the simple math about the premature optimization with the data lines. There could be something quite elegant in chopping out 7 data lines and 8 transistor lines.

fwiw, sorry about the 2x transistors in the diagram. It's a copy/butcher. I was intending to only have 1 transistor of appropriate size.

I had a quick thought re: issue #2. What if I stuck a diode right before the 5v to block reverse flow? The problem it would seem to bring up again is the voltage drop related to the diode and given 5v regulated minus even a schottky diode would still put my arduino power beneath 5v. Any thoughts?

What I don't have a good sense of is how much tolerance these devices have to: a bit less voltage in the above case or a bit too much amperage in the case of potentially overdrawing the shift registers.

David

Check out the 9x9x9 cube we're making
http://forum.arduino.cc/index.php?topic=257061.0
Uses ch74ac164 to source current to anode columns, and shift register to control AOI514 N-channel MOSFETs to sink current from common cathode layer.
Still have 2 layers to go ...

Sweet. Thanks for cross posting. I'll take a look and see if I understand your circuit.

Best,

David