Introduction: Spaceship Scara Arm

About: PLC, Arduino - Do it yourself project

The weather got hotter and hotter, causing my ceiling fan to break while I was at work. When I took it down and moved the fan shaft by hand, it rotated concentrically and smoothly. It looked heavy, compact, and especially its rotation shaft worked well, so this gave me the idea of building a special robot arm that can freely rotate 360 degrees by reusing this broken fan, named "Spaceship Scara Arm".

Please check my introduction video before getting started.

Supplies

First of all, I would like to sincerely thank SEEED STUDIO for the sponsoring and supporting me on this project. If you want to buy High Quality Modules at low price or make the PCB, 3D printing & CNC machining or Customized Engineering Solutions for your project, please visit the SEEED STUDIO website to get exciting discounts and coupons.

⦾ 1pcs x Arduino UNO R3 or Combo Arduino + CNCShield + A4988.

⦾ 1pcs x Arduino CNC Shield V3 GRBL.

⦾ 2pcs x A4988 Stepper Driver Module. (Or 2pcs x DRV8825)

⦾ 2pcs x Stepper Motor NEMA 17.

⦾ 2pcs x GT2 Timing Pulley 16 Teeth, 5mm Bore Diameter.

⦾ 1pcs x GT2 Timing Pulley 20 Teeth, 8mm Bore Diameter.

⦾ 1pcs x GT2 Timing Pulley 60 Teeth, 8mm Bore Diameter.

⦾ 2pcs x GT2 Timing Pulley 80 Teeth, 8mm Bore Diameter.

⦾ 2pcs x GT2 6mm Closed Timing Belt 200mm.

⦾ 1pcs x GT2 6mm Closed Timing Belt 400mm.

⦾ 1pcs x Round Shaft Diameter 8mm, Length 200mm.

⦾ 1pcs x Round Shaft Diameter 8mm, Length 100mm.

⦾ 2pcs x Round shaft vertical support.

⦾ 2pcs x Flange Ball Bearing F688ZZ 8x16x5 mm.

⦾ 3pcs x Ball Bearings 8x22x7mm.

⦾ 5pcs x V-Slot Aluminium Profile 2020, length 100mm.

⦾ 2pcs x Aluminium Corner Bracket for mounting stepper motors. It has enough space to mount a stepper motor and an 80-teeth gear.

⦾ 4pcs x Straight Bracket 150x25x3mm for robot arms. In my country, it is pre-drilled some holes and sold in consumer goods stores, it looks like this:

⦾ 2pcs x Corner Bracket for mounting controller and motors.

⦾ 1pcs x Power Supply PSU 12 VDC.

⦾ 1pcs x Fan 4010 for stepper motor drivers cooling.

⦾ 1 meters x Cable Spiral Wrap, small size.

⦾ Some small PVC fittings, bolts & nuts M4 & M5.

Step 1: Robot Arm Structure

My spaceship SCARA arm is structured as follows:

Main features:

- Can stand and balance on its own because the ceiling fan's mass is heavy enough.

- Can rotate freely 360 degrees.

- Working radius is 320mm.

- The gear ratio of my robot shoulder is 1:5 and the elbow is 1:15.

- Made mainly of aluminum profiles and steel plates.

Step 2: Preparing a Ceiling Fan

Firstly, I removed 3 fan blades, hanging supports and cut off 3 exposed wires of the fan. Try to cut them as deep inside as possible.

