-
-
Notifications
You must be signed in to change notification settings - Fork 38
Scara GCode
SCARA machines are cool. They use a rotational joint (like a shoulder) in the middle of the machine, and then another rotational joint at half the radius (like an elbow, but 360 degree motion). The elbow joint is connected in a way to keep both motors stationary, and there are no moving wires.
It would be like the machine in this image, but the shoulder is in the middle of the workspace, not at the bottom:
Source: https://en.wikipedia.org/wiki/SCARA
There are a few different types of SCARA machines, and several ways to control them. At the request of some users, we have added some functionality to sandify to be able to control a specific type of SCARA machine. These are the assumptions:
- The two arm lengths are the same.
- The controller is marlin, or grbl, but it doesn't know the machine is SCARA. A command of 10 in X will only move the shoulder joint, not move in a straight line.
I haven't played with it, but there have been recent improvements to Marlin specifically for some types of SCARA machines. It may be easier to just use the regular gcode output, along with Marlin, configured for SCARA. If you figure this out, let us know how.
There are also some forks of grbl that are supposed to work for SCARA machines. If you figure these out, please help others find out how.
In a regular, Cartesian machine, a command to go from (0,0) to (10,0) would move in a line, moving the X axis 10 units. Marlin usually uses millimeters. In our funky coordinate system, we are using angles for the shoulder and arm. Additionally, the rotation will just keep going on and on, with some patterns rotating hundreds of rotations. Large values for the angle could cause problems for the Marlin parser, or the resolution.
So the units we use are near radians. But to make the math even simpler on the eye, we are using 6 units / rotation (instead of 2 pi, which is 6.28). A command of 6 units will do one perfect rotation. A command of 12.0 will do 2, etc.
Marlin uses "steps per unit" or "steps per mm" in the configuration (and you can set it with M92). Here is an example calculation:
200 full steps / 1 rotation * 1 rotation / 6 units * 16 microsteps / 1 full step = 533.3 microsteps / unit
M92 X533.33 Y533.33
M500
You can also adjust this unit in the sandify output. If you adjust the "Units per circle" to 360, the output will be in degrees. If you change it to 1.0, it will be in rotations. 6.28 would be in radians. Just make sure that you use the right math for the "units per rotation" and "steps per unit". If you have trouble, ask in the forums.
All the speed limits are in "units per second". Since our unit is that funky 1/6 of a rotation, then it is the amount of 1/6th rotations it can move in a second. When the arm is completely extended, the ball will move much faster than when the ball is near the center. You will need to adjust these speeds for for your machine and it's rigidity. For example, if you think it can do a rotation in 6 seconds, at the most, then the top speed should be 1unit/second. If you think that's too slow, you could change it to 2units/second, and that would do a complete rotation in 3 seconds. Any decimal value is valid, so 1.667 would take 3.6s to do a complete rotation.
Acceleration is how fast it will start or stop. This is in units/second per second. If you have a top speed of 1 unit/second and you want it to reach that top speed from a standstill in 0.1s, you would set the acceleration to 10 units/second/second. If that is too high, your machine will feel "jerky" and jump into action too fast. If that is too low, it will seem slow (even though the top speed is the same).
It is a good idea to test the machine and controller before trying to just send it on a nice looking path. If you are using the default unit size of 6/rotation, then this gcode should rotate the shoulder one full rotation:
G92 X0
G1 X6.000 F60
This should send the elbow around one half of a rotation:
G92 Y0
G1 Y3.000 F60
The 0,0 location should be with the arm straight out, at the top of the pattern. If that isn't where your endstop are, you could add a G92 to your homing sequence to adjust that 0,0 location.
This is all very experimental. This started because a handful of people were asking for help in the forums at v1engineering.com. This is really just a shortcut for those users. There are a lot of advantages to a SCARA machine (mostly, it looks cool). But if you aren't interested in taking a risk on your build, or you aren't trying to move the envelope, then you should build a ZenXY machine or buy a Sisyphus Inc. sand table. They both work very well and have a very healthy community.