gnea / grbl

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino
https://github.com/gnea/grbl/wiki
Other
4k stars 1.6k forks source link

Stall on milling #595

Open lolowl-coder opened 5 years ago

lolowl-coder commented 5 years ago

Hi. I've encountered communication issues with Arduino Uno r3 clone board, equipped with 16u2 chip. Suddenly, my Arduino and GCode streaming software freeze when milling. What I tried:

After these steps problem still remains. How to fight this? Any help will be appreciated.

HuubBuis commented 5 years ago

Consider using Bluetooth or WiFi in stead of USB for elimination ground loops and interference from the high current stepper controllers. I use WiFi for about 2 years and it has never let me down!

lolowl-coder commented 5 years ago

@HuubBuis, thank you for fast response. Is this board suitable for your idea? Should I change something in firmware?

viewsat commented 5 years ago

@lolowl-coder You can use Grbl-Panel to send g-code. Line 11 of 1001.nc is an unsupported command 1001

swarfer commented 5 years ago

I have just run your job through my clone Uno with CH340 chip in check mode with success. all 490000 lines of it, but I did edit out the toolchange line (maybe you should use a different Fusion post, one really made for GRBL :-) https://github.com/swarfer/GRBL-Post-Processor

What does this mean?
you say 'suddenly it stops' which I take to mean it used to work perfectly but now it does not. This indicates something has changed, maybe the USB driver got updated? or the Uno got hot once too often and there is now a dry joint. MAybe point a fan at it while it runs and see if that helps. If so then the problem is heat related. is the PC staying on during the job? maybe it is trying to sleep (yes the screensaver/power setting can change during a Windows update)

HuubBuis commented 5 years ago

@HuubBuis, thank you for fast response. Is this board suitable for your idea? Should I change something in firmware?

You don't need to change anything in firmware.

This board isn't GRBL compatible due to the ATMEGA4809 processor used. You need a standalone WiFi board like ESP-01 (ESP8266) or a arduino uno https://robotdyn.com/uno-wifi-r3-atmega328p-esp8266-32mb-flash-usb-ttl-ch340g-micro-usb.html or mega https://robotdyn.com/mega-wifi-r3-atmega2560-esp8266-flash-32mb-usb-ttl-ch340g-micro-usb.html having a builtin ESP8266.

I use the arduino Uno and (soon) Mega version having the builtin ESP8266 module, that works great, no additional wiring, no level converters needed and programming is done by just setting a few dipswitches. I have written a manual and a ESP8266 sketch to use these boards http://www.mwt.messageboard.nl/forum/viewtopic.php?f=4&t=11

If your GCode sender doesn't support WiFi, you also need a USB to WiFI converter at the computer site. For this you could also use a ESP8266 [https://www.ebay.nl/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=ESP8266&_sacat=0](url) module and a USB adapter for using and programming this boardhttps://www.ebay.nl/itm/CH340-USB-to-ESP8266-ESP-01-Wifi-Module-Adapter-1394D1/163459070459?hash=item260eeb79fb:g:kyYAAOSwQhBcKQOv:rk:3:pf:0 I haven't written a sketch for the ESP8266 module at the computer site but if you need it, I will do it.

Beware, to connect the standalone ESP-01 (ESP8266) to a standard arduino you need a level converter board like this one https://www.ebay.nl/itm/Adattatore-per-modulo-WI-FI-ESP-8266-ESP-01-arduino-level-converter-module/223322486589?hash=item33ff0eb73d:g:bkQAAOSwgyZcOi8m:rk:1:pf:0

MeJasonT commented 5 years ago

Does reducing the status query period on your GUI help, you can have too much data. 200ms is certainly fast enough for human monitoring. I found the GUI Candle https://github.com/Denvi/Candle was set by default to 40ms, so that's 25 responses per second with a string 70 characters long being reported back from GRBL. It caused a few data dropouts for me until i reduced it. GRBL keeps track of its location the response messages are just for the users reference/display purposes so you can see what the machine thinks it is doing.

lolowl-coder commented 5 years ago

@swarfer,

What does this mean?

It means my machine starts normally and after some (random) time movement slows down (may be without slowdown) and steppers stops to move.

MAybe point a fan at it while it runs and see if that helps.

It's not overheating. Tried with cooler 80x80 mm.

is the PC staying on during the job? maybe it is trying to sleep (yes the screensaver/power setting can change during a Windows update)

Yes, PC is on and normally operated (not trying to sleep, etc.)

