I found a super cheap robot arm for the C-Back-Hat.

  • I'm going through all my M5Stack purchases and making something for each of them.
    My latest project is a 4 degrees of freedom (basically 4 servos) robot arm featuring some ultra tiny 1.7g hk-5320 servos and a bit of 3D printing that I'll use my M5StickC Plus and the C- Back Hat... the worlds smallest DIY robot arm!

    In the mean time, I wanted to test some code out on an arm and I found the cheapest one was on banggood.... £15 all in, including the servos.

    It doesn't come with a controller board - but that's ideal, as the M5Stick's going to be the controller!

    A 4 DOF robot arm is interesting - it's movement can be broken down into 3 main parts:

    1. 1 motor spins your arm around a half circle. (servos usually go 180 degrees max)
    2. 1 motor controls the grasping clamp at the end.
    3. The magic happens with the last 2 motors... they're just like your own shoulder and elbow. Imagine resting your shoulder on a desk, rotating your shoulder joint and moving your arm across the desk and bending your elbow means you can reach all parts of the desk surface.

    Servos are evil, they take an angle as their mode of control. So the sticking point with MOST the simple controllers you see is that you have to move each servo at a time, angling the arm out, then angling it down to pick something up.

    It'd be much easier to ask it to move to an x/y position away from the base of the arm.

    With that in mind, if you want to write your own servo robot arm controller, I've included a function I found that given an X/Y position, provides the two servo angles for the "shoulder and elbow" part of the robot:


    And here's the robot arm I found:

  • This post is deleted!