INPUT_PULLUP not pulling up.

Hi .
I am facing a major problem.

I have an arduino uno. it is being powered by a 12 adapter thru the barrel jack.
there in no wire , no resistor connected to the arduino uno . literally an empty ardunio uno . nothing is connected to it.

i have used INPUT_PULLUP to pull up pin 4,5 internally.
pin 4,5 are shorting to the gnd sometimes. even though there is no wire connected to it.

I have measured the voltage at pin 4,5. at both pin voltage is ranging from 0.8v to 1.2v .(even though they are pulled up internally .)

In the serial monitor. i saw fluctuations in the both pin 4, 5 .

WHY IS THE VOLTAGE AT PIN 4,5 0.8 V ?

void setup()
{
  Serial.begin(115200);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
}

void loop()
{
  Serial.println(digitalRead(4));
  Serial.println(digitalRead(5));
  delay(100);
}

Serial monitor log

1
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0

I have the same steps on 3 different arduino unos .
they all show the same problem.

I have tried changing the dc adpater .
still the problem perists .

i have even used another computer just for the sake of it .
still the problem persists.

My Uno clone only spits out ones with your code.
Did you try other pins?
Leo..

void setup()
{
  Serial.begin(115200);
  for(int i = 2; i <= 19; i++) pinMode(i, INPUT_PULLUP); // Uno D2 to A6
}

void loop() {
  for(int i = 2; i <= 19; i++){
  Serial.print("Pin ");
  Serial.print(i);
  Serial.print(":\t");
  Serial.println(digitalRead(i));
  }
  Serial.println();
  delay(1000);
}

Why are you using DC adapter if you are using the serial monitor which implies a USB connection and also USB power source for your Uno clone ?

Do you get the same effect if you use only the USB cable as a power source ? If not, then suspect your wiring.

6v6gt:
Do you get the same effect if you use only the USB cable as a power source ? If not, then suspect your wiring.

Yes

Wawa:
Did you try other pins?

Yes all these pins are showing the same behaviour on all 3 arduino unos i have .

i have bought them recently from a local vendor . these were sealed before . i have opened a fresh packet to test them .

But my question still remains . WHY is the voltage 0.8 V ? Why is it not showing 5v like it should ?

I ran your code for over 5 minutes and didn't get a single non-1.

So perhaps your question...

manveen_singh:
WHY is the voltage 0.8 V ? Why is it not showing 5v like it should ?

... is one for your vendor not the forum?

Did you try normal INPUT but with external resistors?

Hi,
What serial readings do you get if you connect pins 4 and 5 to gnd, then to 5V?

Thanks..Tom.. :slight_smile:

Hi,
I just tried on my UNOs and all was okay.
I measured pins 4 and 5 , both were at 5V.
My code.

void setup()
{
  Serial.begin(115200);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
}


void loop()
{


  Serial.print("digitalRead(4) = ");
  Serial.print(digitalRead(4));
  Serial.print ("   digitalRead(5) = ");
  Serial.println(digitalRead(5));
  delay(100);
}

Tom.. :slight_smile:

OK. You can try this code:

void setup()
{
  Serial.begin(115200);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  digitalWrite( 4, HIGH ) ;  // switch on pull up
  digitalWrite( 5, HIGH ) ;  // switch on pull up
}

void loop()
{
  Serial.println(digitalRead(4));
  Serial.println(digitalRead(5));
  delay(100);
}

Also, post a link to the Uno clone that you have purchased.

manveen_singh:
I have measured the voltage at pin 4,5. at both pin voltage is ranging from 0.8v to 1.2v .(even though they are pulled up internally .)

The pins have a weak pull up of about 200 uA.
I assume you didn't measure that voltage with a cheap 2kohm/volt analogue meter, because that would explain things.
Leo..

Wawa:
The pins have a weak pull up of about 200 uA.
I assume you didn't measure that voltage with a cheap 2kohm/volt analogue meter, because that would explain things.
Leo..

