I notice that the example projects for simple switches use a 10K pull down resistor but do not use a resistor for when a switch is closed. Is this safe? Should there not be a resistor in-line with the switch to limit the current in the circuit?
Other examples do use a resistor but often it is just 100Ohm. Again is this OK because from a 5V output the current would still be 50mA. Aren't pins able to take 40mA max?
I notice that the example projects for simple switches use a 10K pull down resistor but do not use a resistor for when a switch is closed. Is this safe? Should there not be a resistor in-line with the switch to limit the current in the circuit?
When a I/O pin is programmed to be an input pin, it takes on a very high input impedance, you can almost assume it can draw nearly zero current, so applying +5vdc directly to a input pin is not a problem at all. However if one was to press and hold down the +5vdc switch down and at the same time change the pin to a output pin and programmed it to a low output, there would then be a short circuit from Arduino ground, through the I/O pin and to +5vdc and would burn out the pin. So sometimes you will see a series low resistance placed between a pin and any external components, say 200 ohms, that would prevent a short circuit condition under any situation. Idiot proof so to speak? For switch inputs, I like to take advantage of the programmable pull up resistor available on I/O pins and just wire a normally open switch from the pin to ground. There is still the short circuit possibility if you program the pin wrong (output mode, set to HIGH) so it is still not idiot proof, but does save on having an external pull-down resistor. Keep in mind that on reset or power up an AVR chip defaults to all I/O pins as inputs, so any damage to a pin can only happen due to wiring and/or programming errors.
Other examples do use a resistor but often it is just 100Ohm. Again is this OK because from a 5V output the current would still be 50mA. Aren't pins able to take 40mA max?
Better to use 200 ohms as a safety resistor as one shouldn't run at maximum pin current ratings, use 20-30 ma as a better maximum rating.
It sounds like you understand ohm's law. If the input impedenace (resistance) of the input pin is say 10 megohms and you apply +5vdc to the pin, what would be the current flow into the pin be if I= E/R ?
It sounds like you understand ohm's law. If the input impedenace (resistance) of the input pin is say 10 megohms and you apply +5vdc to the pin, what would be the current flow into the pin be if I= E/R ?
Lefty
Presumably E is equivalent to V...
If so then the answer would be 0.0005mA?
Does this mean that the pin can take an input voltage much larger than 5v?
oh come on do you really expect someone just starting out to be able to find that after looking through that many pages of raw data? I've been doing this for a year now and am only just now understanding how to read basic datasheets (H-bridges, shift registers, etc.) It's people like Lefty that make this community thrive; people with sound EE understanding willing to share their knowledge.
It's people like Lefty that make this community thrive; people with sound EE understanding willing to share their knowledge.
Thanks.
The original Arduino concept was built around expectation that their user base would have lots of raw newcomers to programming and electronics. I think this forum should reflect that same philosophy.
If one really wants access to subject matter experts for anything related to Atmel AVR then the AVRfreak's site ( http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index&c=2&sid=1e3f0115c97724cdd4c7792e7424266b) seems to have the most experienced experts (many/most seem to work in the embedded world), however they can at times be a little terse (and sometimes sharp and/or sarcastic) with newcomers and expect them to have read all data sheets and reviewed all source code BEFORE asking for help. They do have some great tutorials and reference training material. I think the web is big enough for both styles of forums and both can serve their users well.