Next thing i tried - process same file (in first post) with spindle disabled. File was successfully processed. I think the cause of problem was interferences from spindle (500w, brushed, aliexpress). Does anyone know how to ensure in this?

I like wifi-approach, as @HuubBuis recommends. I'll try it.

I'm also interesting in how grbl behaves if it can't confirm, that gcode line is successfully processed? Is such case a deadlock (no confirmation, no next GCode line, freeze)?

HuubBuis commented 5 years ago

I think the cause of problem was interferences from spindle (500w, brushed, aliexpress). Does anyone know how to ensure in this?>

nsiatras commented 5 years ago

I experience the same problem. Do you connect the Arduino GND pin to A/C Earth ?

HuubBuis commented 5 years ago

The Arduino GND pin should not be connected to AC/Earth. This is basically the same for every electronic device. The problem is that if you connect multiple electronic devices, earth current/spike go's the easiest way, which could be the electronics GND connected to ground. It could not only lead to erratic behavior but also destroy the electronics.

nsiatras commented 5 years ago

I noticed that by connecting the USB to the arduino the GND pin is connected to AC/Earth.

On Thu, Feb 14, 2019 at 1:09 PM Huub Buis notifications@github.com wrote:

The Arduino GND pin should not be connected to AC/Earth. This is basically the same for every electronic device. The problem is that if you connect multiple electronic devices, earth current/spike go's the easiest way, which could be the electronics GND connected to ground. It could not only lead to erratic behavior but also destroy the electronics.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gnea/grbl/issues/595#issuecomment-463588171, or mute the thread https://github.com/notifications/unsubscribe-auth/AFvq7oUe4unBtpg5KmCTtAMvyVpNc3niks5vNUPYgaJpZM4abJS5 .

HuubBuis commented 5 years ago

I checked the Arduino Uno R3 schematic and yes, the USB shielding is connected to the Arduino GND by a small coil. This is probably done by a lack of a shielding Pin. This could results in ground loops and is in my opinion a design failure. I also have checked my own processor boards and I have made the same mistake (oeps)! Shielding can be very useful. The basic rule is to connect shielding only at one side, the most sensitive side and connect the shielding to earth. The easiest way to do this, is to cut the shielding at the Arduino end of the cable. This way you have a proper shielding and if your computer has a earth outlet, the shielding works even better.

nsiatras commented 5 years ago

I don't believe is a design failure. I just checked an STM32 Nucleo board. Same thing here. The GND pin is connected to A/C Earth as you connect the board to the computer

On Thu, Feb 14, 2019 at 4:03 PM Huub Buis notifications@github.com wrote:

I checked the Arduino Uno R3 schematic and yes, the USB shielding is connected to the Arduino GND by a small coil. This is probably done by a lack of a shielding Pin. This could results in ground loops and is in my opinion a design failure. I also have checked my own processor boards and I have made the same mistake (oeps)! Shielding can be very useful. The basic rule is to connect shielding only at one side, the most sensitive side and connect the shielding to earth. The easiest way to do this, is to cut the shielding at the Arduino end of the cable. This way you have a proper shielding and if your computer has a earth outlet, the shielding works even better.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gnea/grbl/issues/595#issuecomment-463637952, or mute the thread https://github.com/notifications/unsubscribe-auth/AFvq7g-G5ruXnXLCrmkTazQ5hTQqecLnks5vNWyagaJpZM4abJS5 .

109JB commented 5 years ago

According to this document http://www.ti.com/sc/docs/apps/msp/intrface/usb/emitest.pdf the USB shield should be tied to the ground plane. See section 5.4 where it states:

Full speed devices use a shielded cable which requires that the connector shell be tied to the ground plane. It is important to note that a ground plane does not behave like an equipotential surface at high frequencies.

HuubBuis commented 5 years ago

@109JB According to this documentation you are right and this document wasn't written by dummy's.

The fact remains that connecting cable shields on both sides results in ground loops, ground loops results in troubles and for proper shielding only one side of the shield needs to be connected. I don't know what is wise to do, but without changes there is not improvement.

After reading this document I still think it is worth a try to use a USB cable having the shielding cut at one side.

langwadt commented 5 years ago

cutting the shield won't do much since there is a ground wire in parallel with it, USB needs ground

HuubBuis commented 5 years ago

The problem are not the 2 USB ground connections, but the earth current that could and will flow when earth grounds of different electronics are connected and this connection isn't a star topologie (single point central earth)

langwadt commented 5 years ago