The rest of ceiling mount, as shown in the picture, has a hole that fits an 8mm shaft, which may be a little loose. If it is loose, we can add a thin layer of tape or heat shrinkable tube on the 8mm shaft (in my case it's 200mm long). Try to push this shaft as deep as you can.

Step 3: Arms Assembly

I cut a piece of aluminum profile, about 42mm long, and tightened it to the base of a shaft vertical support by bolts and T-nut M5. I made two identical sets like this.

I drilled a 16mm diameter hole in the 2pcs x straight brackets and installed F688ZZ (8x16x5 mm) shield ball bearings into those holes.

Then I connected two parts above and a 100mm aluminum profile together, which created a shoulder for the robot. And the robot's elbow was also made in a similar way. I took advantage of existing drilled holes without having to drill additional ones. It's nice that these straight brackets were all pre-drilled for M5 countersunk bolts.

As you can see, the robot arm's shoulder and elbow were joined through an 8mm shaft, about 65mm long. For the elbow, I used an additional 60 tooth gear to drive it.

Once the arm was done, it could be rotated freely without getting stuck. There was a small gap between shoulder and elbow arm because I used M5 countersunk bolts and one ball bearing to fix this gap.

Step 4: Elbow Transmission Gear

This intermediate part combines two 80-tooth and 20-tooth gears to produce a 1:15 gear ratio for the elbow joint.

The picture below is the test version with 20 and 60 teeth I made from PVC pipe.

For the 20-80 teeth version, I added one ball bearing in the middle of PVC fitting for smooth movement.

The part above was glued inside the part below.

It looks like that finally.

Step 5: Final Assembly

Shoulder and elbow stepper motors were mounted on the aluminium plates. The shoulder motor standed on the fan body and they are stacked on top of each other. I think it would balance better if they were mounted symmetrically around the center of the celing fan.

Robot arms are mounted and tightened on the shoulder and elbow shafts 8mm. At the elbow, I drilled a small hole and installed a countersunk bolt M4 on the shaft vertical support to prevent arm from slipping.

Arduino Uno and CNC shield were covered by a box with cooling fan.

Done.

My spaceship robot arm can stand on its own, but we should put it on a mat with lightly rough surface for preventing slipping. In addition, there are a few M6 bolts around its outer ring, which makes it easy to mount under the sand table, for example.

Step 6: Gear Ratio

As I mentioned in the steps above, the gear reductions of the shoulder and elbow joint are different.

Due to this mechanics structure, as well as the gearing involved, rotating the shoulder joint actually causes the elbow joint to rotate by a third of the shoulder’s motion in counter-rotating direction. So to make robot arm work properly, we need to do an elbow correction in the firmware or software (when generate Gcode) for every shoulder movement.

As we can see, when I rotate my shoulder joint 90 degrees counterclockwise while holding my elbow tight, the elbow itself rotates 30 degrees clockwise. It is equal to 1/3 of the shoulder joint movement in the opposite direction. If I am not clear on this point, my robot arm will never be parameterized and calibrated properly.

Step 7: Firmware and Software

I have installed the GRBL firmware with both version: SCARA GRBLand ORIGINAL GRBL firmware plus SANDIFY software. Both of them worked perfectly.

A. SCARA GRBL:

⦾ In the file "scara.h", my setting is as follows:

// Length of inner and outer support arms. Measure arm lengths precisely.
#define SCARA_LINKAGE_1 160.0f // 160mm
#define SCARA_LINKAGE_2 160.0f // 160mm

// SCARA tower offset (position of Tower relative to bed zero position)
// This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
#define SCARA_OFFSET_X -320.0f
#define SCARA_OFFSET_Y 0.0f

#define MANUAL_X_HOME_POS 0.0f // Theta
#define MANUAL_Y_HOME_POS 0.0f // PSI
#define MANUAL_Z_HOME_POS 0.0f

⦾ In the file "scara.c", I corrected the SCARA_psi parameter by adding a value (SCARA_theta/3) in the "inverse_kinematics" function as explained.

 SCARA_theta = (atan2f(SCARA_K1, SCARA_K2)-atan2f(SCARA_pos[X_AXIS],SCARA_pos[Y_AXIS]));
 SCARA_psi   =   atan2f(SCARA_S2,SCARA_C2) + SCARA_theta/3;

⦾ GRBL parameters:

A Steps per Degree (SPD) parameter is defined for each stepper motors in order to determine the number of steps is required to move per degree. The SPD for each motor is dependent on the step per revolution (or step angle), gear ratio and driver's micro-stepping according to the formula:

Steps per Degree = ((Steps per Revolution)*(Micro-stepping)*(Nd/Ns))/360°

GRBL $100 & $101 are calculated as follow: Two stepper motors have 200 steps for 1 complete revolution (or 1.8° step angle), which means.

  • $100 - Shoulder motor is geared down by factor 5:1 (Nd/Ns = 80/16). With the A4988 drivers set to 1/16th micro-stepping that makes 44.444 steps per degree.
  • $101 - Elbow motor is geared down by factor 15:1 (Nd/Ns = (80/16) x (60/20)). With the A4988 drivers set to 1/8th micro-stepping that makes 66.667 steps per degree.
  • Setting $1 = 255 keeps stepper motors always enabled and prevent the motors from moving when the robot arm is stationary. We can use this command to hold the axis, otherwise the vibrations may cause a drift.

B. ORIGINAL GRBL firmware plus SANDIFY software:

Sandify by Jeffeb3, is a web based user interface to create patterns, used for robots that draw in sand with ball bearings.

When I used the GRBL firmware for my arm, I couldn't take full advantage of the 360-degrees rotation of the mechanism. For example, when I want to draw a circle centered on the fan axis, it will draw all the way to the 3rd quadrant and then rewind to draw the remaining quadrant, which is really undesirable.

It's really interesting that Sandify was able to overcome this problem, as it came up with a software solution based on theta and rho, combined with original GRBL firmware. Jeff Eberl (Sandify's author) has a very clear and good explanation about theta and rho in this topic.

