I've been toying with this idea for a while and after some thorough research I'm more than happy that the project is realistic. However I'm in need of some direction in terms of the sensors I should be using.

There will be 3 arms all connected together (Like a poor mans Microscribe). I want to read the angle between each arm and use that info to calculate the final X and Y coordinates of the final end point on the arm.

I've looked closely into forward kinematics in robot arms and understand the principles are very much the same.

I've narrowed it down to Absolute encoders or accelerometers. Unfortunately I just can't find enough documentation about how to use the encoder with Arduino. There's plenty on using an accelerometer but I can't imagine the accuracy would be as good as the encoder.

I'm hoping to get the X and Y coordinate accuracy within +/- 0.5mm. Is this accuracy feasible?

The diagram attached shows the basic principle and formula I will use.

enter image description here


Thanks for the info everyone! Seems like this is going to be a little trickier than I originally thought. I've found a project achieving something very similar, however there's no mention of it's accuracy. http://fablab.ruc.dk/diy-digitizer/

Any ideas as to what sort of accuracy he could be achieving? I understand the length of the arms are considerably shorter than mine which must help a huge deal.

  • If your angle range is suitably limited using simple potentiometers is probably the easiest option.
    – Majenko
    Jan 27 '17 at 13:32
  • Just a comment: why do you need a sensor? Can't you use stepper motors (which will provide better torque, AFAIK) and so avoid the need for knowing the position (you just need to zero the arm every time you boot it)
    – frarugi87
    Jan 27 '17 at 14:32
  • @frarugi87 stepper motors rarely have more than 200 steps per resolution. Microstepping can increase this by a factor of 16 at the cost of lower torque. That gives 0.11 degrees per step, his target accuracy would require him to gear the motor down by at least a factor of 6 to give the required accuracy. Also he would need a motor with an encoder attached in order to detect slips, if you care about absolute accuracy you can't assume a stepper did exactly what you requested.
    – Andrew
    Jan 27 '17 at 16:10

I'm hoping to get the X and Y coordinate accuracy within +/- 0.5mm. Is this accuracy feasible?

I'm only going to consider the A1 in your diagram since the accuracy of that will have the greatest impact in the final position. For the other angles any errors will have a smaller impact on the final position accuracy.

Take the most simple case, the arm is in a straight line almost completely in the X direction.

You want a Y reading of +/- 0.5 mm with an arm length of 1400 mm. That will require an angular accuracy of +/- 0.02 degrees.

Assuming you have a maximum travel of 90 degrees and you scale things such that your full ADC range is used linearly over that range then you require log(90/0.02)/log(2) = 12.1 bits resolution on your readings. So after allowing for the noise in all sensor outputs you're looking at a minimum of a 14 bit data required to give that level of resolution.

It's been suggested you use a pot connected to the internal 10 bit ADC. Assuming you used your full ADC range over 90 degrees and the 10 bit ADC reading had no noise on it you would be looking at around 2 mm accuracy. In the real world I'd be impressed if such a system could reach 5 mm accuracy.

Assuming you are working vertically accelerators could work, they typically have at least 16 bit resolution on the output but are noisy, you'd need to average for a long time in a very stable environment to get the levels of accuracy needed. Probably a non-starter.

A very quick google didn't find any easily available encoders with the required accuracy. I'm sure they exist but they are probably going to be expensive. You could possibly use gearing to improve the sensitivity of a more standard part but that's adding mechanical complexity.

In other words the accuracy you're aiming for isn't easy to achieve. You may want to look at relaxing your requirements a little.

  • Hi Andrew, thanks for taking a look. how did you go about calculating the angular accuracy? I think I could compromise on accuracy if it'd help reduce the cost of the project and make it more realistic! Jan 27 '17 at 16:43
  • The angle of a 0.5 mm error on a 1400 mm arm is asin(0.5/1400)
    – Andrew
    Jan 28 '17 at 21:08

An accelerometer is not a suitable sensor for this, unless you are working in a vertical orientation (drawing on a wall), in which case you can use the pull of gravity.

It would, though, be overly complex for what is actually a very simple requirement.

Absolute encoders in the traditional (digital) sense are also not good since they don't give great resolution without an overly complex (large number of bits) interface.

The simplest option is to use simple potentiometers. They give around 270° of rotation, which should be more than enough for most uses, and are incredibly simple to interface. They give the resolution of the ADC (10 bit) and are very very simple to read (just use analogRead()).

They are also very cheap.


Is this accuracy feasible?

possible with high accuracy encoders but unlikely with accelerometers - they also drift too much.

Also, cos(x+y) can be decomposed into cos/sin(x) and (y), making a recursive calculation possible. that can be handy if you are using a lut to calculate sin/cos.

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.