Skip to content
Inverse kinematics control library for Phenoptix meArm
Branch: master
Clone or download
Pull request Compare This branch is 6 commits ahead, 8 commits behind yorkhackspace:master.
phenoptix Merge pull request #1 from paulscott56/master
Spark Core example from paulscott56
Latest commit fd335bb Oct 16, 2014
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples README file for quickstart Oct 1, 2014
.gitignore Update Jun 24, 2014
fk.cpp Initial commit May 10, 2014
ik.cpp Initial commit May 10, 2014
ik.h Initial commit May 10, 2014
keywords.txt add isReachable() May 13, 2014
meArm.cpp add isReachable() May 13, 2014


Inverse kinematics control library for Phenoptix meArm and Arduino.

The meArm has four mini servos - one for the gripper, and one each to rotate the base, shoulder joint and elbow joint. But it's not terribly convenient to be specifying things in terms of servo angles when you're much more interested in where you would like to place the gripper, in normal Cartesian (x, y, z) coordinates.

This library solves the angles required to send to the servos in order to meet a given position, allowing for much simpler coding.

Coordinates are measured in mm from the base rotation centre. Initial 'home' position is at (0, 100, 50), i.e. 100mm forward of the base and 50mm off the ground.

Various other versions of this library exist:

meArm moving with Inverse Kinematics


#include "meArm.h"
#include <Servo.h>

meArm arm;

void setup() {
  arm.begin(11, 10, 9, 6);

void loop() {
  //Go up and left to grab something
  //Go down, forward and right to drop it
  //Back to start position

Three usage examples are included:

  • IKTest follows a pre-programmed path defined in Cartesian coordinates
  • JoystickIK uses two analogue thumb sticks to guide the gripper in Cartesian space
  • meArm_Wii_Classic uses a Wii Classic gamepad connected over I2C to guide the gripper


Clone this repository to your local machine, and place it in your Arduino libraries folder as 'meArm'.

Class methods of meArm object

  • void begin(int pinBase, int pinShoulder, int pinElbow, int pinGripper) - The four PWM-capable pins used to drive the servos. Begin must be called in setup() before any other calls to the meArm instance are made.
  • void openGripper() - opens the gripper, letting go of anything it was holding
  • void closeGripper() - closes the gripper, perhaps grabbing and holding something as it does so
  • void gotoPoint(float x, float y, float z) - move in a straight line from the current point to the requested position
  • void goDirectlyTo(float x, float y, float z) - set the servo angles to immediately go to the requested point without caring what path the arm swings through to get there - faster but less predictable than gotoPoint
  • bool isReachable() - returns true if the point can theoretically be reached by the arm
  • float getX() - current x coordinate
  • float getY() - current y coordinate
  • float getZ() - current z coordinate
You can’t perform that action at this time.