Scara Bot!

I’m new here!! I wish I found this website sooner it would’ve saved me ALOT of time.
I’ve read the wikis, forums and stuff I’m still confused.
I’m using an Arduino uno with a cnc shield and two nema 17 stepper motors in a scara config. I also have two optical end stops.
I’ve flashed 1.1 GRBL to my arduino. ( I was trying to get the GRBL scara working. GitHub - jared-hughes/grbl-scara: Modification of grbl that computes motor steps based on a SCARA coordinate system. Grbl is open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino I flash it and my board won’t connect to my gcode sender)
I’m using sandify to get gcode and send that to my bot with the google g code sender I’m also attempting to use UGS. With varying results.
I made this scara bot ( miss mash of parts and stuff this was hard to figure out. I have a google doc with the needed parts for printing if anyone is interested.)
DIY Kinetic Sand Art Table – Always Tinkering
I finally got it moving yesterday!!! It’s been like three weeks of fumbling around trying to figure this out.
I have little to 0 knowledge of coding or programming. This was a big project to take on as the first step into anything robotic at all.
My issues / questions are…
Right now I’m getting like 10 lines of gcode and then it’s not sending anymore gcode. The bot is still moving though. Is the bot working through those lines before it sends more? I have the feed rate set to f1, that still seems really fast though.
The robot is also super loud and I have no idea why.
The long arm has no belt tensioner and I feel that belt is probably too loose. (Working on a fix for this out of erector kit parts lol)
I have two optical end stops. Do I need those for homing or no?
To enter my settings into GRBL or sandify what are the steps I should take to figure out the amount of steps per rotation? How do I enter those settings? My arms are both 184mm long and I have a 20 tooth pulley with a gt2 belt.
I recently just bought a raspberry pi maker 2040. Could I use this in the build in anyway? My intention was to get rid of the Arduino but the maker can only do one stepper motor.
I know that’s a lot of questions I’m sorry
If you could just guide me to the next step that would be fantastic.
Im mostly having software issues now
These are my parts

Optical end stops
MakerHawk 6pcs Optical Endstop with 1M Cable Optical Switch Sensor Photoelectric Light Control Optical Limit Switch Module for 3D Printer https://a.co/d/91E0Eq6

Ardunio and cnc shield
kuman CNC Shield Expansion Board V3.0 +UNO R3 Board + A4988 Stepper Motor Driver with Heatsink for Arduino Kits K75 (CNC Shield+UNO R3+Stepper Motor) (K75-CNC-UK), Red Blue https://a.co/d/0dDcRdT

Stepper motors
(These ones are technically too small for what the build called for)
Twotrees Nema17 Stepper Motor Bipolar 42 Motor 4-Lead Wire with 1m Cable 23mm 42BYGH 23MM 1.5A Motor for CNC XYZ 3D Printer (Pack of 5) https://a.co/d/2Dlv4qH
(These ones are way too big but I have both of these and I’m using the smaller ones)
STEPPERONLINE 5PCS Nema 17 Stepper Motor 1.5A 12V 45Ncm (63.74oz.in) 4-Lead 39mm Body W/ 1m Cable and Connector for DIY CNC/ 3D Printer/Extruder https://a.co/d/2sYUNgg

Belts
I have two 158 mm ones and one 488 mm one
BEMONOC 2GT Timing Belt L=158mm W=6mm 79 Teeth in Closed Loop Rubber Belt 158-2GT-6 for 3D Printer Pack of 10pcs https://a.co/d/88SGRXB

Led strip
LED Strip Lights, SMD 2835 LED Strip Warm White 3000K , DC12V 1200LEDs 16.4Ft 26000LM High Density LED Light Strips Non-Waterproof, 3 Times Brightness Than SMD3528 LED Strip https://a.co/d/indTQnu

Power supply
LightingWill LED Driver 100 Watts Waterproof IP67 Power Supply Transformer, 90-265V AC to 12V DC Low Voltage Output, Adapter with 3-Prong Plug 3.3 Feet Cable for Outdoor Use, Computer Project https://a.co/d/cv76DjS

Distro block for power
20Amp 2x10 Position Barrier Terminal Block Distribution Module for AC DC https://a.co/d/7STe1vE

Raspberry pi
Not sure if I can use this in any way

1 Like

Dang! I was hoping for a funny October themed Boston Dynamics spoof… :face_holding_back_tears: :ghost: :robot:

1 Like

I was trying to figure out what you meant…
Scara… bot :joy:
Well if I get this working I can draw a ghost for you

