Questions tagged [pull-up]

Refers to pull-up resistors, which are commonly used to "weakly" pull a signal line to a high state. Use this tag for discussing pull-ups.

A pull-up resistor is used to avoid having a pin "float" with undefined voltages, for example:

Pull-up resistor

In this example the Arduino pin is kept at a HIGH level by the resistor. However if the switch is closed the pin becomes LOW.

Generally a high-value resistor (like, 10 k or more, possibly 100 k or even 1 M ohms) is used. When the switch is closed the 5 V line will be connected to Ground via the pull-up resistor, so you don't want too high a current to flow. In the above example the current would be:

I = V / R
I = 5 / 10000
I = 0.5 mA

Open-drain

Pull-up resistors are also used for "open-drain" designs, such as used in I2C. In such designs the data or clock lines are "pulled high" by a pull-up resistor, with multiple devices connected to the bus. When one of them wants to send a 0-bit they drive the line low, overriding the pull-up resistor. To send a 1-bit they let the pull-up resistor bring the line high again.

Doing it this way avoids having multiple devices "fighting" a bus, with some trying to drive it high, and some trying to drive it low.

In the case of I2C a resistor of 4.7 k is commonly used for SDA (serial data) and SCL (serial clock). Thus the I2C devices only have to be able to sink 10.6 mA (5 / 4700) which is usually within their design capabilities.


Internal pull-up

The AVR Arduinos have built-in pull-up capabilities. This lets you design a pull-up into a circuit (such as a switch) without actually having to wire in a resistor.

The internal pull-up is specified for the Atmega328P (as used in the Uno) at being between 30 k and 50 k ohms.

You can activate the pull-up in code like this:

pinMode (3, INPUT_PULLUP);

References

57 questions
9
votes
1 answer

Resistor pull-ups for ESP8266

I'm using 4.7kOhm resistor as pullups for GPIOs 2,0,2,16, CH_PD and RESET, and also 4.7kOhm pulldown for GPIO 15. The ESP8266 boots and works fine. Would it be okay for a long shot? Should I use 10kOhm instead of 4.7kOhm?
JFetz2191
  • 155
  • 1
  • 2
  • 7
6
votes
1 answer

Shift Register w/ Internal Pullups?

Is there a chip that is just a parallel in / serial out shift register but with integrated internal pullups? I could use a full-blown I/O expander but I really just need more momentary button inputs. I don't need outputs and I would rather not…
squarewav
  • 191
  • 5
5
votes
1 answer

ArduinoMEGA: 64 digital inputs cause random digitalRead values

I have 64 hall effect sensors (magnetic field sensors) (DRV5023AJQLPG) connected to an Arduino MEGA 2560. For that, I use 48 digital pins and 16 analog pins as digital input pins. The program in the Arduino continuously reads out those 64 digital…
Edo Paulus
  • 88
  • 1
  • 8
4
votes
1 answer

ATtiny85 and INPUT_PULLUP

I have read some conflicting sources about what pins have internal pullup resistors available for the Attiny85 microcontroller. Can all I/O pins work with INPUT_PULLUP, or just some of them? And if so, which ones? Thanks!
Alex Wulff
  • 309
  • 1
  • 2
  • 16
3
votes
1 answer

Input Oscillating Wildly

I'm trying to read an input from a switch but instead of getting 0 and 1 for closed/open, I'm getting 0 and a rapid series of 1s and 0s. Originally I tried (and failed) to simply read a rotary encoder but when I swap it for a standard rocker switch…
WillM
  • 39
  • 1
3
votes
4 answers

Can internal and external pull up/pull down resisters be used together?

What happens if a sketch uses code like pinMode(18,INPUT_PULLDOWN) to configure internal pull-down (or pull-up) resistors, but is used in a circuit where external resistors are also present? Are there likely to be any problems, conflicts or…
JRI
  • 200
  • 1
  • 7
3
votes
2 answers

Does an I²C IO Expander needs additional resistors for outputs?

I have following setup (see also schematic in the end) Arduino Nano is connected via I²C to the PCF8575C (link) IO Expander. Both, SCL and SDA have 10kOhm pull-ups to 5V. The Expander pins are connected to a MOSFET-driver that turns on/off 12V LED…
2
votes
2 answers

Barebones AVR - Connecting RESET pin to Vcc

I want to build my first barebones AVR circuit. I plan on NOT having a RESET button. For this reason, is it valid if I connect the ATMEGA's RESET pin to Vcc directly? What I mean by this, is that in this scenario, I will not be using a pull-down…
user1584421
  • 1,425
  • 3
  • 26
  • 36
2
votes
1 answer

Can't Turn Off Internal I2C Pull-Ups on ESP32

I've designed a custom ESP32 board around the WROVER-IE module. To keep power low, I'm using a GPIO-controlled high-side FET to turn off unused peripherals when in deep sleep mode. The issue: I've pulled up an SSD1306 I2C OLED to this AUX rail. It…
Nick Johnson
  • 79
  • 1
  • 5
2
votes
1 answer

Configure input pullup through registers

I can set pin mode to input or output through the DDRx registers. How can I enable the internal pullup resister through a register?
iHnR
  • 127
  • 3
2
votes
2 answers

Unable to use analog pins as digital inputs

I want to use the analog pin A7 as a digital input pin. As stated in the Arduino docs the analog pins can be configured in the same way like any other digital pin. However, when trying to configure an analog pin as a digital input pin, I get…
albert
  • 205
  • 2
  • 13
2
votes
1 answer

How many UNO pins have internal pull up resistors?

I am referring to all digital I/O pins 0 to 13 and A0 to A5.
2
votes
2 answers

How can I tell the resistance of an internal pull-up resistor?

I have a SparkFun ESP8266 Thing Dev board, to which I want to perform a digitalRead() on one of the GPIO ports. I'm using D15, and I'm configuring it for input like this pinMode(15, INPUT_PULLUP); It does seem to work as intended, and I am able to…
Magnus
  • 157
  • 1
  • 6
2
votes
1 answer

FSR wiring using internal pullup resistors?

What are the disadvantages to using Arduino's internal pullups with a force force sensitive resistor (FSR) sensor? All the wiring examples I see for FSRs place the sensor on the high side and use a 10k pulldown resistor. Searching Google, I can find…
Cerin
  • 1,688
  • 2
  • 28
  • 45
2
votes
2 answers

Minimum value I2C-pull up resistor for arduino

I'm trying to determine the minimum value of pull resistor for Arduino Uno The datasheets says for arduino; VOL = 0,4 for IOL = 20 mA. (VDD = 5V) For formula for calculation of minimal pull-up is: Rmin=Vcc−0.4V/20mA = 4,6V / 20mA = 230 ohms. But I…
Kono
  • 21
  • 1
  • 4
1
2 3 4