Navigation

Friday 9 January 2015

Connecting a switch to a microcontroller: Pull-Up and Pull-Down Resistors

A switch can be connected to a microcontroller using either a pull-up or pull-down resistor. The pull-up and pull-down resistors ensure that the wire is at a defined logic level even if no active devices are connected to it.

Pull-Up Resistor



Pull-up resistor pulls the voltage of the wire it is connected to towards the voltage source level when all the other components on the line are inactive. When all other components on the line are inactive, they are high impedance and act like they are disconnected. The pull-up resistor brings the wire up to the HIGH logic level. When another component goes active, it will override the HIGH logic level set by the pull-up resistor. The microcontroller is HIGH when the switch is not connected and LOW otherwise.

Pull-Down Resistor



A pull-down resistor works in the same way but it is connected to GND. It holds the logic signal near zero volts when no other active device is connected. The microcontroller is LOW when the switch is not connected but HIGH otherwise. It is preferable to use a pull-down resistor.

No comments:

Post a Comment