Introduction: Single Arm SCARA Plotter - With "HOMING"

About: PLC, Arduino - Do it yourself project

About 3 years ago, I made my own a simple robot arm and published it at: https://www.instructables.com/DIY-SINGLE-ARM-SCARA-ROBOT/. Until now, many people, especially students continued to ask me questions about how to "HOMING" this robot arm. Today I rebuilt this robot arm based on Marlin firmware and added "HOMING" function to the 3 axes of this SCARA plotter. Please watch my video before getting started.

Supplies

First of all, I would like to sincerely thank to EEmentor for the sponsoring and supporting me on this project.

A. Main parts:

⦾ 1pcs x Arduino Mega 2560.

⦾ 1pcs x RAMPS 1.4 Controller. (Or RAMPS 1.6)

⦾ 1pcs x LCD 2004 including ribbon cables and PCB adapter for Ramps 1.4.

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

⦾ 2pcs x Stepper Motor NEMA 17.

⦾ 1pcs x CD/DVD ROM for Z axis

⦾ 2pcs x Endstop Mechanical Limit Switches 3D Printer Switch for Arduino RAMPS 1.4.

⦾ 2pcs x Micro Limit Switch for Z axis.

⦾ 2pcs x GT2 Timing Pulley 16 Teeth.

⦾ 2pcs x GT2 Timing Pulley 20 Teeth.

⦾ 2pcs x GT2 Timing Pulley 60/80 Teeth.

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

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

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

⦾ 1pcs x Round shaft vertical support.

⦾ 4pcs x Horizontal Bearings 8mm.

⦾ 1pcs x V-Slot Aluminium Profile 2020, length 200mm.

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

⦾ 4pcs x Aluminum 2020 Corner Bracket.

⦾ 1pcs x Power Supply PSU 12 VDC.

⦾ 1 meters x Two cores Power Cable 1.5/2.5 mm2 for main power supply.

⦾ 2 meters x Cable Spiral Wrap, small size.

⦾ 1 meter x Cabe Tray 20x20.

⦾ Aluminium and wooden plate.

⦾ Some small cable tiescable spiral wrap, bolts and nuts.

B. PVC pipes and fittings:

⦾ 4pcs x PVC Tee or Cross Ø42mm.

⦾ 1pcs x PVC Tee Ø27mm.

⦾ 1pcs x PVC Reducer Ø42mm to Ø27mm.

⦾ 5pcs x PVC End Cap Ø42mm.

Step 1: Stepper Motors Preparation

I prepared 2pcs x NEMA 17 stepper motors with long and short shaft and temporarily fixed 2pcs x GT2 timing pulley 20 teeth on them.

2pcs x GT2 closed timing belts 200mm and GT2 60 teeth timing pulleys were also prepared for drilling on the mounting support in the next step.

Step 2: Mounting Frame

Drill holes in the aluminum plate to mount the stepper motors and pulleys.

I assembled 2020 aluminum profiles 200mm and 100mm long into an L shape and connected them to the aluminum plate. One shaft 8mm and bearing was used to mount the Scara's shoulder parts.

Step 3: Shoulder Assembly

I used PVC fittings to assemble Scara shoulder parts.

Stepper mottors, pulleys, timing belts, shoulder PVC fittings were arranged as below. The bottom 60-tooth pulley was tightened onto the shaft to drive the top 20-tooth small pulley, it will link to the SCARA's elbow. And the 60-tooth pulley that attached to the PVC fitting (upper 60 tooth pulley) was not tightened to the shaft, it drives directly to the SCARA's shoulder.

Step 4: Elbow Assembly

The SCARA elbow was also made of PVC fitting and was driven via a 400mm closed timing belt from top pulley shoulder.

Elbow joint was coupled to the end-effector by a round bar clamping support plus small aluminium profile 2020 and PVC reducer 42mm to 27mm.

The elbow shaft was fixed by 2 locked bearings at the top and bottom.

Step 5: Reinforced Frame and Base

I used one wodden plate and 4pcs x steel channels to reinforce the foot base.

The vertical aluminum profile was also stiffened by some corner brackets.

Step 6: RAMPS 1.6 and LCD

I have installed an Arduino Mega 2560 and RAMPS 1.6 on the aluminum plate and they were all placed the robot arm's top.

