Control an OWI Robotic Arm With Arduino

170,553

181

42

Posted in TechnologyRobots

Introduction: Control an OWI Robotic Arm With Arduino

About: Founder of DIY Drones and 3D Robotics. Editor in Chief of Wired Magazine, author of the books "The Long Tail", "Free", and the forthcoming "Makers". Founder of GeekDad and B...
The OWI Robotic Edge Arm is a cheap and terrific 5-degree-of-freedom robotic arm that just costs $37. It's a great kit to build with a kid and won't take more than a couple hours to finish. Out of the box, it can only be controlled manually with a remote control. You can buy a USB control interface for it, but it's a waste of $27. It just lets you add a series of timed moves, but it's not really scriptable, you can't have it loop and because it just uses timing, there's no reliable repeatability.

What you want is real computer control, with closed-loop feedback for precision. Good news: it's super easy to connect an Arduino board to the OWI arm and let it do all the work! You won't even have to take the OWI arm apart or damage it.

Here's a video showing it in action, under fully autonomous Arduino control:


Here's what you'll need.

1) OWI Robot Edge Arm ($37)
2) An Arduino Uno board ($30)
3) An Adafruit Motor Shield ($19.50)
4) One potentiometer and at least three little trimpots ($5)
5) Some perfboard to mount the pots ($5)
6) Some jumper wires ($6) and pin headers ($7.50)

The total should be around $100. But you may have some of this already, and if not, you'll be able to reuse these boards and other parts for countless other projects.

Step 1: Connecting the Motors

Since the Adafruit Motor Shield only has four motor drivers, we're only going to connect the four OWI Arm joints (not the "fingers"). If you want to control the fingers, too, you can attach a relay to one of the digital outputs on the shield and put microswitches on the fingers to mark "open" and "closed". But I couldn't be bothered myself--the fingers aren't that important.

Just use a little solid (not stranded) wire to attach each OWI motor connector to a Motor Shield output. Strip a quarter inch at each end and plug one end into the OWI Robot Arm motor connectors and screw down the other ends in the Adafruit Motor Shield connectors, as shown here.

Step 2: Attach the Sensors

Each joint needs a potentiometer to measure its position, for "closed loop" feedback control. In the pictures here, I've shown a number of different kinds of pots, ranging from big metal ones to little "trimpots". In the intro, I linked to these, which are good general-purpose pots, but if you want smaller trimpots you can use these, which are shown in the arm picture here. I tend to use 10k pots, but you can use whatever you've got handy--just change the input thresholds in the Arduino code in the next section as appropriate for whatever readings you get.

Each pot has three wires: +5v, GND and variable. You'll connect them to the Motor Shield analog pass-through ports as shown, with the variable wire closest to the edge of the board.

On the Adafruit Motor Shield I've soldered three rows of break-away pin headers for the variable, +5v and GND pins on the shield here. You can cut off one plug of your jumper wires and solder it to each connect of the pot, and plug the other one into the Motor Shield. Or, if you have some RC three-wire cables around (like these female-to-female connectors that I've used here) , you can just cut them in half and use them for less wire clutter and confusion. The Motor Shield pins aren't quite the standard spacing, so you have to bend them a tiny bit, but it's no big deal.

In the picture, I've attached the base rotation sensor with some standard 22 gauge metal plumbers tape that you can get in any hardware store. It's pretty easy to bend it, cut it and screw it into the OWI Robotic Arm, either using existing holes or drilling new ones for small metal screws. I used a small length of wire to go through the slot in the pot and the holes in the plumber's tape to keep the pot shaft stationary as the pot body moves beneath it with the motion of the robot arm joint.

For other arm joints you can solder the trimpots into the perfboard as shown in the picture and hot glue that to the OWI Robotic Arms joints. Then hot glue some stiff piano wire onto the trimpot thumbwheel and connect it to a stationary point of reference for that arm. I typically use a small bolt as the anchor point for the wire, as shown in the pictures, so it can move back and forth bit without stressing the glue joint on the trimpot wheel. That's also the case for the bottom one, where the wire can move up and down in a hole drilled in the plastic base.

Note: there are many different and good ways to attach the sensors--these are just the way I did it. These work well, but you can mount them any way you want as long as they have a clear range of motion.

Step 3: Load the Arduino Code

Here's a simple Arduino sketch to show how to read the sensors, drive the motors and otherwise create a script to control each arm. This one first displays the sensor readings, then moves the base motor (arm rotation) and waits for you to hit "enter" in the Arduino Serial Terminal (remember to select "CRs" as the line ending type in that window) to go to the next step. Then it moves the other arm joints and prints out the new sensor readings from each one.

