False Hard Limit with $21=0


I hope I put this in the right place.

I have a Chinese Arduino Uno with a CNC shield, DRV8825 drivers, shielded cables grounded to the ground terminal in the 500W Spindle Motor power cable. I am running GRBL V1.1. I have Hard Limits and Soft Limits disabled ($20=0 and $21=0) I have triple checked and they are set to 0.

The problem is that while the machine is running it keeps freezing and the Console in CNCJS says that it was a Hard Limit activated. I do not have any limit switches and they are diabled in the program.

I am computer illiterate and struggle with this stuff, but I try. This one has me stumped.

The only thing I can think of is that it being a Chinese knock off that there is some issue with the board.

Thanks in advance.

If it is one of the super cheap and nasty spindles then chances are it is the spindle that is the problem.
Most of the 500W spindles need thier own PSU but dont need to be grounded directly to the shield.

More details would be needed.
Links to the parts would be a good start.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

This happens without the spindle running.

Can you "dry run" a cnc program with the spindle FULLY disconnected including its PSU if it has a seperate one ?
That would rule out the spindle. Prefer to operate a relay for spindles here BTW.
If you can then its a spindle wiring issue.

If not then its wiring elsewhere.
Dont power the whole thing from a socket that may share its mains power with motors or other inductive loads (fridge, toaster,dishwasher, kettle, etc.).

A picture of the way you have it laid out would be of use. (see links in first answer)

Please take a look at your config Grbl v1.1 Configuration · gnea/grbl Wiki · GitHub

IMO you have limit switches inverted, Homing disabled, etc. i.e.:


Here is some additional information.

  1. The error occures with or without the spindel running. The spindel is manually controlled.

  2. The error occures randomly with or without the spindel running. It has happened near the beginning of the program, just a minute or two in. Yesterday it was about 15 minutes into the G code.

  3. I have the Hard Limits turned off ($21 = 0) but that is the error code I am getting. The previous post mensioned something about $5 = 0 and inverted? Can someone explain if these two are linked in some way.

Here is the programing:

$0 = 10
$1 = 25
$2 = 0
$3 = 0
$4 = 0
$5 = 0
$6 = 0
$10 = 3
$11 = 0.010
$12 = 0.002
$13 = 0
$20 = 0
$21 = 0
$22 = 0
$23 = 0
$24 = 25.000
$25 = 500.000
$26 = 250
$27 = 1.000
$100 = 400.000
$101 = 400.000
$102 = 400.000
$110 = 500.000
$111 = 500.000
$112 = 500.000
$120 = 10.000
$121 = 10.000
$122 = 10.000
$130 = 600.000
$131 = 600.000
$132 = 600.000


Here is the back of the machine. The only problem I might have here is the AC computer fan cooling the drivers. But its a fan for computers so I don't think it would give off that much EMF.

Here is the insides. Its a bit of a mess because I keep making changes. But if you see a problem please let me know.

I am also running smoothers (I think TL Smoothers) because I was having an issue with the motors running rough, turns out it was a power supply problem. I have since switched to a server power supply that I had laying around and that solved the problem. I kept the smoothers because I've had good luck with these on my 3D printer.

This is the power supply for the spindle. I recently moved it away from the Arduino to avoid interferance, and it did cure some other problems.

This is the 110v plug wire going into the spindle power supply. I am using the ground wire on the plug as the ground for all of the shielding. I think this is OK? Should I just ground to the frame of the machine?

Here is the emergency stop plug. I was getting a ton of interferance in this so I switched to shielded cable and moved the wire to the other side of the machine. Still got interferance so its unplugged until I solve all the other problems.

This is the front of the machine. The emergency stop is on the left and the wire for it now run down that side away from the spindle controls on the right.

So... Recap:

