On my primo, I’m running enducross’s grbl5x, which by default uses d44 for spindle pwm. So with laser mode enabled, if I reboot the controller the laser goes full power for a few seconds (d44 goes high during reboot). So to stop ruining stock and prevent safety hazards, I went ahead and added a spindle enable relay to cutoff 12V when the laser is not used. This is working fine for reset.
So quick question to those using lasers… what pin do you run pwm from, do you know if it goes high during reset, and do you have a spindle relay too?
I’ll keep the relay regardless, but I noticed some differences from enducross’s repo vs upstream (looks like it’s getting stale). So I plan on upgrading and just redoing my plugs to match any differences in cpumap. Since it’s a 5V ttl laser I’ll probably use the “pwm on d6” option (also puts the pwm plug next to the enable plug, which strokes my ocd a bit).
Nope, pulldowns did not work. I tried 4k7, and even 1k and got the same result. So it seems d44 (using enducross’s grblmega5x) is not floating but in fact held high on reboot. This requires using spindle enable with lasers for safety.
That said, obviously d4 (default spindle enable pin) does not have the same issue (otherwise the relay would not have solved it for me). Reading further, I noticed some major diffs between upstream grbl, grblmega5x, and enducross’s fork. Not that it matters for us, but upstream (grbl for 328) looks to have recently added code for dual endstops, but in a way that eliminates M7. Mega5x gives a choice of putting spindle pwm on d8 or d6 (nice), and I think mist still works on d9. Enducross is the only one with pwm output on pin44.
I’m guessing high on reboot is the reason upstream code is not using pin44. Not that it matters with my relay installed, but that bug is janky enough to make me want to switch to upstream mega5x. I will have some plugs to rearrange, but it is not too much work really.
This makes me think of something I rarely think about… bootup pin states on a mega. Having worked a lot with esp devices, bootup pin states are well known and documented all over (you can’t boot a bare esp12 if you don’t some stuff). Don’t think I’ve ever seen such info for the mega chips.
I assume d6 will stay low, as it is a pwm pin like d4? If it wasn’t, I’m guessing there would be similar complaints about upstream 5x.
Yes, I am using $32=1 and M4. The results are great. It does slow down a lot doing fast greyscale (50 to 100 mm/s), which appears to be the 8bit limiting things. However grbl is throttling pwm where there is not much diff in quality vs going 20mm/s.
I can’t talk to pwm pins on your particular board but I can say that all my Banggood/Eleksmaker lasers have had the “momentary full-power fire upon reset” problem… and I’ve just come to expect it and lived with it. Over the past year or so, however, I’ve started playing around with Neje lasers (6000, “20W”, and “30W”) and I can tell you that these DO NOT suffer from the same problem… no momentary firing during reset. I can’t say they are “better” however… as the Neje’s don’t seem to focus to as small a spot IMO. It could just be the lens but it’s not really a big deal as they are still quite useful… its just that I have both brands and can compare
Thanks for sharing… sounds like it is not just the oxlaser 3.5W that behaves this way. Good to hear you verify what I have read regarding the size of the spot for larger doides. I am finding the 3.5w I have to be good enough… some materials cut slow vs others and it can be hard to guess at a feed rate and pass count just by looking at them. It cuts some 6mm balsa in 4passes… other balsa it may take 10passes for 3mm to cut clean. I figure if I really needed more than that I should be looking at co2 vs larger diodes… but I am new to this and all.
You say it is just something you live with… are you interested in using a relay to fix it? If you like I can post some info on how to do it. I noticed your setups use shrouds so maybe not a big deal anyways, but if you do get into expensive woods it could pay itself off if it saves you from accidentally burning a dot in the middle of the stock. This has only happened to me with cheapie stock I have been using to learn and experiment. However my wife surprised me yesterday… went on a secret trip to woodcraft and came home with a bunch of exotic stuff I have never worked with before. Even with the relay, I assume at least $10 worth of Purpleheart is going to waste, lol.
It is interesting that you have not had this problem on your banggood lasers as many others have posted in various forums that they have had and it was cured by the addition of a pull down resistor. I have also never actually seen this problem live, I fit a pull down to all my projects and usually use the Uno/Nano platform. It may well be that the Mega2560 does not impose the same condition on all of its output pins during the boot sequence, which would be why some pins ‘float’ and some don’t.
@truglodite If you are driving a relay directly off the output pin be aware of the specs on output pin current limitations. Another solution to unwanted laser burns might be a scrap piece placed under the laser at bootup, or maybe setting your origin off the side of your workpiece . If you are hitting a performance wall with the 8bit solutions perhaps it is time to move up? I have recently sent off for PCB’s to take an ESP32 and 2 drivers for my laser cutter, there is so much clutter placed on the commercial boards that are just not needed for a laser controller. I also have a PCB cnc router asking for an upgrade I think I might work on a 3 driver version for it. With all the work done by Bart Dring on ESP32-GRBL it would be kind of rude not to!
Mike, no worries about pin currents as I am using relay boards that have their own 5V buffers (so coils are powered directly from Vcc). Putting scrap under the laser is not really safe unless you are always wearing goggles. The goggles are annoying so I only want to put them on when I have to watch a cut for some reason. Besides, I am too forgetful and would likely end up burning some nice stock on accident if a reboot becomes an unplanned part of setting up a job.
That is good to hear you are making simpler boards for laser rigs. It seems my garage machines always trend toward being overcomplicated for what they do. You can probably sell those like Bart once you get them up and running. Heck, if not a full fledged production, you could just earn some change on the side selling PCB’s through Oshpark.
Unfortunately for me space is at a premium. So my mpcnc has to serve multi purposes… and the laser (and drag knife lol) gets 5 axis because it rides on a self squaring router gantry. For me upgrading to esp32 using Bart’s board makes a lot of sense. I have so many other projects that need doing. Adding a 6axis pcb on top just won’t be worth the money saved vs just paying a little bit (IMHO Bart’s pricing is fair) to have one dropped on my doorstep.
I’m not interested in making any money with this and if anyone is interested I would happily release the designs (such that they are!). I have just finished a 3 stepper driver design for a ESP32_DEVKIT_V1_DOIT board, albeit so far untested. Everything you need for a laser machine or a 3 axis cnc router. You can currently get 5 of these boards made for $2 …plus shipping(in my case $5 odd).
It goes to show all the extra stuff on the commercial boards that were primarily designed for 3d printers that are simply extraneous for cnc/laser control.
I built one of Barts MPCNC controller boards - the SMC stuff was a bit of a challenge and ordering the correct ESP32 board was not quite as easy as you might think due to the wide range of ESP boards that all have their own individual pinouts…ask me how I know :-), but it works really well and all credit to Bart for the firmware and Luc for the software.
I am also curious where you get those boards for $2?
The layout looks good overall. 2 things I would change… the 12V trace to the laser plug is too small, and it would be good to pinout spindle enable since some lasers need that for safety. A third might be adding a pin for flood. Some folks including myself have a compressed air blast for cutting, and a fan for etching. Having the flood pin allows the air blast to be automated in cam.
Ultimately, what I am going to need is a 6 axis… but I would be cool if I had to wire out for relays etc… I feel Barts setup gets too pricey when you start adding in daughter boards. I think a board with 6 steppers and say like 13 gpio? That is how many pins my mpcnc is using right now anyways (not 6th yet until I add a 4th axis rotator). Dual endstops, probe, z max, 3 button console, mist, flood, spindle (actually both 12v and 5V)… so 13 would be just enough and no room for future additions if needed. I am not big into bloated controllers, but maybe esp32 will make that more of a requirement long term idk. I figure that is at least a few more pins for a uart screen then.
Mike, I have noted the same “problem” everybody else has with the Banggood laser… but it’s not a “problem” I felt I needed to spend a lot of time “fixing”. I am fully aware the laser will fire for a couple of seconds every time I reset the controller… but I either ignore the small burn if outside the profile of my engraving OR I put a little piece of scrap wood or metal under the laser until it finishes firing if I want to protect the material underneath. Also, my Banggood lasers have all been of the 2.5W and 3.5W variety – fairly low power – and my lasers are my lasers and I’m the only operator. So if someone wants to add the protective pull-down, I’m all for it and agree it’s a good thing… but given my personal situation this is the way I’ve chosen to deal with my lasers and this particular idiosyncrasy
@timonjkl I use EasyEDA - there is an online version or standalone. Some of their functions I find a bit funky - I have never been able to produce a new symbol or package properly, but that is just me not interested enough to master it. I get the boards made by JLCPCB, they have a bear constant offer on for $2 for 5 boards under 100mmx100mm, plus shipping, the cheapest of which is around $5.60 to me in France, it takes about 10 days to 2 weeks delivery.
@truglodite Yes, you are right, I enlarged the +ve trace to the PWM socket to 1.0mm since posting the jpg. It did look a little skinny when you think what is going to be connected to it. I have brought the PWM Enable output to the pin header block, it is the one labelled En, there wasn’t enough room on the silk screen to put more. This output would be limited to the current rating of the output pin as it is not buffered. I could squeeze GPIO2 to a pin header, it is assigned as spindle enable in ESP32GRBL but can be re-purposed to mist or flood if you are using PWM output for the spindle - I will work on that today and post it in a bit! I can’t help on the 6 axis…will ESP32GRBL handle 6 axis’s?
@dkj4linux. Sure David, I was only thinking the problem Kev was having must be to do with the Mega2560 hardware and how it handles its pins during boot as I have never heard of this problem not being cured with a pull down on the PWM pin before.
In my experience, the controller board makes no difference with the Banggood lasers. Over several years, I’ve used Marlin and Grbl, Mega2560, miniRambo, and a zillion different Uno/Nano-based boards… and my Banggood/Eleksmaker lasers almost always fire when reset; i.e. I can’t remember a time when they didn’t and I’ve just come to accept it and live with it as I have described. The Neje lasers OTOH, attached to the same PWM pins, do not fire upon reset… so it appears to me that the Neje lasers have a pull-down built in, whereas the Banggood lasers don’t (probably just floats high). Adding a pull-down resistor on the PWM line (either end, controller or laser interface) makes perfect sense to me, for lasers with the problem, and from what I understand seems to work for most folks. Maybe an oversimplification since I’ve not dug into schematics… but that is the effect I have observed.
Hmm, then it may just be the pin I’m using. I think it will be easiest for me to determine what is happening by just putting my oscope and a small load on d44 to see what it does at reset. I have designed some circuits using bare esp12 modules, and had to watch out for bootup pin states like this. Might be the same kind of thing here.
It’s my recollection that the laser firing issue on arduino-based boards has to do with the pin that the Enable signal is assigned to being one that flashes an LED on the arduino on startup. Apparently this can be prevented but requires modification of the boot loader, which carries its own set of risks.
It is not the Enable pin that is assigned to D13 by default, it is the Spindle Direction pin, although there is an option to change that.
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
// #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable
As this option disables M4, which in my view is a crucial facility of GBRL, it is never one I have enabled, also I can’t see how having the separate Enable pin toggle during boot would cause the laser to fire without an accompanying Sxxx signal.
What risks do you see by flashing with a programmer that removes the boot loader Tom? It is quite easy to re-flash the bootloader should you wish to.
@truglodite From a posting from Chamnit (GRBL developer) on github -
" I just remember that the Mega2560 has lots of different ports and pins, each with a specific set of thing they can do and can’t. Enough to make my head spin. Sorry, I don’t think I can help you much more. "