I'm new to Arduino, just got my starter kit, and I noticed that digital outputs 3 & 4 have 5v as HIGH level while 5 to 13 have 4.7v as HIGH level. Is it as it suppose to be?
3 Answers
Also depends on what your driving via this output. Standard TTL is:
But CMOS will be a bit different:
-
The Arduino is connected to USB port of MacBook pro. I wrote simple code to check HIGH level on digital pins:
void loop() { digitalWrite(3, HIGH); digitalWrite(4, HIGH); digitalWrite(5, HIGH); digitalWrite(6, HIGH); digitalWrite(7, HIGH); digitalWrite(8, HIGH); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH); digitalWrite(13, HIGH); }
– d.a.Dec 9, 2016 at 21:14 -
Are those pins output? @d.a. Please amend your question to post your entire code. You may also want to read up on how to make a loop.– Nick Gammon ♦Dec 9, 2016 at 21:24
-
@NickGammon as a point there. Instead of putting that in loop(), of that in setup() and do the same readings to see if you have the same voltages. Dec 9, 2016 at 21:25
-
I should point out, that after I tested, I noticed you omitted pin 9 from your list. A loop wouldn't have had that issue.– Nick Gammon ♦Dec 9, 2016 at 21:30
Yes, that's perfectly fine.
According to the datasheet, at 5V, the minimum voltage you can expect on a HIGH output (AKA VOH) is 4.2V. 4.7V is above that, so it's fine.
Some of the answers here suggest that a reading of 4.7V is in spec (which it is). As Majenko says, 4.2V is the minimum output high voltage, at an ambient temperature of 85°C, with a load of 20 mA, and Vcc = 5V.
However with no load, and at room temperature, I measured 4.99V on all of those pins, when set to OUTPUT
and HIGH
on my Uno. Test code:
void setup()
{
for (int i = 3; i <= 13; i++)
pinMode (i, OUTPUT);
}
void loop()
{
for (int i = 3; i <= 13; i++)
digitalWrite (i, HIGH);
}
That was weird for me, because 1 hour ago it was showing 5v to me.
Right. What were you doing an hour ago? Did you have LEDs connected to those pins? If so, what value resistor did you have in series with them? Or were you driving a motor from the pins perhaps?
-
Thanks everybody for help, I forgot to set pin 5 as OUTPUT. When I dit it, I got 5v on it.– d.a.Dec 10, 2016 at 21:25