Using the OP code, I also get all 1's on pins 4 & 5. And I am measuring +5.01 V.

OP- What are you using to measure the voltage on the pin?

SteveMann:
OP- What are you using to measure the voltage on the pin?

a cheap voltmeter .

But even if i assume my voltmeter is wrong .

my arduino is reading digital read =0 at pin 4 .

so this proves my volt meter is reading correct value .

anthonyHope:
Did you try normal INPUT but with external resistors?

??

manveen_singh:
a cheap voltmeter .

But even if i assume my voltmeter is wrong .

my arduino is reading digital read =0 at pin 4 .

so this proves my volt meter is reading correct value .

I think you're missing the point.
A cheap analogue voltmeter can put a heavy load on the circuit.
VCC might measure 5volt, but if you measure that same 5volt through a ~30k pull up resistor, it's not reading 5volt anymore. Digital meters (even cheap ones) don't have that 'problem' because their input impedance is usually >=10Megohm.

Try measuring a 9volt battery through a 10Megohm resistor. You most likely will measure 4.5volt with a DMM.
Because the resistor and DMM are now a 1:1 voltage divider.

And yes, if the Uno reads a '0' with nothing connected, then there is something fishy going on.
Did they (clones?) come with pinheaders already soldered on, or did you do that yourself.
Leo..

Maybe the Arduino is on some conducting surface? I put Uno on a brass plate once and was wondering why nothing works. It was powered from a laptop USB and its overcurrent protection was fast enough to prevent any damage.

manveen_singh:
I have measured the voltage at pin 4,5. at both pin voltage is ranging from 0.8v to 1.2v .(even though they are pulled up internally .)

When your DVM measures 0.8V to 1.2V, you get random 1, 0, 1, ... on the display. What you have observed can be interpreted from the electrical characteristics (Fig-1) of ATmega328P.


Figure-1:

Fig-1 says that maximum value of VIL is 1.5V (0.3xVcc); the value you have measured is 1.2V which is very close to 1.5V; so, the corresponding logic could be LOW (0) or in the forbidden zone (>=1.5V) which could be HIGH (1).

Now, the question is: when you have grounded the inputs, how could it be that there is so much (0.8 to 1.2V) voltage at the input unless your grounding jumper is long and picking up some environmental noise or somother electrical fault which deserves investigation. For my MEGA the input voltage is almost 0V and stable for DPin-4 (mode: INPUT_PULLUP; input is shorted to GND).

Hi,
When you put the voltmeter between the analog input pin and gnd pin, what does the monitor show?

When you connect the voltmeter between 5V pin and gnd pin, what does the voltmeter read?

In OHMs on your meter, when you short the probes out, what does the meter read?

Thanks.. Tom.. :slight_smile:

anthonyHope:
??

no i did not . but i will try these .

Wawa:
I think you're missing the point.
A cheap analogue voltmeter can put a heavy load on the circuit.
VCC might measure 5volt, but if you measure that same 5volt through a ~30k pull up resistor, it's not reading 5volt anymore. Digital meters (even cheap ones) don't have that 'problem' because their input impedance is usually >=10Megohm.

i actually got your point .
my cheap dmm does not even have correct porbes . my probes broke . so i just cut the heads of the probes and soldered jumper wires on the ends .

I was using this voltmeter generally to test the continuity. and sometimes the voltage .

cheap dmm

i know the probes of dmm have high impedance.

My point being that my arduino's "pulled up pin" was not being pulledup even before measuring the voltage with my DMM.
So someting is wrong with my arduino.

GolamMostafa:
Now, the question is: when you have grounded the inputs

I have NOT grounded the pin 4,5 . they are not shorted or connected to anything .

GolamMostafa:
how could it be that there is so much (0.8 to 1.2V) voltage

this voltage is at those 2 pins when they are left floating . (despite being internally pulled up.) (when no jumper , no wire , nothing is connected to them. )

when i connect to the gnd . the voltage is 0