Arduino CNC Shield with GRBL having some issues - Page 1
Forum section: electronics / beginners

author: sairfan1
author_rank: Frequent Contributor
timestamp: May 11, 2021, 08:47:02 pm
content: Its my first effort to setup CNC for now I'm using two axis X and Y to build a pen plotter or may be getting them move is enough.I'm setting up Arduino CNC Shield with DRV8825 drivers on it, stepper motors are RB 17HD0004-7 they are 12V 0.28A I set the DRV8825 accordingly, connections are as belowMotor DRV88251. Black....... A12. N/A3. GREEN....B14. BLUE.......A25. N/A6. RED.........B3After that i wrote an Arduino based simple program to move motors X and Y and I was able to move both motors in both directions by just sending pulse.Now it was the time to download GRBL, after upload GRBL to Arduino and connect through Universal GCode SenderOn setup wizard I setup limit switch as i have installed two for homing the machine, on wizard window i was able to see switches are working and they are normally open. (by pressing switch it shows RED and normally it shows GREEN)From UGS Jog I can move motors to X and Y directions (both plus and minus directions) If i send command G28 X5 axis moves as expected.When i press Home button on the UGS motors make a squeaky sound and do not move at all, if I try to move axis by hand they are badly stuck, if i turn of the power again I can move both axis smoothly by hand. I have been spent more than 3 days to solve this issue but no luck.Here are the current GRBL settings.$0=10 (step pulse, usec)$1=25 (step idle delay, msec)$2=0 (step port invert mask:00000000)$3=0 (dir port invert mask:00000000)$4=0 (step enable invert, bool)$5=0 (limit pins invert, bool)$6=0 (probe pin invert, bool)$10=3 (status report mask:00000011)$11=0.010 (junction deviation, mm)$12=0.002 (arc tolerance, mm)$13=0 (report inches, bool)$20=0 (soft limits, bool)$21=1 (hard limits, bool)$22=1 (homing cycle, bool)$23=3 (homing dir invert mask:00000011)$24=25.000 (homing feed, mm/min)$25=500.000 (homing seek, mm/min)$26=250 (homing debounce, msec)$27=5.000 (homing pull-off, mm)$100=1000.000 (x, step/mm)$101=100.000 (y, step/mm)$102=250.000 (z, step/mm)$110=500.000 (x max rate, mm/min)$111=500.000 (y max rate, mm/min)$112=500.000 (z max rate, mm/min)$120=10.000 (x accel, mm/sec^2)$121=10.000 (y accel, mm/sec^2)$122=10.000 (z accel, mm/sec^2)$130=200.000 (x max travel, mm)$131=200.000 (y max travel, mm)$132=200.000 (z max travel, mm)

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 12, 2021, 01:46:13 am
content: I would take out my oscilloscope and start following the signals from the microcontroller to the stepper motor drivers, and verify things like the pulse widths for the steps, and if the timing while changing direction is correct.As these are logic signals, you can check most of it with an USD 10 logic analyser ("saleaeae clone") and Sigrok / Pulseview, but be careful because the stepper drivers also have much higher voltages on their pins. (I'm not sure if those cheap boxes can tolerate 24V on their inputs, but they do have some protection inside so 12V is probably tolerable for them.Which brings it to the question of what is the motor power voltage?24V would be common, but at low speed a lower voltage (even down to 5V (if your drivers tolerate it) should also work.Some of these stepper motor drivers also have potentiometers for setting the motor current, and these should be adjusted on first use.But apparently it works with normal G-code and you only have a problem with homing.That's a bit weird.G28 is also not a normal move command. Those are G0 (for a rapid move) and G1 (for move with feed rate)G28 goes to some predefined position.I do not even have end switches on my CNC. I just jog it to a corner of my workpiece and then set that position as (0, 0, 0).If you ignore (or disable) the homing, does your CNC respond to G0 and G1 move commands?It's also likely that you get better answers if you ask this on a GRBL related forum such as Shapeoko GRBLhal (on github) or bCNC (also on github) or on a forum for 3D printers, those apparently also often use a GRBL variant.

author: beanflying
author_rank: Super Contributor
timestamp: May 12, 2021, 02:59:01 am
content: I have been playing with Mega5X on an MKS board and UGS so I had to play with the config to get it to work properly but I was getting stumped by a problem with the Z axis.For simplicity I hooked it up to a 12V fixed supply on the 3018 I am doing some upgrades on on the bench rather than the former 19V one as I will be going with 24V in the rebuild and associated enclosure. X and Y worked great with UGS but Z simply failed in spite of trying several stepsticks and tweakage of the pot with appropriate tongue angle and still nothing.Plugged in the Z motor cable to the Y and failed so most odd. Checked the cable and tested fine BUT it was a longer cable and I suspect it turns out that on 12V the drop to the stepper on thin cable was the issueBump it to higher voltage and problem solved after several hours of mumbled swears and threats to the board.Just watch the limit on your shield and Arduino as I think 24V will let the smoke out.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 13, 2021, 01:00:24 am
content: You should never have a high voltage drop over power cables.Stepper motors need all the voltage you can give them to reach higher RPM to overcome the inductance of the coils fast enough to push some decent current through them.If you loose more then a volt over the cable then you really should start thinking about replacing your cables with something thicker.Measuring cable resistance is quite easy if you have a lab power supply.Just set it to a current limit of 1A, and short the power supply with your cable, and measure the voltage drop over the cable. 1A is easy because it directly maps the volts on you DMM to Ohms of the cable.Measuring milli ohms is easy this way.If you do this regularly, or don't have a power supply with adjustable current limit, then you can make a simple adapter from a LM317 and a 1.25Ohm power resistor. Accurate power resistors are bit difficult. You can start with 1.5Ohm and then put some other resistors parralel to it and measure with your DMM untill you're close to 1A.

author: langwadt
author_rank: Super Contributor
timestamp: May 13, 2021, 01:24:16 am
content: Quote from: Doctorandus_P on May 13, 2021, 01:00:24 ambut the voltage drop will be proportional to current and once the current has ramped up you no longer need high voltageback in the day steppers were commonly driven via a series resistors to limit the current

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 13, 2021, 01:28:39 am
content: That does indeed make the whole thing less problematic, but those old stepper motor drivers had a horrible efficiency, and still only a mediocre result.

author: langwadt
author_rank: Super Contributor
timestamp: May 13, 2021, 01:34:30 am
content: Quote from: Doctorandus_P on May 13, 2021, 01:28:39 amyes it is basically linear vs. buck switching constant current regulator

author: beanflying
author_rank: Super Contributor
timestamp: May 13, 2021, 02:05:50 am
content: I actually have been sorting out my CNC collection over the last week or so and this old 4 axis foam cutting board turned up. Not fancy but it did get the job done. Motors were a small salvage Japanese stepper well below Nema 17 spec.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 13, 2021, 02:56:57 am
content: What IC's are under those red heatsinks?Talking about efficiency...Compare those with some modern chopper motor driver that can deliver 3A continuously from a small SOIC and and does not even need a heatsink (maybe a few thermal via's to a GND plane).It does remind me though of my first CNC machine I built when I was young...Nema23 motors salvaged from (even then) old matrix printers.I built a power supply with + and - 30 volts or so (may have been from an old audio amplifier power supply).One side of each motor winding was connected to GND and the other side was alternated between the positive and negative power supply with linear current sources and sinks.I built 4 of those drivers, and they worked, but I only used them for a short while because the got stupendously hot even with fans blowing at the (pretty big) heatsinks.

author: beanflying
author_rank: Super Contributor
timestamp: May 13, 2021, 03:04:24 am
content: Bit of brute force needed as the tape was a little hard after 20 yearsULM2803A Darlington

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 13, 2021, 03:11:26 am
content: But those are only good for half an amp or so, and can't handle that for all outputs at the same time.So probably severly overloaded and no wonder you need extra heatsinks.I was very proud of my linear current source / sink contraption.It was from before cheap and easy microcontrollers.It was all driven by an LPT port from a X86 PC, then some 4 bit up/down counters, a 74LS138 demux, some extra diode or-ing and then the linear current source & sinks with darllington transistors in TO220 and LED's as voltage references, The motors were driven in half-steps.Quite a shame I haven't got pictures of that contraption.