2 Likes

Something needs to do the conversion from cartesian to scara units. This firmware does that, but so does sandify. So you have probably double converted. I haven’t used this firmware. But the first thing I would try is to just flash the vanilla, basic grbl on your board. That is well used and we know it works with UGS.

The other option is to try to use your firmware with a different sandify pattern first. Set the output to just regular gcode and use the polar limits. Start with something simple like a single loop of a square.

You need one conversion, not two.

The machine counts steps to know where it is, but it needs to know where to start. Endstops and a “homing sequence” can be used for that. The machine can move towards the endstops until they trigger and then it will know where it is. Ultimately, you will want to use it this way, but you don’t have to.

You can also just tell the machine where it is. I do this on my sand table. I push the gantry to the 0,0, location and then I send G10 L20 P0 X0 and G10 L20 P0 Y0 (well, my gcode sender does) to reset the coordinates to zero.

I would suggest starting with sending a command to zero out the machine, and disable endstops. This will give you a “corner to fight from”. If you have some lines that roughly look like a square, you can start changing things one at a time and see if it gets better or worse.

The other trick with your set up and endstops is that they will trigger even if you are not homing. Once per turn. And depending on how you set them up, they may only trigger when you have one axis already lined up. So it is best to just worry about that later.

The 2040 isn’t really a pi. It is a microcontroller like an arduino. If you wanted to replace the arduino, you would need to write a lot of software, or find someone who has. Probably not worth it. The arduino will be as fast as you want.

Maybe use it to make an RGB light setup or a joystick controller for the arduino instead.

  1. Make sure you are using all caps. Lower case doesn’t usually work.

  2. F1 is one unit per minute. If you are using my suggested 6units per rotation, that should be quite slow. You can also do 0.5 or 0.01.

Do you have the steps per unit set right? If you switch to relative coordinates (G91) and then send a movement of one unit, does the shoulder or elbow rotate 1/6th of a turn? (G01 X1 F1 or G01 Y1 F1). If not, then adjust the steps per mm ($100, $101) to make them right. My guess is that this, and the noise mean you probably are making full steps. There should be 3 jumpers under each driver, which will make them step super smooth (1/16 for a4498). They may still whine, but won’t crunch around.

$$ will show you all your settings (UGS also has a Gui version of this, I think). $100=100 will set the steps per unit to 100 for X. $101=100 will set the steps per unit of Y to 100.

If you want to actually calculate them, you need to think about your mechanism and do the math.

The stepper motors have 200 whole steps per rotation. The drivers (if you have all the jumpers installed) have 16 microsteps per whole steps. So one rotation of the motor shaft will be 3200 microsteps. If you have a 5:1 reduction from the motor pulley to the shoulder, then it will take 5x as many microsteps to move one full rotation (16000 microsteps per full rotation of the shoulder). We want 1/6th of a turn as our unit, so divide by 6: 2,667 steps per unit. $100=2667. If you don’t have the gear reduction, then it would be 5x smaller.

I can’t help with that. It doesn’t have to strum like a guitar string. It just needs to be tight enough that it wont jump teeth. The loads are extremely small.

BTW, make sure you also adjust the little potentiometer screws on the driver to a good current level. 0.2V - 0.5V is all you should need for this sand machine, unless you plan on breaking records. Don’t short the driver pins while you are doing this.

2 Likes

Don’t be shy about posting pics and videos. We love to see that kind of stuff. There are users here that know a lot more about scara and grbl than me. Posting specific questions like this, with as much info as you can gather really encourages them to speak up and teach you stuff.

Besides, I really want to see some pictures/videos of it. :+1:

2 Likes





3 Likes

That’s really neat. You can’t usually upload videos here because of file size limits. But you can post it to YouTube, or Vimeo or Google photos and put a link here.

Is there only one optical endstop?

A handful of things to be aware of using the CNC shield:

  • You can get juice for the end stops from the 5v labelled yellow connector “above” the end stop connections. I’m assuming the optical end stops need a “logic level” voltage to work. There’s also 5v and ground available on the labelled pins near the DC power input screws.
  • If you need 2 end stops, I’d plug them in to an X and a Y connection. The Arduino only has 1 end stop pin per axis available, and grbl infers the difference based on the direction it knows that it is moving. Both X- and X+ (i.e. min and max) end up connected to the same pin on the Arduino. (Note that I haven’t done a SCARA build, so if there’s documentation that says to do it different follow those instructions.}
  • Depending on the version of grbl you’re using, the SpinEn pin and the Z endstop pin(s) are swapped. This is to allow PWM control of spindle speed. Originally, the Z end stop was mapped to a pin on the arduino that supported PWM, and the spindle enable was on a digital (on/off) pin. The software mapping of the pins was changed in or after grbl v0.9 but the silkscreen on the board doesn’t get updated.
  • You can also use that 5v pin and the CoolEn signal pin to run a relay for on/off control of a lighting circuit or something else. With a simple firmware configuration change you can get a second “coolant” signal (I think on the SCL pin) to run a second relay if you need one.