With Sandify, the controller is GRBL but it doesn't know the machine is in SCARA mode. The Sandify defines 6 units per circle in default (instead of , or 360° per rotation/ circle). A command of 6 units, for example G0 X6, will do one perfect rotation on the shoulder joint. We can adjust this unit in the sandify output when we generate an G-Code. If units per circleis 360 or, the output will be in degrees/radians and fully match with GRBL setting above. In this case, my step/unit settings are still the same: $100 = 44.444 and $101 = 66.667.

But I like to use units per circle 6 by default so my step/unit setting on GRBL would be:

Steps per Unit = ((Steps per Revolution)*(Micro-stepping)*(Nd/Ns))/6

  • $100 - Shoulder motor is geared down by factor 5:1 (Nd/Ns = 80/16). With the A4988 drivers set to 1/16th micro-stepping that makes 2666.667 steps per unit.
  • $101 - Elbow motor is geared down by factor 15:1 (Nd/Ns = (80/16) x (60/20)). With the A4988 drivers set to 1/8th micro-stepping that makes 4000.000 steps per unit.

Actually, you can set "units per circle" to any number you like, just the "steps per unit" parameters, $100 and $101 in GRBL firmware, are calculated accordingly.

Due to elbow reduction gear, I had to modified at "sandify/src/common/geometry.js" to correct the elbow movement as follow:

// Convert theta, rho vertices to goofy x, y, which really represent scara angles.
export const toScaraGcode = (vertices, unitsPerCircle) => {
  return vertices.map((thetaRho) => {
    const theta = thetaRho.x
    const rho = thetaRho.y
    const m1 = theta + Math.acos(rho)
    const m2 = theta - Math.acos(rho)
    const x = (unitsPerCircle * m1) / (2 * Math.PI)
    const y = (unitsPerCircle * m2) / (2 * Math.PI) - 2*x/3
    return new Victor(x, y)
  })
}

The value " - 2*x/3" was used to correct the elbow joint rotation in the formula above.

I installed and run Sandify locally due to gear ratios discrepancy. We can run it online at: https://sandify.org/ if our shoulder & elbow gear ratios and both arm lengths are the same. We can download Sandify at this GitHub and check out the Wiki for lots of details on features.

Step 8: Sandify Software