I am getting random false Hard Limit signals even though I think (based upon my limited knowledge) I have Hard Limits turned off and have no limit switches. The error happens randomly (something like 1-15 minutes into the program) with the spindle turned off.](https://flic.kr/p/2iNkUyf)

Not so long ago I ran into some similar issues.
They are documented in this thread.

Change the fan to a DC fan for starters.
Re-route AC cables and dont run parallel to any DC signal cables.

Any other issues I think will be covered by the linked thread.

Ferrite rings and capacitors as you will see are what saved my wits…Not so much the grey hair and balding though. :grin:

Great info in that thread. Gonna make notes and try some things.

Can interferance cause a Hard Limits alarm even if its turned off in the program and there are no limit switches?

Yes it can cause limit issues.
E-stop issues.
Random lock ups.

I know that first hand LOL.

Opto isolated relays or mosfets etc will be you friend in switching the spindle on and off.
As will the ferrites and capacitors.

A google search for grbl limit switch problems will lead you to many choices in fixing noise.
There is no quick fix but a step by step approach will get you to a clean running machine capable of lights out.

Oh, and what definitly helps is pulling the non-existing limit switches to either hig or low - whatever you configured. And when you are using limit switches, use them normally-closed.

Ok, I spent a day re-wiring. Cleaned everything up, removed the smoothers and simplified everything as much as possible. Here is what I got.

I have capacitors and ferrite rings on the way but I have this new problems!

I am testing with the SPINDLE OFF. I am no longer getting hard limits errors. The machine is freezing and I get:

<Run,MPos: 148.490,161.563,29.000 WPos:48.4…
Grbl 0.9j [’$'for help]

The Machine Position in CNCJS is resetting to all 0’s:
x 0
y 0
z 0

The Work Position resets to:
x -100.000
y -120.000
z -30.000

I am unsure what is happening here. I am thinking it has something to do with homing.

Anyone have any ideas?

That certainly looks cleaner.


Also see you are on GRBL 0.9
Most have migrated to 1.1 H or F
There were some significant changes in 1.1.
Swapping GRBL versions is as easy as just uploading a new sketch with the new ver.

See $10 item on the link above.

I have never needed the smoothers here but I do know some 3D printers do benefit from them.


I was thinking of making the switch, will try it now. I am so technologically inept I was afraid of making the change. Took a long time to get 0.9 working.

And OOPS! I ment to write CNCJS.


Its the CNC software I am using.

Ok, I think things are getting better. I Installed GRBL 1.1 and I’m getting about 10-15 minutes into the test program (simple 20x20mm pocket). Its running about 1 layer deeper (about half way). This is the last error message I got.

[Pgm End]
Grbl 0.9j [’$’ for help]

The program is about half way. Why [Pgm End]?

I have to think about it some more but I think I’m stumped. This is all happening WITHOUT THE SPINDLE RUNNING!

The only thing I can think of is the Arduino board. It a knock off Chinese one. I’m thinking I should get a genuine Arduino? Or am I missing something stupid?

What do you guys think.

You have not fashed 1.1, but 0.9j.

Before you install the GRBL 1.1 library rename the other one or delete it.

Then install the GRBL 1.1 library.

Either way it sounds like you have made a lot of progress. 8)

Again a demonstration of my in-ability!

Again a demonstration of my in-ability!

Not so !
Its the ability to learn I see from here :wink:

I have been trying to upload GRBL 1.1 to the Arduino and everytime I check the serial monitor its still 0.9. I delete the old program, download the new. I have wiped the memory with the program that comes up when you start the Arduino program. Then opened the GRBL 1.1 file, found the upload program, clicked on that to open the Arduino programer. Then hit upload. Looks like everything is working, uploads successfully.

When I open CNCJS it says 0.9, when I check the serial monitor its 0.9. I know I have downloaded 1.1, file name: grbl-1.1h.20190825.

I am doing something wrong, dumb and simple I am sure. Please help! Im pulling my hair out.

I wonder if you are placing the libray in the wrong library folder ?

There are two library locations.
One for the default libs that come with the IDE and one for your personal libs.

Your personal libs are held in a folder called libraries but that is inside your SKETCHES folder.
See PREFERENCES in the IDE for that location.

BTW if you make any changes to the preferences file ensure your IDE itself is CLOSED otherwise the changes will not take..

I open mine in notepad (or similar) then close the IDE to mak any changes.