Welcome to Our Community

Some features disabled for guests. Register Today.

3018 Pro-- code for continuous movement along the x-axis

Discussion in 'CNC Mills/Routers' started by joey3bags, Apr 13, 2022.

  1. joey3bags

    joey3bags New
    Builder

    Joined:
    Apr 11, 2022
    Messages:
    3
    Likes Received:
    0
    I am a transdermal coater that is setting up to make K Tape. Part of the K Tape is to create a wave pattern in the adhesive coating. At the recommendation of the person who built my coater I purchased a 3018 Pro and set it up on my coater.
    upload_2022-4-13_10-7-9.jpeg

    I just need the motor to move back and forth along the x-axis at a speed I set in the grbl settings. I'm having a bugger of a time finding what code to use to make the head move back and forth based on distance setting. I'm using USG Platform. Thanks.
     
  2. Peter Van Der Walt

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

    Joined:
    Mar 1, 2017
    Messages:
    15,049
    Likes Received:
    4,313
  3. joey3bags

    joey3bags New
    Builder

    Joined:
    Apr 11, 2022
    Messages:
    3
    Likes Received:
    0
    Thank you. I will look at those and come back with any further questions.
     
  4. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,458
    Likes Received:
    1,915
    I would avoid the jog commands
    You need to set up a gcode file with a long string of repeated 'go right, go left, go right, go left' commands
    Code:
    G21 G90 G17 F2340
    G1 X200 ; move right 200 millimeters
    G1 X0 ; move left back to 0
    G1 X200
    G1 X0
    
    repeat the 2 lines as needed so it runs for as long as you need.
    the line G21 G90 G17 F2340 means
    G21 use millimeters, G20 for inches
    G90 use absolute coordinates
    G17 use XY plane for arcs
    F2340 use a feedrate of 2340 millimeters per minute, if you use G20, then use inchesperminute here

    Every Gcode file must always have a suitable header such as the above, you don't know what state the controller was in before you run the file, so the file must set the modes it needs. Never assume it is correct!
     
    JustinTime likes this.
  5. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    G-code may not be responsive enough for a production line environment. If it is, then CNC itself may be overkill and you can just use an Arduino with the stepper library or something to go back and forth forever. Your end points could just be a couple of limit switches. Just because you're using CNC parts doesn't mean the actual motion control needs to be that complex.

    Hard to tell if you're intending on mounting the actual coating nozzle on this thing or just using it to scribe a pattern into the adhesive layer for whatever reason.

    If the coating head is mounted on this gantry and under the command of another part of the machine (adhesive pump, feed rollers, tracking sensors, etc) or everything is under the direct real-time control of some PID, PLC or whatever, then adding an intermediate stage to convert machine control commands to grbl-compatible serial commands seems like it could be a good idea. That can be a simple Arduino Uno, or maybe the existing control equipment could be programmed appropriately. Set up header parameters per-run (to insure against David's good point about unknown starting parameters; hopefully these would be prevented by initial grbl parameter setup- but you never know) would be a good idea in the setup() function, maybe with a $H homing command, then go into the main loop() function and accept simple "run" and "stop" commands, or maybe even passthrough feedrate parameters, which it can parse, convert to either grbl jog or line-by-line g-code commands, send over serial to the grbl controller, wait for the "ok" in return, and then reverse the motion as long as some physical input parameter is met. It's a couple afternoons' worth of project if you have any programming experience at all.

    If you just need some kind of texturing scribe to go back and forth forever, well, I don't think I'd even bother with CNC. Couple switches and a few lines of code to adjust the behaviour at the extremes so that you get the shape of texture that you want at a typical feedrate, done.

    In fact, if you don't need any kind of fancy pattern, you won't need to change the pattern at all, and you're planning on producing in volume... I wouldn't even use motion control. I'd throw a crank pin on a chain and drive a greased vertical channel in the "X carriage" as a single reciprocating mechanism. Could probably be 3D printed.

    Basically, the best engineering solution depends on exactly what you're trying to do. There's not much detail to go on.
     
  6. joey3bags

    joey3bags New
    Builder

    Joined:
    Apr 11, 2022
    Messages:
    3
    Likes Received:
    0
    Thanks to all for the info.

    Where the swivel is located I'll lash on a comb device. This comb device will go back and forth across the film plane the entire production session (60+ mins). The adhesive is already applied to the film prior to encountering the CNC. It's applied knife-over-roll. Using the comments above and looking at videos, I wrote out the gcode in the UGS command line and the head moved as I wanted. Seems I have to put the code into a file that I can run on the UGS platform. I don't need any fancy pattern because the back and forth motion of the comb over the surface of the coated film (that is also traveling at speed) creates the wave pattern.
     

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