74HC165N & max input current

Hi,

I'd like to read 8 button states through a 74HC165N. I've read somewhere that the maximum current at the Arduino inputs is 40mA. For testing purposes, with only one button (no IC) connected to an external 6V power supply and grounded to the Arduino with a 10K pulldown resistor, I measured 0.5mA coming into the input when the button is pressed.

Does this mean I can safely power the 74HC165N and 8 associated switches with the external voltage and not worry about the input current? The way I see it, the pulldown resistor can't be responsible for the current flowing in, because when the switch is activated there is a direct route from +6V to the input. So how does the current stay so low?

Thanks.

The input to the 74HC165 is like a high value resistor, takes very little current to make it change state between high & low.
5V/10K = 0.5mA, so all the current drawn is for that 10K resistor.

First and MOST important is that you NEVER NEVER use external voltages above 6 volts to feed ANY input on an Arduino except the DC input jack, 6 V is not high enough to do any damage but when applied to an input CAN cause damage or at the least to cause the processor to work improperly. There are 5V source pins available for that purpose, please use them. .5 mA is nothing to be concerned about. Where are you measuring this current at, you didn't see fit to provide any detail except an easily mis-understood situation so your answers are likely not going to be very accurate... Perhaps just as accurate as the information supplied initially. I think you are misunderstanding the whole issue an Arduino Pin can SOURCE 40 mA Max and it can sink about as much I don't really know as I wouldn't cause any output to source or sink more than a few mA. When a pin is used as an input on either the Arduino or the shift register the input current is typically less than a uA or so. They are CMOS inputs and have a very high input impedance, any current you are measuring is through the resistor or the part is no good. Much more likely that it is the resistor. Power the shift register from the board 5V source and if you must power it off board from another power supply then the supply must be 5V or 3V3 and you must only connect the grounds together not the two supply + connections this is done to prevent noise generated in external devices from affecting the Arduino itself.

Doc

Per the datasheet:
Low Power Consumption, 80-?A Max ICC
Low Input Current of 1 ?A Max

Hardly measureable!

@CrossRoads: I wasn't clear enough I'm afraid, it's the maximum current of the Arduino board I'm worried about (at least for now...)

@Docedison: For clarity, see the attached drawings. The first one shows where I've measured the 0.5mA current (without using any IC for now). The second one shows what I'm trying to achieve (part of it, actually, there's a lot more around that but it's off-topic...) I know I can cascade the ICs for the 2 groups of 8 LEDs but they are serving totally different UI purposes and it would just be confusing to cascade them. I might, though, if pins run out.

So what I'm worrying about is basically not frying the Arduino with the external power (whether it's 5V or 6V, it's the current I'm concerned with).

I hope I'm clearer about this...

skitched-20120618-215239.png

Don't use 6v, that will cause excessive current to be drawn by the internal protection circuit that limits it to 5v, causing alot of heat and probably burning other internals
Also the current going into the input pin is limited by its own internal high impedance, which you can consider as like a 500k resistor inside the arduino after the pin when input is selected
And remember voltage and current go hand in hand, high voltage will cause high current, current only flows as a relationship of resistance and voltage

The Arduino board will not draw much.
It will draw even less if you get rid of the 10K pulldowns and use the internal pullups:

pinMode (input_pin, INPUT);
digitalWrite (input_pin, HIGH); // enables the internal pullups.

Then wire your switch to connect the pin to Ground when it is pressed. Next to no current will be used when the switch is open, and ~1/4mA when pressed.

For your second drawing, the current flow when the Ardiuino shifts in data from the 165 or out to the 595's will be very small. That's the whole point of the HC family, very low current flow required to switch voltage levels.

6V is an awkward voltage - its okay for the HC parts, but too high for arduino IO pins.
What you can where you only have a few IO lines to deal with is put diodes in series with the lines to drop the output voltage from 6V to 5.3V coming from the HC parts, and then nothing on the Arduino outputs, the HC inputs will work at 5V.

No neither one of your drawings will cause any real increase in the Arduino supply current. The 6V power supply is an issue. What is it's purpose?. My concern comes from the good possibility of ground problems, noise that is differential to the Arduino ground may well show up in the amplitude of the data returned/sent to the shift registers.
It is Never a good idea to directly interface any device directly to an Arduino. The Arduino board is it's own little world and for best results should be treated that way.
If you really have to use an unknown 'unconditioned' control signal and it is a potentially noisy atmosphere like a pump control or other heavy machinery.
The Led S.R. can be supplied from an outside source and there is a high current open drain equivalent to the HC595 that will support higher voltages and much higher currents/pin. 150 mA per pin @ 50V but I would try real hard to keep it to 10 12 Volts and 100 ma max per pin unless you can reduce the LED duty cycle with PWM control.
Optoisolators work well to provide a potential barrier between the Arduino and the outside world. They (opto's) are Ideal for you as you are using the device in a completely digital mode and require a pull-up on the output (it's a phototransistor) and 5 mA is usually enough to turn on the transistor.
Go Wiki Optoisolators, you just might find your answer quickly.

