3
\$\begingroup\$

I was thinking of giving each switch it's own pull-up resistor, but this seems like it would be expensive and a little bit of overkill. But using just one pull-up for the entire block seems like it might overload the resistor (unless I just use a big one).

Are there any guidelines in this situation?

\$\endgroup\$

4 Answers 4

4
\$\begingroup\$

SMD resistors are as cheap as dirt. Especially if you would buy full roll of let's say 10k ones (i.e. something widely-used, so that you could use in multiple projects). It's hard to overload pull-up resistors, as they can dissipate 0.125W usually.

There are also 4 and 8 resistors in 1 package, this will be even cheaper if you are on large scale.

You cannot use single resistor for multiple wires - as they will be shorted (or you will need diodes :-D )

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Oh, duh about your last comment, I didn't even think about that! Thanks! \$\endgroup\$
    – samoz
    Jan 20, 2011 at 15:05
  • 1
    \$\begingroup\$ @samoz: That will turn your switches into a logic gate (e.g. NOR or similar depending on how you have it wired), and you won't be able to get 8 independent signals out of them. \$\endgroup\$
    – Nick T
    Jan 20, 2011 at 16:24
  • 2
    \$\begingroup\$ It's not because the allowable dissipation that it's hard to overload pull-up resistors, but because they usually have high resistance values, like 10 kohm. 5 V in 10 kohm is 2.5 mW. (Besides, 0603 resistors are 100 mW, not 125) \$\endgroup\$
    – stevenvh
    Jun 7, 2011 at 17:52
3
\$\begingroup\$

Depending on the application, you may have built-in pull-up resistors. AVRs like the ATmega168 and '328 do…

\$\endgroup\$
2
  • \$\begingroup\$ Are there any DIP switches with built-in resistors? I'm pretty sure they exist, but my google-fu has failed me. \$\endgroup\$
    – samoz
    Jan 20, 2011 at 15:18
  • 2
    \$\begingroup\$ Not DIP, AFAIK. Some BCD thumbwheel switches have them, IIRC. \$\endgroup\$ Jan 20, 2011 at 15:37
2
\$\begingroup\$

If your micro has no pullups, another approach is to common one side of all switches, connect to an input with a pullup, and connect each of the switches to other IO pins. The latter pins are all tri-stated except one at a time, which is pulled low to read the state of its switch on the input pin.

\$\endgroup\$
2
\$\begingroup\$

If you connect all your switches to the single resistor all your switches will be parallel, and you'll have only 1 output instead of 8. In fact this is a NOR gate: if at least one switch is closed the output will go low, if all switches are open the output will be high. This may have its application, but it's not the functionality you want.

You need a pullup resistor per switch.

Like BarsMonster says resistors are cheap (not only the SMDs). Don't buy a single part, a single 1/4W carbon film resistor costs 8 cent at Digikey, at set of 100 costs 2.2 cent per resistor. Have a few standard values at hand, like 1k\$\Omega\$ (typical for a transistor's base resistor) and 10k\$\Omega\$ (typical for pullup).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.