How to figure out what resistors to use ?

Hello!

I just bought an Arduino starter kit, it has a book and numerous electronics inside to built stuff. It is great!

I want to start plugging stuff together and trying. But I have come to a halt, because I might burn things.

How do I know what resistors to use for things to work but not burn up ?

(e.g. I want to connect a push button into Arduino digital input. Obviously this needs a resistor, otherwise pushing the button will short circuit everything. How to decide which resistor to use ?)

Thanks in advance! Dimitris

Attached is how to wire a switch. Each digital input has a resistor built in that you can enable with pinMode(pin, INPUT_PULLUP); to make interfacing switches easy. For other components you will need to use Ohm’s law to calculate the proper resistor based on required current and supply voltage.

Hello, thank you for your answer,

but that's exactly my problem, I dont know what the required current/voltage is, for each component.

(for example I got the Arduino Starter Kit and it contains hundreds of components, without saying what the requirements for each are. what am I supposed to do now ?)

Is there some reference online that I can use ?

Most components should have a data sheet available somewhere. In the data sheet will be listed things like operating voltage, operating current, maximum voltage and current, to name a few, depending on the component. Some parts like LEDs may not be marked (no way to find a data sheet) so you must make some assumptions and test to find the right operating parameters. If you need help to identify a part, post the numbers that you can find on the part (and a picture if that might help) and we can help find and interpret the data sheet with you.

as groundfungus said data sheets will tell you voltage and current needs for your components then you can use ohms law to select the correct resistance to satisfy the components needs. don't forget that the component has a resistance also. here are a few links that should be helpful.

https://learn.sparkfun.com/tutorials/voltage-current-resistance-and-ohms-law

http://www.playwitharduino.com/?p=225&lang=en

https://www.youtube.com/watch?v=B0LRa_F9myI

http://www.instructables.com/id/Choosing-The-Resistor-To-Use-With-LEDs/?ALLSTEPS

Digital inputs draw VERY little current. They can be connected directly to +5 or a digital output without problems.

Digital outputs can source or draw up to an absolute maximum of 40 mA (milliAmps, thousandths of an Amp). Best to limit loads to 20 or 30 mA. If they are connected to something with very low current draw, like a digital input, they need no resistor. For loads like a LED which will fry if you put 40 mA through them you can use a resistor to limit the current to 10 or 20 mA. For loads like a DC motor which need more than 5V or more than 30 mA you can use an NPN transistor between the negative side of the device and Ground. Because the 'base' pin of the transistor acts like a diode to Ground you need a resistor to limit the current draw. A 270 Ohm resistor will allow just under 20 mA which should be plenty. Similarly you can use an N-Channel MOSFET in place of the NPN transistor. For that you need a resistor because the 'gate' pin acts like a capacitor and can draw high current while charging. Again 270 Ohms is good.

I want to connect a push button into Arduino digital input. Obviously this needs a resistor,

No this is wrong. Connect the button from the input to ground and enable the internal putt up resistors. That is the proper way to do it.

http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

Internal pullups are weak, though. Much better to use a 4.7K or 10K external pullup.

Thanks everyone, you have been most helpful, now I understand better whats going on. I ll try to find the datasheets.

In the meantime, as a comment, it was wrong for me to start with the Arduino Starter Kit book. Its a "hands on" quick start guide with great projects to build in a blink of an eye.

But if one needs to understand what they are doing, and not just copy the exercise, the basic examples in this site are better I believe.

So, thanks again Dimitris

dtrip: But if one needs to understand what they are doing, and not just copy the exercise, the basic examples in this site are better I believe.

If you really want to understand what is going on, you're going to need to do a lot of studying, and more than a bit of math (nothing too tricky, though - mostly basic algebra).

Two books that I like to recommend are:

Schultz's "Grob's Basic Electronics"

Horowitz's "The Art of Electronics"

Both books are essentially "EE101" level material; I'm more familiar with "Grob's Basic Electronics" - it essentially starts out with "what is an electron", then to mainly passives - voltage, current, and resistors, Ohm's law, Kirchhoff's circuit laws, etc; then on to semiconductors (diodes and transistors), and so forth. By the end, you are getting into digital design and whatnot.

Both books are textbooks, and have a hefty price - expect to spend over $100.00 USD for each, if you get the latest edition. That said, you don't need the latest edition - instead, get a previous edition, and you'll spend much less.

In addition, you might also want to look into some of what Forrest M. Mims III has published over the years.

Particularly his "Engineer's Mini Notebooks" series, which were once published through Radio Shack, back when they were a real electronics parts outlet. They present a lot of electronics material in an approachable way; all of these books should be a part of your library if you want to really understand things.

Two books that I like to recommend are:

Schultz's "Grob's Basic Electronics"

Horowitz's "The Art of Electronics"

Yes, and they should both be required reading (cover to cover ) for all newbies.... ;D

MK1888: Internal pullups are weak, though. Much better to use a 4.7K or 10K external pullup.

No it is not much better to use external pull ups in any but the most extreme circumstances. In most cases the internal pullups are good enough.

I’m a college-trained (book) EE but electronic projects were also a childhood and military experience. Good reference material can be found in textbooks, but with the Internet, spending money is no longer a requirement…
For example, you can go here and find answers to many inquiries.

You can learn a lots about electronics by using a simulator, such as this one.

I’d rather see you spend your money on good quality parts and sensors than on college text books. Experience comes from just working through experiments. If you have a local community college, you may consider a basic electronic course; it is useful to play with lab exercises and be able to have a dialog opportunity - but this is not an absolute requirement. If you are reasonably dedicated, you can become quiet competent in hobby microprocessors and interfacing just through hand-on exercises.

Ray
My Projects

OP here,

Im a computer programmer and believe me I know how essential those "thick books" are. However I can not afford the time for such a deviation for my project. (Im building a ROV, underwater vehicle). I just want to drive propellers and valves through a joystick, thats all. "Thats all" means that in theory I know already how to do it, but in practice it is of course a different thing. Because simply using a transistor as a switch to open/close a valve, requires calculations and possibly ordering some missing parts = delays. Well I can live with that, after all Im not in a hurry.

Your references are great, I study them at night before bed :)

Thanks to all,

I am having some trouble resolving "However I can not afford the time for such a deviation for my project. " and "Well I can live with that, after all Im not in a hurry. "

However, I would still like to put forth two points: 1) the best way to learn is by doing; 2) the best way to stay alive and avoid burning up components is to study the books before doing......

Good luck with your endevors.