but if the PC grounds the shield cutting the shield will not break the loop since there's still the ground wire to break the possible loop you need an USB isolator or use a laptop running on battery

n0th1n6 commented 5 years ago

I've been scratching my head about this for a week, almost gave up pcb milling. When running the gcode with spindle also running but not cutting anything, the job compleles without a stall. As soon as I let the tool touch the copper of the pcb, it will randomly stall.

So i did experiment

  1. Use a seperate line. Different breaker so the path from arduino socket to the spindle socket is longer. It did improve the situation but will still stall. Quite frustrating coz it sometimes happen at around 90%.

  2. Added choke to the USB cable. Did not solve the issue.

  3. Added choke on the spindle wire. It significantly improved the situation. I can even plug the controller board and spindle in same line.

  4. I picked up a good quality but short (400mm) usb cable. Now I have almost forgotten that this ever happened if not for this thread.

In summary, my guess is that the stall is caused by a high freq noise produced by the motor that travel to the controller board and messes the usb timing. The choke on the spindle prevents the noise from reaching the controller board.

Also, just a precaution, avoid plugging a usb device that draw high current (phone, mass storage device, etc) during milling. A surge in current drawn from the usb can shut down the usb controller.

On Fri, Feb 15, 2019, 7:46 AM langwadt <notifications@github.com wrote:

but if the PC grounds the shield cutting the shield will not break the loop since there's still the ground wire to break the possible loop you need an USB isolator or use a laptop running on battery

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gnea/grbl/issues/595#issuecomment-463849122, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2CUstq5zlNH5Gx3oRUNgNNJykfXiuPks5vNfVtgaJpZM4abJS5 .

On Fri, Feb 15, 2019, 7:46 AM langwadt <notifications@github.com wrote:

but if the PC grounds the shield cutting the shield will not break the loop since there's still the ground wire to break the possible loop you need an USB isolator or use a laptop running on battery

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gnea/grbl/issues/595#issuecomment-463849122, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2CUstq5zlNH5Gx3oRUNgNNJykfXiuPks5vNfVtgaJpZM4abJS5 .

HuubBuis commented 5 years ago

The Arduino has no connection to earth ground so ground currents can't travel trough the arduino to reach earth ground.

If at the PC side, the GND is connected to the Earth ground (probably yes), then the shortest route for the earth currents to travel will not be via the Arduino USB back and forth but via the PSU (power outlet) connection.

n0th1n6 commented 5 years ago

That might be the case. Still my #3 and #4 applies as the choke is on the spindle.

On Fri, Feb 15, 2019, 8:24 AM Huub Buis <notifications@github.com wrote:

The Arduino has no connection to earth ground so ground currents can't travel trough the arduino to reach earth ground.

If at the PC side, the GND is connected to the Earth ground (probably yes), then the shortest route for the earth currents to travel will not be via the Arduino USB back and forth but via the PSU (power outlet) connection.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gnea/grbl/issues/595#issuecomment-463857768, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2CUoUnI9xSDfojt-72tomlFIVWn8E6ks5vNf4hgaJpZM4abJS5 .

dcavataio commented 5 years ago

Same issue, the choke on the spindle took care of the stall.

matrix-wrangler commented 4 years ago

@n0th1n6 @dcavataio facing same issue here, please let us know the parameters of choke that fixed the problem and specs of your spindles.

n0th1n6 commented 4 years ago

@matrix-wrangler, choke did not solve the issue for me. Following solved this issue 100%

  1. Use high quality USB cable. The shorter the cable the better.
  2. Using dremel cause this stall even when USB cable is short and of good quality.
  3. Move the mains cable away from the USB cable. These are the mains cable for your stepper and spindle.
  4. Most important, use a dedicated computer for your CNC. If you can't, just unplug other USB device while cutting.
matrix-wrangler commented 4 years ago

Thank you @n0th1n6 , 3 and 4 has always been the case that i followed strictly. Got a dedicated laptop on the cnc and a UPS + PSU for the CNC away from the mains to avoid interference. It's an old board that i'm using, i eventually figured out that sparks from brushed spindle (both old and new) is causing a lot of interfere for the machine to stall, as opposed to the cnc completes the job flawlessly when it's not connected to the spindle. Easier option would be to replace the board (woodpecker 3.2), which i did, but i wanted to go a little further to find a solution without a replacement board. I'll certainly try the high quality cable, but the params on choke can also help if it manages to negate the fluctuations caused by spindle.