# A paean to the pulldown resistor

Posted on March 6, 2011 by Tommy McGuire
Labels: electronics, toy problems
As a Computer Sciences sophomore or junior (it has been so long I don't remember) at UT Austin, I took a class on basic digital logic (EE316; I think they're using a later edition of the same textbook). What I learned there has not materially helped me any itself, although it provided an excellent base for later architecture and operating systems classes, and gosh knows I have used those a lot, in later classes, in research, and in actual productive work.

On the other hand, I just acquired and started fiddling with an Arduino and its excellent tutorials, especially Limor Fried's Arduino Tutorial: Learn Electronics using Arduino! (one of the 10 women who secretly control the Internet). And I just learned something basic, something that I did not have a clue about before.

When you connect a switch to a digital logic input, such as a pin on a microcontroller programmed to turn on a LED when the switch is closed, you actually only have half of the work done. Consider the top half of Wikipedia's diagram to the left: if the switch is closed, the Logic Gate (representing my microcontroller pin) will see a voltage $$V_{in}$$. $$V_{in}$$ will normally be provided at a value that the microcontroller can interpret as 1, say, and work properly. On the other hand, as I recently learned, when the switch is open, the Logic Gate will see neither a 1 nor a 0; instead, it will see some odd, floating, unconnected value. In my Arduino experience, the LED will be in a weird, half-lit state, presumably switching on and off as the value fluctuates.

What needs to be added is a connection to Ground, the 0 state, that takes over the input when the switch is closed. Unfortunately, if you connect the input to ground, it will be grounded whether or not the switch is open. So, you add the pulldown resistor, which allows the input state to go to 0 when the switch is open but which prevents the input from going to 0 when the switch is closed.

Anyway, here's a tip of the hat to the humble pulldown resistor and the opposite, pullup resistor.
Site proudly generated by Hakyll.