Doc

That position seems a bit extreme when there are chips between the switches & LEDs already.
I'd be totally comfortable wiring it up like this, using SPI commands to read & write, making sure the ground is common with the Arduino. The 5V source can be split external to the Arduino, feeding the 5V pin on the header, and the 5V pins on the chips and LEDs so the LED current is not going thru the Arduino regulator.

(the library symbol says LS, but HC parts can be used here as well).

Well done sir. I appreciate that you know what you are doing and that in of itself is a joy. I see your schematic and If you are happy with it so am I. my single change would be to add a 330 - 470 uf local bypass capacitor on which ever power supply is used on the board. It's just good practice. remember the 595 is a current source as well as a sink both of which create noise. I think you are well on the road. I was trying to point out that the opto's are very easy to use. Just 4 extra parts and then there are no concerns whatsoever and it then could go virtually anywhere and 'be happy'.

Doc

@Docedison: The reason I'm using 6V is because I'm running 6 to 8 servos, which all require 6V. I need to reduce this to 5V for everything the Arduino connects to directly.

@CrossRoad: Thanks very much for the illustration. I'm not sure yet what "SPI commands" are (I'm using the Arduino Shift commands), but the circuit confirms that I can continue without frying the Arduino. BTW, which capacitors would you use to protect the ICs?

Docedison:
Well done sir. I appreciate that you know what you are doing and that in of itself is a joy. I see your schematic and If you are happy with it so am I. my single change would be to add a 330 - 470 uf local bypass capacitor on which ever power supply is used on the board. It's just good practice. remember the 595 is a current source as well as a sink both of which create noise. I think you are well on the road. I was trying to point out that the opto's are very easy to use. Just 4 extra parts and then there are no concerns whatsoever and it then could go virtually anywhere and 'be happy'.

Doc

For logic you need ceramic capacitors (crucial for low inductance) in the 0.1 to 1uF range (plus larger for high current). Its analog circuitry (audio) that normally benefits from large value decoupling capacitors. Electrolytic capacitors may not have a low enough series inductance to decouple fast edges at all (we are talking a few nanoseconds for logic switching). As a rule of thumb the self-resonant frequency of the decoupling capacitor(s) should above the max frequency of operation of the circuit you are decoupling.

I wouldn't group those components quite so arbitrarily, small value ceramic caps are good for bypassing fast rise time signals but will do little or no good at all on a digital board for example compensating for power supply surge current abilities, Large Slow high current pulses or to help compensate for smaller than optimum wire sizes supplying pc boards that control servo's or motors. Large value electrolytics will. What I am trying to say is tat every type of capacitor has a use and specific thing that it is best for and there is no one single part or class of power supply bypass that is uniquely digital to audio. Any board I build Will have a .1 for low speed ic's a ,01 and a .1 for medium speed ic's and a 1 nF cap in addition to the .1 and .01uF Cap for the really high speed ic's or circuitry. Each board I design will also have a 100uf cap for every 100 mA of current draw from the board and a minimum value of 330uF per board. In 30 years of circuit design from DC to Daylight and the PCB layout as well those simple rules insure that I have NO floating stuff on any PCB or circuit I design. Everyone works by their own 'lights' mine have always been successful for me I Never, after the first mistake repeated it AGAIN. The parts are inexpensive and easy (more or less) to use once you understand their uses and methods of application. It is very easy to not have enough of the right ones and no repercussions for having more except for a small increase in cost. When I buy a shield the First thing I do is to solder a 47uF ceramic, a 100 nF and a 10nF ceramic capacitor across the supply pins on the board, I use 805 smt parts as they fit nicely on .1" 2.54 mm pin connectors... Just stack them up. This prevents "Crosstalk" or the inability of the Vsupply and it's wiring to adequately bypass noise generated on shields or really worse, breadboards.
This has always been my gold standard for power distribution and my boards always work.
MY code usually looks like it was written by a dyslexic preschooler... Though, But I am learning.

Doc

Can u post a pic of how that looks or how you do it with the stacked caps? I got a bunch of smd caps but other than regular perfboard I haven't been able to solder them to much, the stacked idea is really good but sounds either delicate or hard to do

I use these
http://www.dipmicro.com/store/C5K10-50
Buy 100 of them, put 1 on every digital chip from +5 to GND.

How much do u get them for? I just got 50 for like 4$ off ebay with the free shipping, which I figure is cheap, but not ridiculously cheap
and I have a bad habit of buying alot of 4$ things and being over budget, any savings are nice

No not really. I Solder the 47uF first them put the .1 uF on top of that one and tack one end and then solder them both and the .01 goes on top of that. To facilitate 'tacking' down the next part I put a little extra solder on one end of the capacitor and that is what I use to sort of stick the next one down so I can solder both ends properly. They stack like bricks. I hope this helps.

Doc