An LCD was also mounted on the aluminium plate.

Step 7: Endstops

I prepared 2 small supports for X (shouder) and Y (elbow) endstops.

Mounting X endstop on the vertical aluminium profile.

And Y endstop was fixed on the PVC fitting - linkage arm 1.

Step 8: Connection and Power Supply

I connected all wires of X and Y axes to RAMPS 1.6.

One power supply 12VDC was installed underneath wooden plate.

Step 9: Z Axis

I used an DVD/CD ROM stepper motor and its frame to build Z axis. Since the aluminum profile 2020 fitted perfectly inside an 27mm diameter PVC pipe so I could easily do this Z axis assembly.

One micro switch was mounted on the CD/DVD frame as Z max endstop.

Step 10: Cable Protection

I used one small cable tray dimension 20x20 to cover all wires going from bottom to top.

I fixed all wires running along the robot arm with cable ties.

In the end, it didn't look very pretty, but my SCARA plotter was equipped with enough functions to operate for studying and testing.

Step 11: SCARA Marlin Firmware

My SCARA plotter is based on Marlin firmware 2.0.7. I have configured as follows:

1/ Parameters setting in "Configuration.h"

⦾ SCARA Settings

#define MP_SCARA
#if EITHER(MORGAN_SCARA, MP_SCARA)
  // If movement is choppy try lowering this value
  #define SCARA_SEGMENTS_PER_SECOND 30

  // Length of inner and outer support arms. Measure arm lengths precisely.
  #define SCARA_LINKAGE_1   180    // (mm)
  #define SCARA_LINKAGE_2   260    // (mm)

  // 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    75       // (mm)
  #define SCARA_OFFSET_Y    -200       // (mm)

  #if ENABLED(MORGAN_SCARA)
    //#define DEBUG_SCARA_KINEMATICS
    #define SCARA_FEEDRATE_SCALING  // Convert XY feedrate from mm/s to degrees/s on the fly
    // Radius around the center where the arm cannot reach
    #define MIDDLE_DEAD_ZONE_R   0  // (mm)
    #define THETA_HOMING_OFFSET  0
    #define PSI_HOMING_OFFSET    0

  #elif ENABLED(MP_SCARA)
    #define SCARA_OFFSET_THETA1  -45.0 // degrees
    #define SCARA_OFFSET_THETA2 135.0 // degrees
  #endif
#endif

⦾ Endstop Settings

#define USE_XMIN_PLUG
#define USE_YMAX_PLUG
#define USE_ZMAX_PLUG

#define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Y_MAX_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Z_MAX_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.

⦾ Stepper Drivers

#define X_DRIVER_TYPE  A4988
#define Y_DRIVER_TYPE  A4988
#define Z_DRIVER_TYPE  A4988

⦾ Movement Settings

#define DEFAULT_AXIS_STEPS_PER_UNIT   { 26.67, 26.67, 106.67, 93 }
#define DEFAULT_MAX_FEEDRATE          { 5, 5, 5, 25 }
#define DEFAULT_MAX_ACCELERATION      { 100, 100, 20, 20000 }

⦾ Direction of endstops when homing

#define X_HOME_DIR -1 // MIN
#define Y_HOME_DIR 1 // MAX
#define Z_HOME_DIR 1 // MAX

⦾ The size of the print bed

#define X_BED_SIZE 150
#define Y_BED_SIZE 150

⦾ Travel limits (mm) after homing, corresponding to endstop positions

#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 25

⦾ Manually set the home position

#define MANUAL_X_HOME_POS 202.28
#define MANUAL_Y_HOME_POS -67.28

⦾ Validate that endstops are triggered on homing moves

//#define VALIDATE_HOMING_ENDSTOPS

⦾ LCD and SD support

#define LCD_LANGUAGE en
#define DISPLAY_CHARSET_HD44780 JAPANESE
#define LCD_INFO_SCREEN_STYLE 0
#define SDSUPPORT
#define SD_CHECK_AND_RETRY
//  Set this option if CLOCKWISE causes values to DECREASE
#define REVERSE_ENCODER_DIRECTION
#define SPEAKER

⦾ LCD / Controller Selection

#define REPRAP_DISCOUNT_SMART_CONTROLLER

2/ Parameters setting in "Configuration_adv.h"