From this foundation, it's easy to see how to write full scripts that control all the joints. What's cool about this kind of "closed loop" control is that it's infinitely repeatable. Every time you do it you should get the same response, which is what you'd expect from a robot. (The pots have some variability, but the arm precision has been good to about half a centimeter in my tests, with no "drift".)


Just download the sketch and unzip it into your regular Arduino sketchfile folder. Remember that you must also download the Adafruit Motor library and place it in the "libraries" subfolder in your Arduino sketchfile folder.

Here's a video of simple base movement in action:

3 People Made This Project!

Recommendations

  • Casting Contest

    Casting Contest
  • Microcontroller Contest

    Microcontroller Contest
  • Woodworking Contest

    Woodworking Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

42 Comments

Can you talk about more about using the micro switches for the claw

and does your code need modding to do it ?

What voltage do you supply to the motors using this shield? I thought they run on ~3V but the h-bridge you're using seems to have a min of 4.5V. Do the motors seem to cope ok with this?

3 replies

Yes, they're fine with that voltage. The stock OWI kit uses four 1.5v batteries in series, so that's 6v. We're running them at somewhat lower voltage (4.5-5v) out of the shield, but there's no noticeable performance difference.

Actually, the circuit is set up so that only two of the batteries supply power to a motor at the same time, so the motor only sees 3 V. The circuit's "ground" is the middle of the battery string, which is connected to one side of each motor. The hand controller will connect the other motor pin to the pair above the ground for forward motion, and the other pair for backward motion.

I'm running my own Arduino-controlled OWI arm using a 5V supply for the motors, and it seems to be working fine, for now. We'll see how the motors hold up as time goes on.

It's been 6 years and I'm hoping this still reaches someone. I rushed into buying a bench top power supply only to realize how this wiring really worked. Are you using a single 5V supply with an H bridge, shield, or HAT or something? I actually purchased their USB conversion kit too but if I can't power it continuously I can't use and machine learning techniques with it.

This is a good product build. I am amazingly impressed, yet I was hoping for alittle clarification as to which motors are conected to which analog inputs on the motor shield for the example code included?

With the DC Cable how many voltage you used for the arduino?

The motor controller cannot know how far the motors have turned the joint; even if it knows that running it for 2.3 seconds moves it by x degrees, there are too many factors that can mess up the timing.

The pots will return distinct voltage values for every angle, consistently. For example, when the elbow is at some specific position, say about a third of the way through its travel, the pot will read, say, 1.6523443 volts or something like that. So if the controller is told "drive this motor forward until its pot returns 1.65 volts" it will stop at about the same angle every time.

Ok thank you good explanation in a sense is this getting a motor to behave a bit more liker a stepper motor then ?

Actually, a bit more like a servo, which also has internal pots.

The pots are to give position feedback to "close the loop" on the system. Otherwise it won't know where the arms are.

How exactly is this powered? I was intending on plugging the ardiono into my USB port and jsut using that, but I'm worried there won't be enough current. Could someone please plainly explain how to power everything (shield, arduino and motors)? I'm also worried the shield needs too high a voltage! And i read somewhere that these motors are only rated for around 3v :s

Thanks for any help! :)

1 reply

According to the manufacturer (http://www.owirobot.com/robotic-arm-edge-1/) each 3V motor runs at
255mA at full tilt -- with no load. And there are five motors. Just
being installed in the robot means there's a load, and it will go
higher, all the way to the listed "stall current" of over 3 amps. The
design is such that the motors cannot continuously stall in this robot,
but still -- no microcontroller can deliver that directly even for a
split second. You will definitely need a motor controller. I don't
even think relays, transistors or MOSFETs will work because you've got
to be able to reverse the polarity. By the time you've added all the
circuitry to support it you've pretty much built a motor controller, so
probably better to just buy one straight away.

Has anyone tried to use these flex sensors for feedback? https://www.sparkfun.com/products/10264

can u plz show the connections clearly ? can we do the same thing using pcduino board?

Hey,
I bought OWI kit from amazon. It seems the speed of the motors is a bit slow.
Are there any methods to increase the speed of the motors?
Something like passing more current. But i doubt more current may burn the motors.

Hello zlite,

Great project and idea!

What is the name of the software you are using on the youtube video "simple base movement in action"? I will add the pots and I would like to control it from my PC like you are doing on your video.

Thanks in advance!