17663Views6Replies

Author Options:

Can I use the Arduino's digital pins for 5V and ground? Answered

I am making something using a servo and an Arduino, and it would make my design a lot simpler if I could use the Arduino's digital pins instead of its ground and 5v pins for power. However, I haven't been having much luck. When I use the ground and 5v pins for power, the servo works like it should. However, when I code the Arduino's digital pins 3 and 2 to output high and low, and then attach those pins to the servo's positive and negative wires, it just makes a ticking noise. I have done some basic troubleshooting, such as trying multiple pins and going over everything with a multimeter, but it hasn't revealed any problems.

Does anyone know how to resolve this?

In case you are wondering about my code, it's basically the Arduino Sweep code with two outputs added.

#include <Servo.h>

Servo myservo;

int pos = 0;
int servoPos = 3;
int servoNeg = 2;

void setup()
{
  myservo.attach(4);
  pinMode(servoPos, OUTPUT);
  pinMode(servoNeg, OUTPUT);
 
  digitalWrite(servoPos, HIGH);
  digitalWrite(servoNeg, LOW);
}


void loop()
{
  for(pos = 0; pos < 180; pos += 1)
  {
    myservo.write(pos);
    delay(15);
  }
  for(pos = 180; pos>=1; pos-=1)
  {                               
    myservo.write(pos);
    delay(15);
  }
}

Tags:Arduino

6 Replies

user
steveastroukBest Answer (author)2012-10-24

Not possible. You can't feed anything LIKE enough current from a digital output.

Select as Best AnswerUndo Best Answer

user
jeanl0uw (author)2013-05-07

Try using transistors in conjunction with the PWM pins.
__ __ __ __ ___
_ _ _ _ _ _ | | | | | | | | | |
| |_| |_| |_| |_| |_| |_ => | | | | | | | | | |
|__| |__| |__| |__| |__|

Select as Best AnswerUndo Best Answer

user
spiffomatic64 (author)2012-10-24

Each digital io has 20ma, do you know the draw of the servo? Im not an EE but I dont think you'd be able to use a digital io set to low for ground, could you try ganging a couple of high io pins (enough to make up the required ma) and use the actual ground pin?

(again not a pro, just a thought)

Select as Best AnswerUndo Best Answer

user
bwrussell (author)spiffomatic642012-10-24

+1, just because it is a low voltage doesn't make it connected to ground. Why can't you use the 5V pin? Even if it's on the wrong side just attach a longer wire or break it out onto a breadboard.

Select as Best AnswerUndo Best Answer

user
seraine (author)bwrussell2012-10-24

I could do it, it's just that if I could do use the digital pins it would make my final result cleaner and better organized.

Select as Best AnswerUndo Best Answer

user

Over 500mA, on a fast slew.

Select as Best AnswerUndo Best Answer