⦾ Enable QUICK_HOME

#define QUICK_HOME                          // If G28 contains XY do a diagonal move first

I have referenced to this topic for my SCARA plotter: https://github.com/MarlinFirmware/Marlin/issues/20764. It's really helpful!

Step 12: SCARA Parameters

My SCARA plotter setting can be summarized by an Excel picture as below:

The blue square represents the print bed (or plotting area 150mm x 150mm in my case), with coordinates described as follows:

  • The red coordinates at the 4 corners represent the true position without offset.
  • The green coordinates at the 4 corners represent the position after offset (SCARA_OFFSET_X = 75 and SCARA_OFFSET_Y = -200), with the new origin at position (0, 0) colored green.

The two red lines represent SCARA_LINKAGE_1 and SCARA_LINKAGE_2 with coordinates (x, y) at JOINT 0, JOINT 1 and JOINT 2. In the image above, the robot arm is in the home position and has the following angle parameters:

  • SCARA_OFFSET_THETA1 = -45.0 degrees (SCARA_THETA)
  • SCARA_OFFSET_THETA2 = 135.0 degrees (SCARA_PSI)

With the angles SCARA_THETA = -45.0 degrees and SCARA_PSI = 135.0 degrees, the corresponding coordinates of the end-effector (JOINT 2) are: X= 127.28 and Y = 132.72. (See picture below for "Forward Kinematics", where the input are joint angles and the output are Cartesian coordinates)

Since we consider the bottom left corner of the print bed as the new working origin (we want to set it as X=0 and Y=0 while its actual coordinates are X = -75 and Y = 200), so it has to move from this new origin position to SCARA's home position (with coordinates X = 127.28 and Y = 132.72) a distance of: deltaX = 202.28 and deltaY = -67.28.

  • MANUAL_X_HOME_POS = 202.28
  • MANUAL_Y_HOME_POS = -67.28

Step 13: SCARA Homing

To find the "HOME" position of my SCARA robot, I firstly determined the X and Y directions.

I adjusted the robot arm as shown in the picture above, it coincided with the Y axis in the positive direction. So at this location, the SCARA robot had coordinates X = 0 and Y = 440. From Repetier-Host, I set the current position to the values specified by G92 command.

G92 X0.0 Y440.0

After the G92 command, the Marlin firmware understood this as the assigned coordinates. What's left was for me to move the X and Y axis individually until it hit the its endstop. I recorded these values, in my case, they were: X= 127.28 and Y = 132.72.

To know the angle parameters, I continued to use the G92 command. Note that after each G92 command, Marlin will print the angles information displayed on the Repetier-Host screen.

G92 X127.28 Y132.72

Note: We can use this method to do manual HOMING the SCARA robot each time we start using it, without needing endstops but it will be time consuming and inaccurate.

As configuration on the STEP 11, the SCARA plotter will move in order and direction as follows, when doing "Homing":

#define X_HOME_DIR -1 // MIN
#define Y_HOME_DIR 1 // MAX
#define Z_HOME_DIR 1 // MAX

Firstly, the plotter's Z pen move up to clear workspace until it hits the Z MAX limit switch.

Secondly, shoulder motor (X axis) move in negative direction until it hits the X MIN limit switch.

Thirdly, elbow motor (Y axis) move in positive direction until it hits the Y MAX limit switch.

After "Homing", the SCARA plotter understands this position as the manual home position with coordinates as picture below:

As we can see, their coordinates after homing are:

  • MANUAL_X_HOME_POS = 202.28mm.
  • MANUAL_Y_HOME_POS = -67.28mm.
  • Z_MAX_POS = 25mm.

If we connect SCARA plotter to Repetier-Host software or other similar softwares, then in addition to coordinate parameters, we also get the information about angles when "Homing" is completed.

In my case, the shoulder and elbow angles are:

  • Theta = 45 degrees.
  • Theta + PSI = 90 degrees.

Step 14: Testing

I have tested my robot arm by drawing circle, rectangle, text and image as shown below.

Because my plotter's elbow is quite long (about 260mm), plus its gear ratio is both low and the Z axis moves in an oblique direction, so it doesn't work very well. But it is worth doing for learning purposes before making a more complete and accurate machine.

Step 15: Conclusion

Thank you for reading my works!!!