20. Design pull-up input

Circuit

Loading simulator…

Design Approach

A pull-up arrangement uses the opposite logic convention: the input is HIGH while the switch is open and LOW when the switch closes. The pull-up resistor prevents a direct short between 3.3 V and ground.

How the Circuit Works

  1. Determine the idle state. Connect a resistor between VCC and GPIO_IN. In the open state, the high-impedance input sits near 3.3 V.
  2. Choose the resistor. When the switch closes to ground, it must conduct about 0.33 mA. Therefore:R1=3.3V0.33mA=10kΩR_{1} = \frac{3.3\,\mathrm{V}}{0.33\,\mathrm{mA}} = 10\,\mathrm{k}\Omega
  3. Complete the active-low path. The solution adds R1 = 10 kΩ from VCC to GPIO_IN. The existing I_SW and SW1 form the path from GPIO_IN to GND on closure.
  4. Understand the inverted behavior. Open means HIGH and almost no switch current; closed means LOW with approximately 0.33 mA passing through R1 and the switch.

Verify the Circuit

In EWsim, open SW1 and check GPIO_IN≈3.3V\mathrm{GPIO\_IN} \approx 3.3\,\mathrm{V} with negligible I_SW. Close it and verify GPIO_IN≈0V\mathrm{GPIO\_IN} \approx 0\,\mathrm{V}, ISW≈0.33mAI_{\mathrm{SW}} \approx 0.33\,\mathrm{mA}.

Key Learnings

  • Pull-up inputs are active-low: pressing the switch produces logic 0.
  • The resistor both defines the open state and limits closed-switch current.