⦾ Machine setup:

  • Type: Polar.
  • Max radius (mm): 320.
  • Start point: Center.
  • End point: Center.

⦾ Selecting layer type (image or text) and effects: I've tested simple shapes like: circle, heart, star and wiper....

⦾ Gcode exporting: Note that when exporting Gcode files, I set the "unit per circle" to 6 as mentioned above. We can also define:

  • Program start code: for example, G1 F50 (Set feedrate to 50).
  • Program end code: for example, G0 X0 Y0 (Go to HOME after completing the Gcode).

Step 9: Robot Testing

With Sandify, I placed my spaceship robot in the "home" position by stretching its arms out toward the controller.

For the SCARA mode, pay attention on these parameters below (in the file "scara.h") when robot arm in home position. Following the picture above, my robot arm is stretched its arms out toward left side (coordinates X=-320, Y=0 and Theta = 0, PSI = 0).

  • SCARA_OFFSET_X = -320.0f // -320mm
  • SCARA_OFFSET_Y = 0.0f // 0mm
  • MANUAL_X_HOME_POS = 0.0f // Theta
  • MANUAL_Y_HOME_POS = 0.0f // PSI

The Sandify gcode for a "STAR" shape viewed in NCViewer looks like this.

You can see the robot's operation in the introduction video. Because I set the "start point" and "end point" at the center, plus the robot arm returns "home" every time it completes its task by "program end code: G0 X0 Y0". So we can see that my spaceship robot arm rotate to center of the ceiling fan before and after drawing a shape, then go back to "Home" at the end.

Step 10: Improvements

I don't have any woodworking skills or tools, so I can't make a beautiful sand table. But I believe this robot will work well. If I had a wooden table, the improvements and additional parts to equip this arm in the next step are:

⦾ Install optical or proximity sensors for homing.

⦾ Integrate an additional GRBL offline controller (I have done it on this Instructables) or Raspberry Pi.

⦾ Install RGB LED Strip.

⦾ I have a DC solenoid coil, its core has a diameter 8 mm. It gave me the idea that magnetic force could also be controlled to attract or not attract a steel ball.

In this case, I need an electrical collector slip ring to convert fixed wires to spinning wires. And we can use not only one but also some steel balls on the sand table.

Another interesting thing, when I looked through the modded SCARA GRBL firmware, although I haven't try it yet, but I think that it can be used in both SCARA mode and SANDIFY mode by the following way:

⦾ Install GRBL SCARA firmware.

⦾ Setting parameters as STEP 7 - A. SCARA GRBL.

⦾ Use G95 to switch the working mode, because SCARA firmware has this function built-in and is defined as follows:

  • In the "scara.c"
if(!angle_mode)
{
f_scara[X_AXIS] = DEGREES(SCARA_theta);
f_scara[Y_AXIS] = DEGREES(SCARA_psi);
f_scara[Z_AXIS] = cartesian[Z_AXIS];
}
else
{
f_scara[X_AXIS] = cartesian[X_AXIS]; 
f_scara[Y_AXIS] = cartesian[Y_AXIS]; 
f_scara[Z_AXIS] = cartesian[Z_AXIS];
}
  • In the "gcode.c"
#ifdef IS_SCARA
case 95:
angle_mode=!angle_mode;
break;

⦾ Use G92 to specify home coordinates.

⦾ In case the arm is in SCARA mode, command "$V" to print SCARA position (Theta & PSI) for cross-checking.

⦾ In case the spaceship robot is in angle (Sandify) mode, we set "units per circle" in Sandify software to 360 before generating Gcode.

Step 11: Conclusion

If you are passionate and want to learn about robot arm, I think this is a good way to make your own robot. Because ceiling fan is very popular in homes, it is easy to make, looks unique, sturdy, and we can minimize damage to equipment or components during the learning process because it can rotate freely.

Thank you for reading my works!!!

Fix It Contest

Participated in the
Fix It Contest