Sulaymaniyah-Kurdistan
Offline
Jr. Member
Karma: 0
Posts: 89
|
 |
« on: January 19, 2013, 05:52:54 pm » |
hi there i have a problem with arduino when i checked output of digital pin it gave me 4.2v instead of 5v, and i need 5v,any solution? i don't know what is wrong, thanks for helping! best regards
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 12
Posts: 327
The last thing you did is where you should start looking.
|
 |
« Reply #1 on: January 19, 2013, 06:14:22 pm » |
To help us help, we need to see the sketch you are using and a schematic of your project. Do all the digital pins have the same problem?
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 276
Posts: 25482
Solder is electric glue
|
 |
« Reply #2 on: January 19, 2013, 06:21:01 pm » |
Normally people forget to set them to be outputs when they complain of this.
|
|
|
|
|
Logged
|
|
|
|
|
Sulaymaniyah-Kurdistan
Offline
Jr. Member
Karma: 0
Posts: 89
|
 |
« Reply #3 on: January 19, 2013, 11:41:51 pm » |
yes, all pins have the same problem and here the sketch: int pin1= 11; int pin2= 12; int pin3= 13; int counter = 0; void setup(){ Serial.begin(9600); pinMode(pin1, OUTPUT); pinMode(pin2, OUTPUT); pinMode(pin3, OUTPUT); } void loop() { int input = Serial.read(); if (input == '3') { if (counter == 0) { Serial.print("on"); analogWrite(pin3, 255); delay(5000); counter++; input = 0; } } if (input == '4') { if (counter == 0) { digitalWrite(pin3, LOW); Serial.print("low"); counter++; input = 0; } } if (input == '1') { if (counter == 0) { Serial.print("1"); digitalWrite(pin1, HIGH); delay(150); digitalWrite(pin1, LOW); counter++; input = 0; } } if (input == '2') { if (counter == 0) { Serial.print("2"); digitalWrite(pin2, HIGH); delay(50); digitalWrite(pin2, LOW); delay(50); digitalWrite(pin2, HIGH); delay(50); digitalWrite(pin2, LOW); counter++; input = 0; } } counter = 0; }
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #4 on: January 19, 2013, 11:55:17 pm » |
yes, all pins have the same problem and here the sketch: int pin1= 11; int pin2= 12; int pin3= 13; int counter = 0; void setup(){ Serial.begin(9600); pinMode(pin1, OUTPUT); pinMode(pin2, OUTPUT); pinMode(pin3, OUTPUT); } void loop() { int input = Serial.read(); if (input == '3') { if (counter == 0) { Serial.print("on"); analogWrite(pin3, 255); delay(5000); counter++; input = 0; } } if (input == '4') { if (counter == 0) { digitalWrite(pin3, LOW); Serial.print("low"); counter++; input = 0; } } if (input == '1') { if (counter == 0) { Serial.print("1"); digitalWrite(pin1, HIGH); delay(150); digitalWrite(pin1, LOW); counter++; input = 0; } } if (input == '2') { if (counter == 0) { Serial.print("2"); digitalWrite(pin2, HIGH); delay(50); digitalWrite(pin2, LOW); delay(50); digitalWrite(pin2, HIGH); delay(50); digitalWrite(pin2, LOW); counter++; input = 0; } } counter = 0; }
Ok a few questions: How are you trying to measure the output voltage of the pins in question. As your turning them on and off a pretty quickly a digital volt meter is sure to not give an accurate measurement. Do you have anything wired to the output pins in question? If so what? Have you measured the arduino 5V shield pin with a good voltmeter? If so what does it measure at. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Sulaymaniyah-Kurdistan
Offline
Jr. Member
Karma: 0
Posts: 89
|
 |
« Reply #5 on: January 19, 2013, 11:58:59 pm » |
i make one pin output and take out by a jumper wire then measure it by mutlimeter. i connect them relay and they can't swith the relay but when i connect directly the relay to 5+ it switch. before i did this and there was no problem//
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #6 on: January 20, 2013, 12:05:46 am » |
i make one pin output and take out by a jumper wire then measure it by mutlimeter. i connect them relay and they can't swith the relay but when i connect directly the relay to 5+ it switch. before i did this and there was no problem//
Can you just answer my questions, one at a time that I listed below? Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 242
Posts: 16508
Available for Design & Build services
|
 |
« Reply #7 on: January 20, 2013, 12:11:33 am » |
4.2 is within spec: See Section 29 VOH Output High Voltage(3), IOH = -20 mA, VCC = 5V: 4.2V
Note (3): Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: ATmega48A/PA/88A/PA/168A/PA/328/P: 1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA. 2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA. If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 9
Posts: 836
|
 |
« Reply #8 on: January 20, 2013, 07:36:39 am » |
You would be pushing your luck to have an arduino digital output drive a relay, unless it is some kind of special relay with a very low input requirement.
Make a circuit with a transistor to drive the relay.
|
|
|
|
|
Logged
|
|
|
|
|
|