Welcome to Our Community

Some features disabled for guests. Register Today.

Dual control of a spindle and laser

Discussion in 'Other Builds' started by DSK, May 16, 2024.

  1. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    Hello,

    I built a router originally based on a usb Mach 3 controller. Then I switched to OpenBuilds Blackbox X32 and added a laser module to my machine. I've also switched to VCarve V12 and with the laser addon - and hoping to be able to dynamically switch between using the spindle and the laser within a single GCode program (e.g cut a part with the spindle, then laser engrave a part number on it etc). And I'm using OpenBuilds control.

    Whilst I am an experienced software engineer - I am at the very beginning of learning GCode...

    The spindle works fine with relay 1 to enable the VFD, and 0-10V for the speed. The laser also works fine powered with 12V and the pwm output.

    However, I haven't yet figured out how to control the spindle and the laser independently. I believe that laser mode being enabled in GRBL only links the laser power to the motion of the machine, and enables immediate machine motions when the power demand is altered...

    Presumably I also have to specify the offset between the spindle and the laser and so far not sure whether that would be in VCarve, or control...

    I haven't yet tried controlling it with a GCode program generated from VCarve... So far just manual testing from control. So far what happens is when I switch on the laser the spindle also starts. I am not sure if the post processor in VCarve will automatically generate the correct GCode to handle this...

    How do I make it select between controlling either the spindle or the laser - without both starting up at the same time? Or would I have to include a manual disable switch for each and not dynamically switch between them? (Although I do think a manual disable switch is a good idea in any case to prevent accidental start - but I would still like to achieve the kind of control I'm looking for)...

    I'm sure there is a little bit of text somewhere that I haven't read :)
     
  2. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Grbl really only has one tool output.
    You will need to do
    - Change $32 between router and laser jobs
    - Change which is active (easiest way is just to power on VFD or Laser, depending on which is relevant for the job at hand, powering off the other)
    - Rezero laser over router job (creating Offset macros will be fine, using G10 commands G-Codes or by going to Zero, move the offset distance, then rezero )
     
    DSK likes this.
  3. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    Thank you,

    So if I understand correctly - changing $32 can be done from GCode to make the controller behave appropriately for laser and spindle speed changes? And zeroing for laser or spindle can be done with appropriate G10 commands? Perhaps in a modified post processor in VCarve?

    To power on either the laser or spindle - presumably this would be best achieved via an additional relay, and to control this via the relay 2 output, or the coolant output? Then this would be controllable via GCode - and added to the post processor as well?
     
  4. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Could do it in gcode. Most folks just add a Macro button to click between jobs though. Keeping it simpler
    Most people just use their built in power switches. Turn on whichever is needed.

    How big a VFD is it, could maybe use an ioT relay with its normally on and normally off sockets off coolant output if its not over the IoTs ratings?
     
  5. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    The VFD is 2kW.

    But instead of switching the main power, I was thinking it would be the 24V run signal which is switched, and the 12V power supply to the laser. So the VFD is always ready to be started and stopped potentially many times during a job (I'll isolate its power for manual tool changes).

    My motive for doing this is that a single job will potentially produce hundreds of small parts generated by my own software, each of which I intend to label with the laser. Also, many cuts will be needed where the bulk of material is machined out and then finished with the laser for things like sharp internal corners etc. So really what I intend to achieve is completely automatic switching between using the laser and spindle as their individual need will come and go many times during a single job.
     
  6. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    It has occurred to me that my software is producing the parts as dxf files, and then I'm using VCarve to generate the toolpaths. But if I learned enough grbl then it would make sense for my software to produce the GCode directly. Although it would then also have housekeeping to produce motion for all the pockets and moving between parts etc... But in principle I could then more easily make the machine switch between the laser and spindle...

    Although producing text in GCode would be a bit of a pain...
     
  7. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    I see there is $9 PWM Spindle as bit field... Is there any documentation you can point me to that would cover this? I couldn't find it on the Grbl github.

    Since I am using the 0..10V output to control the spindle speed, and the PWM output to control the laser intensity - is it permissible to use:
    • $30 (maximum spindle speed) to temporarily disable the spindle by setting this to 0, and to 24000 to enable? So all spindle speed demands will scale to zero volts on the analogue output when "disabled"?
    • $33 (spindle PWM frequency). Would setting this to zero effectively disable the PWM output? Or would this also affect the 0..10V output (is the 0..10V is actually achieved using PWM internally, or is it a real 0..10V output)?
    Do these settings require a reset of the controller to take effect?

    If these work like this then it would appear to provide a means to control the 0..10V and the PWM output one at a time, thus effectively disabling either the spindle or the laser independently.
     
    #7 DSK, May 17, 2024
    Last edited: May 17, 2024
  8. terjeio

    terjeio Well-Known
    Builder

    Joined:
    Oct 18, 2020
    Messages:
    59
    Likes Received:
    60
    Newer versions of grblHAL allows "cloning" of the PWM spindle. One loses direction control of the non-laser spindle and the direction output is reassigned as laser enable for the clone. The clone gets its own set of RPM/PWM settings except the PWM frequency which is shared. Spindle switching is via M104 (or tool number) and $32 should be permanently set to laser mode. The M104 (or tool) command will then switch laser mode on/off depending on which spindle is active.

    I may add support for a macro stored on the SD card that will be called on a spindle switch, this could then be used to change offsets or whatever else is required - possibly making switchover totally seamless.

    Disclaimer: I have not tested this functionality much, and I have not documented it yet. Any feedback will be appreciated.
     
    DSK likes this.
  9. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Correct, BlackBox X32 was a evolution of the BlackBox 4X that ran Grbl. From that legacy we kept the single PWM pin > 0-10v converter method

    In our board DIR is not exposed, it goes to a SPDT relay docs:blackbox-x32:layout [OpenBuilds Documentation] so might need to make that more configurable. Tool enable and PWM is available straight off the ESP

    Sadly too much for the IoT.

    So yeah, could wire up your own relays to do the switching instead then. And then you can switch anything.

    IoT would have been good option for 0.8-1.5kw users. Already has opposing Normally On and Normally off sockets making switching power the simplest option (just plug it in to the right sockets).

    You sound like you'll manage to wire relays though. Just note to use logic level relays for 3.3v outputs (or 24v max 2A coils for Coolant output).
     
    DSK likes this.
  10. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    Thank you guys for your help and advice. I will do some more investigation as well and see what I can get working.
     
  11. EvanH

    EvanH Well-Known
    Builder

    Joined:
    Nov 3, 2022
    Messages:
    72
    Likes Received:
    37
    I use a different controller that has a facility to quickly switch back-and-forth between a VFD spindle and laser in one GRBL file, BUT, I have reverted now to running all the milling operations first, and then running all the laser engraving as a separate activity. There were two reasons for reverting back to a 'manual' switching between the spindle and the laser:
    1. I set up X-Y-Z zero in G54 for the spindle, and used G55 for the laser, but found it was very easy to forget to ensure I was in G55 when running the laser (all user error issues): some commands like M2 to end the programme on most flavours of GRBL revert back to g54 automatically. I now do the milling in G54, then zero the laser in using G54 too.
    2. If the laser is to be used during a milling job, even with a dust boot to clear the chippings from the milling activity, I found dust would build up on the laser lens as it has to be at a similar height to the spindle collet. After a period of subsequent laser activity, the dust would carbonise and did not do the lens any good. With a separate manual swap between cutting and laser activity, I can move the laser out of the way (it is on a vertical slider, also triggering an interlock that disables the laser too) and also cover the laser lens to prevent milling dust getting in.
     
  12. DSK

    DSK New
    Builder

    Joined:
    May 16, 2024
    Messages:
    7
    Likes Received:
    0
    Thank you. I have a feeling, for similar reasons as you have stated that I might end up adapting my overall process as "reality" sets in...
     
  13. BillyTheClown

    Builder

    Joined:
    May 30, 2024
    Messages:
    13
    Likes Received:
    6
    My solution was a 3 phase Rotary Changeover Switch, VFD - off - Laser
    switches hot, neutral and ground so that when using the laser there is no power to the VFD,
    solves two problems,
    1) my laser mounts in the spindle chuck, if my accident I powered up the spindle it would damage my laser
    2) my spindle is grounded, if the ground is connected to the VFD/Spindle the XYZ probe is will always see connection when I put on the magnet

    also gives me a way to turn off the VFD while I setup the machine.

    here is a link to the switch
    https://www.amazon.com/gp/product/B08HWM7CMR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
     
  14. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    PS: that indicates a AC EARTH to DC GND short somewhere else in the system. Best to fix it! T|hose are typically isolated domains, a short is bad
     
  15. EvanH

    EvanH Well-Known
    Builder

    Joined:
    Nov 3, 2022
    Messages:
    72
    Likes Received:
    37
    The first device may work, but looks to be 'over specified' for the data rates needed. The cheaper alternatives like the one in the second link should do the job. I do not have an X32 box, but my cnc controllers are based on the ESP32 too: isolators using the AUDM3160 chip (like in the second link) are what I use for removing ground issues with ESP32's.

    Evan
     
    BillyTheClown likes this.
  16. BillyTheClown

    Builder

    Joined:
    May 30, 2024
    Messages:
    13
    Likes Received:
    6
    I ordered the second one the cheaper one and will test it in a couple of days
     
  17. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Negative. Thats a link that's supposed to be there.. Some other unwanted DC GND to AC short at PC then. 2 prong plug? Try other way round. Try unplugging monitor. Try different PSU in PC.

    Not going to work.

    BlackBox is all DC domain.

    Stop hiding the symptoms. Find the actual short and resolve. DC GND touching AC Earth is a safety issue, apart from the inconvenience.
     
  18. EvanH

    EvanH Well-Known
    Builder

    Joined:
    Nov 3, 2022
    Messages:
    72
    Likes Received:
    37
    As Peter says, removing grounds on power leads that are put in place by manufacturers should not be done. I have moved to running my machine off an old laptop now as the ground in the particular laptop is not tied to the AC ground through the power supply, and it would be unusual for a laptop supply to be tied to ground. Unfortunately for me with desktops, if it has a metal outer case, it will be AC grounded for safety in the UK, and then the DC ground and outer shield of all usb and video cables are also often tied (well, it is on every one of my desktops!), but I know other countries have different regulations for earthing.
     
  19. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    That's fine. We left the Shield floating per spec. The DC GND (negavtive supply) pin inside the USB socket won't be touching the PC case (or no one would be able to use it correctly) from there's a short to AC Earth somewhere else
     
  20. EvanH

    EvanH Well-Known
    Builder

    Joined:
    Nov 3, 2022
    Messages:
    72
    Likes Received:
    37
    Peter, yes you are right the screens should only be grounded at one end so it is excellent news they are floating on the BB, and as you say, the screen does not have to be connected to usb 0v, but you had me intrigued as to how the usb 0v pins may be wired in practice ....

    I have just tested 4 UK CE marked desktops, and 2 UK spec laptops, and all have the usb 0v pin internally connected to the screen at the PC end, so for the desktops (which are all metal cased), it means the usb 0v pin is also connected internally to the AC earth! It confirms why I needed a ground-loop breaker on the usb for my UK desktop machines. It would be fascinating to know what connection strategies are used on equipment in other countries, and if my UK-spec machines are the norm here in the UK.
    Evan

    EDIT: I forgot to mention the 0v pins on the VGA connector and DVI connectors were also connected to the shields.
     
    Misterg likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice