Become a leader in the IoT community!

New DevHeads get a 320-point leaderboard boost when joining the DevHeads IoT Integration Community. In addition to learning and advising, active community leaders are rewarded with community recognition and free tech stuff. Start your Legendary Collaboration now!

Step 1 of 5

CREATE YOUR PROFILE *Required

OR
Step 2 of 5

WHAT BRINGS YOU TO DEVHEADS? *Choose 1 or more

Collaboration & Work 🤝
Learn & Grow 📚
Contribute Experience & Expertise 🔧
Step 3 of 5

WHAT'S YOUR INTEREST OR EXPERTISE? *Choose 1 or more

Hardware & Design 💡
Embedded Software 💻
Edge Networking
Step 4 of 5

Personalize your profile

Step 5 of 5

Read & agree to our COMMUNITY RULES

  1. We want this server to be a welcoming space! Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
  2. If you see something against the rules or something that makes you feel unsafe, let staff know by messaging @admin in the "support-tickets" tab in the Live DevChat menu.
  3. No age-restricted, obscene or NSFW content. This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
  4. No spam. This includes DMing fellow members.
  5. You must be over the age of 18 years old to participate in our community.
  6. Our community uses Answer Overflow to index content on the web. By posting in this channel your messages will be indexed on the worldwide web to help others find answers.
  7. You agree to our Terms of Service (https://www.devheads.io/terms-of-service/) and Privacy Policy (https://www.devheads.io/privacy-policy)
By clicking "Finish", you have read and agreed to the our Terms of Service and Privacy Policy.

Optimizing Speed and Acceleration for Nema34 Motor Control with DM680E Driver

Hi 👋🏻
My friend and I wrote this code to control a Nema34 motor with a DM680E driver for a drilling cycle. We want to dynamically adjust the speed between fast movement (for chip removal and advancing) and slow movement (for drilling into the material), while maintaining smooth acceleration transitions between these speeds.

We’ve mentioned needing two speed parameters—fast and slow—but we’re unsure about the exact values that would be optimal for this application. If anyone has advice on how to calculate or determine the best speed and acceleration values for this setup, it would be greatly appreciated.

We have tried to implement speed adjustments, but the results were not as expected. Either there were unexpected jerks or no noticeable change in speed. If anyone has experience with this, what might we be missing in terms of smooth acceleration management?

  1. Camila_99$$#0000
    #include 
    #include 
    AccelStepper stepper(1, 9, 8); // mode 1 = half-step, etc... 200 steps/revolution
                                   // pin 9 = PUL 8 = DIR
    
    void setup() {
      stepper.setMaxSpeed(4000);
      stepper.setAcceleration(2500);
    }
    
    void loop() {
    // screw pitch = 2.5mm/rev, motor = 200 steps/rev + 1/2 step mode = 400 steps/rev
    // 30mm travel = 12 revs / 200 * 2 * 12 = 4800 steps
    
       // slow speed drilling 
       stepper.moveTo(-4800); // position +30mm drilling 1/3 
       stepper.runToPosition(); 
       delay(250);            
    
       // fast speed movement 
       stepper.moveTo(0); // position 0mm / chip removal
       stepper.runToPosition();
       delay(250);
    
       // fast speed movement 
       stepper.moveTo(-4800); // fast advance to +30mm for drilling 2/3
       
       // slow speed drilling 
       stepper.moveTo(-9600); // position +60mm drilling 2/3
       stepper.runToPosition();
       delay(250);
    
       // fast speed movement 
       stepper.moveTo(-4800); // position +30mm / chip removal
       stepper.runToPosition();
       delay(250);
    
       // fast speed movement 
       stepper.moveTo(-9600); // fast advance to +60mm for drilling 3/3 
       
       // slow speed drilling 
       stepper.moveTo(-14400); // position +90mm drilling 3/3 end of drilling
       stepper.runToPosition();
       delay(250);
    
       // fast speed movement 
       stepper.moveTo(0); // return to starting position
       stepper.runToPosition();
       delay(250);
    }
    
  2. Marvee Amasi#0000

    Update your source code with this , i used comments to well explain the code better
    0code_fix.txt

  3. Marvee Amasi#0000

    I defined two speeds (FAST_SPEED and SLOW_SPEED) to differentiate between fast movements ie chip removal or advancing and slow movements, drilling.

    So bfore each movement, setMaxSpeed() is called to dynamically change the speed based on the task. The slow speed is applied for drilling operations, while the fast speed is used for moving between positions

CONTRIBUTE TO THIS THREAD

Leaderboard

RANKED BY XP

All time
  • 1.
    Avatar
    @Nayel115
    1620 XP
  • 2.
    Avatar
    @UcGee
    650 XP
  • 3.
    Avatar
    @melta101
    600 XP
  • 4.
    Avatar
    @lifegochi
    250 XP
  • 5.
    Avatar
    @Youuce
    180 XP
  • 6.
    Avatar
    @hemalchevli
    170 XP