1

I am trying to control this OWI Robotic Arm using the Arduino's digital outputs (I am using pins 12 & 13).

If I wire up the wires to ground and 5V it goes one way, if I switch the wires, it goes the other way. However when I have the pins wired up to the digital pins, it does not work, but the on-board LED does blink.

The code:

int a = 12;
int b = 13;

void setup() {
  // put your setup code here, to run once:
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  //up
  digitalWrite(a, LOW);
  digitalWrite(b, HIGH);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  //down
  digitalWrite(b, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
}
  • 3
    Why do you think that the pins can supply anywhere near what current the arm requires? – Ignacio Vazquez-Abrams Aug 9 '17 at 20:28
  • Honestly, I have no idea what I am doing, but I assume the pins can be as powerful as the 5V pin on the Arduino, and that was enough to drive the motor. – Graic Aug 9 '17 at 21:41
  • Do the datasheet and specifications back up your assumptions? – Ignacio Vazquez-Abrams Aug 9 '17 at 21:43
  • Assumption IS the mother of all screw ups. In this business you NEVER assume. You read and check and find out. You may have burned up your Arduino by now. – Delta_G Aug 10 '17 at 0:34
1

The problem you are seeing here is that the Arduino can provide nowhere near as much current through I/O pins as it can power. Quoting from the Arduino website:

DC Current per I/O Pin: 40 mA

This means that each pin can power maybe a couple of LEDs, and that's it. Additionally, motors provide "back-EMF": When opening (cutting power) an inductive load (e.g. a motor), the current wants to keep going. This will damage whatever just opened unless protection is used. So, I wouldn't be surprised if you damaged your Arduino by attempting to drive a motor with it.

So, what can you do? Use an H-Bridge. This circuit will allow you to easily control a motor & its direction. Many circuits can be found online, but an easy solution is a cheap L298N module, which can be as cheap as $3 a piece. This will safely & easily control the arm. Connecting your Arduino with the following circuit & using your existing sketch will make it work.

schematic

simulate this circuit – Schematic created using CircuitLab

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.