Recently, I've been wanting to buff up my electro-mechanical skills, with a project focused on exploring the capabilities of the Arduino.
The Arduino I own has been mostly gathering dust for the last couple of years, so I set out to come up with a project to utilize it.
Coming up with a good, unique project idea was actually harder than I initially figured it would be. In my experience, good ideas often form when I'm working with a new tool and exploring it's capabilities. But at the moment, I don't have much experience working with these components, so I don't know enough to begin to think creatively.
So, I decided to pick a basic, tried-and-true Arduino project to get my feet wet - the robot arm.
First of all, a disclaimer -- the details of this project come almost entirely from the Arduino DIY site How To Mechatronics. Here is my rationale for lifting the CAD and component selection:
My intent for this project is to begin working the Arduino and other control components. I'm less interested in using designing 3D models for printing, as I'm already quite comfortable with that.
I ended up putting my own spin on the project, making it (slightly) uniquely my own
All that aside, let's get into it!
I started by printing out the arm pieces in PLA, and sourcing the servo motors to control all axes of movement.
There are 6 axes of motion in this robot arm, each controlled by a dedicated servo motor. Starting from the ground up, these are:
Base rotation
"Shoulder" rotation
"Elbow" rotation
"Wrist" twist
"Wrist" rotation
Gripper
The first 3 axes each utilize a MG966R servo for simple rotation; the other 3 use smaller, lighter SG90 servos. The gripper end uses a simple design to achieve a "pinching" motion -- a pair of four-bar linkages, connected by opposing gears, and attached to the final servo.
So, without having to do much "brain work" upfront, the project entered the assembly stage almost immediately.
The mechanical side of things was pretty straightforward. Moving parts were connected with M3 bolts and locknuts, tiny screws connected printed pieces to servo "horns", and more tiny screws connected those horns to the servos themselves. Overall, a pretty great design. Thanks, How To Mechatronics!
The electrical side of things was a bit trickier for me, even with the dedicated help of my wire organization assistance cat (pictured above).
The servos individually are dead simple to wire up -- a lead for 5 volts power, one for ground, and a control wire that gets a signal from the Arduino. Likewise for the potentiometers (more on them in a minute), which wire up to power and have an analog input signal wire read by the Arduino. So, in all, 6 wires into the Arduino, and 6 wires out, plus power and ground.
However, getting these hobby wires to actually attach reliably was a nightmare. I don't know if I just have cheap jumper wires or what, but the connectors were constantly loose and separating from one another. Even this small project quickly became a rat's nest of wiring between breadboard and Arduino, and tracking down disconnected wires was a problem I was keen to avoid. So, I eventually just soldered a lot of the loose connections.
Speaking of wiring, I decided to forgo the smartphone-control system of the guide I was following, and instead design a simple control box. The control box would use 6 potentiometers to control each servo directly - the "wiper" of each potentiometer sends an analog signal to the Arduino, which is read and remapped in the programming to a rotation degree to send to the servo.
And then, everything was assembled and it was time to test!
Initially, the movement of the arm was very jerky. So, I added in a looping line of code to each servo output to slow it down, which looked something like this:
new_output_value = (alpha*input_value) + ((1-alpha) * previous_output_value)
Again, this isn't my original idea, but the point is to only incrementally change the new target position for the servo, rather than asking it to jump to the new value as fast as possible.
So, that's it! It's functional for now, but there are some things I would like to implement in the future.
Firstly, I want to implement inverse kinematics: rather than directly controlling the servos, I could, for example, have the first 3 knobs on my control board instead correlate to a requested x,y,z position in space for the wrist joint, and code some maths behind the scene to accomplish this. There's lots of resources out there that walk through this - I've already worked out the maths, actually.
Secondly, I want to continue working on smoothing out the motion. In addition to the jitters, there is an odd "pulsing" behavior I'm seeing with the steppers, where something is causing their requested values to slightly fluctuate rhythmically, and in time with one another. Knowing little about why this is happening, I'd like to get to the bottom of it.
So, I've got my work cut out - until next time!