1 Like

Here is some better pics for my bot. I got a lot of nuts and bolts on Amazon and tightened everything up and made it nicer.
I’m using two nuts as spacers for the stepper motors since they are smaller then the ones the guide called for.
I made belt tensioners out of erector kit parts :joy: .




5 Likes

Those pics tell a good story. I see now how the endstops are triggered. That erector velt tensioner should do the trick. Let me know how it goes with those suggestions.

1 Like

Blockquote

I was only using one at a time. The GRBL scara didn’t work at all for me so I gave up on that all together.
I was using stock GRBL

Ok so
200 steps per rotation.
I have a 20 tooth pulley on my stepper motor. The gear that is attached to is 60 teeth. So that is a 1/3 gear reduction?
So three rotations of the stepper motor makes for one turn of the bigger gear.
200 steps x 3 rotations (of the small gear)= 600 steps for one rotation(of the big gear). 16 micro steps in one step with all three pins in.
9600 micro steps per one rotation of the big gear.
9600 / 6 to get 1/6 for our units.
1600 microsteps per unit?
So
Cltr-x (clear settings and start fresh)
Move the arm to the center position of the robot. Does not matter where the arms are in relation to the center?
G92
G10 L20 P0 X0 and G10 L20 P0 Y0 (to tell the bot you are at 0)
$22=0 (disables homing for now)
$21=0 (disables hard stops)
$20=0 (disables soft stops)
$100=1600 (sets x mm per steps)
$101=1600 (sets y mm per step)
F10 for the feed rate. (Before sandify gcode)
Get a sandify gcode square (with starting and ending position in the middle.) The arm length of the bot with both arms extended is about 15 inches ( 762 mm = 30 inches). So set the polar limits in sandify to 750 mm.
Download the gcode and see what happens. Send it to ugs and see what happens!

1 Like

That all looks right to me. You can do some intermediate testing though. Before you send the gcode

G01 X3 F10 ; should rotate the shoulder half a circle.

G01 Y3 F10 ; should rotate the elbow half a circle.

Stuff like that. You should be able to play with it and get a sense for how it should work. That kind of experimenting is super valuable.

That is bigger than I thought. Very cool.

Don’t stress about it too much. Because sandify is going to output gcode in normalized values. Everything is based on the radius of the area, and the gcode only has angles. That number will affect how many line segments it has, and the scale of the preview and initial shapes. So 700 vs 750 is not functionally different.

1 Like

OK!!!
So I was able to be home today and I Finally got some testing done!!
I installed the three jumper pins underneath each driver as suggested and BAM! much quieter now.

I did this and it worked!!! This is the farthest I’ve been with this bot so far!! Very exciting.

I didnt realize its a separate option for SCARA Gcode on sandify LOL.
Now that i used the output in sandify for scara Gcode it does something!!! that is so exciting.
I am going to start testing some magnets and felt now to see if I can get the bot to move a ball around. to see what shape its drawing because it is not very clear.

1 Like

So with this the board itself does not become a relay. Your saying use the switching power to send a signal to trip a relay to turn the LEDS on and off?
Is there anyway to do dimming like this? i bought just white 3000k LED strips. Super Super bright and i would like to dim them probably. Right now I have the LEDs connected directly to 12V power with no logic inbetween. I have a switch that can turn on and off all of the 12V power for the whole table and thats it.


Tester Square.gcode (64.9 KB)

I got a straight line from that GCODE which i thought should’ve been a square?
Not really sure what happened there

1 Like

That is good progress.

My guess is that the main trouble is that the firmware needs to know where zero is.

So start with the arm straight out, and then power on the machine and try again.

And the bot is still just drawing straight lines across

square with real size.gcode (241.1 KB)

The preview isn’t going to make any sense. The coordinate frame is totally different.


The g code i linked before is what im using and this is what its making even after reseting

I still think this is a problem with the starting location.

Did you do the G10 L10 commands while the arm is straight out?