NEMA17 motor too slow

[sterretje]
Because all replies are in English and you posted the question in the English language in post #3, I've moved your topic back to Motors, Mechanics, Power and CNC.

Note:
code only in this post
[sterretje end]

Hallo,
Ik wil een NEMA17 motor gebruiken om een zongordijn open te schuiven.
Het programma werkt, maar de motor draait niet goed.
Hij maakt veel geluid en draait erg langzaam.

Ik heb al allerlei testprogramma's geprobeerd, maar hij blijft te langzaam draaien met veel geluid.

Eerst heb ik het met een driver DRV8825 geprobeerd.
Die werd echter heel heet, tot vinger verbranden toe.
Daarna heb ik een TB6600 gekocht. Die wordt niet heet en is makkelijker aan te sluiten.
Echter, beide opstellingen geven hetzelfde probleem.

De arduino code is als volgt: (Ik heb al verschillende snelheden geprobeerd.)

Heeft iemand en idee wat ik fout doe? of zal de NEMA17 niet goed zijn?
(Ik neem aan dat het een denkfout van mij is)

/*
 aansluitingen

 
 A+ - zwart motor
 A- - groen motor
 B+ - rood motor
 B- - blauw motor
  
Knop open/dicht
Knop voor open - D2
Knop voor dicht - D3
Via een PullUp weerstand 10K naar +5V

Eindschakelaars
Eind voor is open - D4
Eind voor is dicht - D5
Via een PullUp weerstand 10K naar GND
*/

#include <Pushbutton.h> //Bibbliotheek voor DeBounce
#include <Stepper.h>  //Bibliotheek voor steppermotor

//Instellingen knoppen
#define OpenKnop 2
#define DichtKnop 3
#define OpenEind 4
#define DichtEind 5

// Instellingen motor
#define StepPin 9  // step
#define DirPin 8   // direction
#define EnaPin 7  // Enable, HIGH = aan, LOW = uit
#define STEPS 200  //200 is 1 omwenteling
#define motorInterfaceType 1 //nodig?
Stepper stepper(STEPS, DirPin, StepPin);

//*****************************************

Pushbutton KnopOpen(OpenKnop);
Pushbutton KnopDicht(DichtKnop);

int Status = LOW; //Status van de knop ingedrukt, HIGH = op knop gedrukt
int Eind; //Status van eindschakelaars, HIGH = eind bereikt

void setup()
{
  Serial.begin(9600);
  
  pinMode(DichtEind,INPUT);
  pinMode(OpenEind,INPUT);
  
  pinMode (EnaPin,OUTPUT);
  digitalWrite(EnaPin,LOW);

 // Set the maximum speed in steps per second:
  stepper.setSpeed(500);  //Maximum motor speed for NEMA 17 is 4688 RPM but if we run it faster than 1000 RPM torque falls of quickly.

  /* Configure type of Steps 
  //
  // LOW LOW = Full Step
  // HIGH LOW = Half Step
  // LOW HIGH = A quarter of Step
  // HIGH HIGH = An eighth of Step
  */ 

 Serial.println("De setup is klaar");  
}


void loop ()
{
  //****Open doen****************************************
  //controleer knop open doen
  Status = KnopOpen.getSingleDebouncedPress();

  if (Status == HIGH)
  { 
    Serial.println("Open doen");

    //controleer of op eind is
    Eind = digitalRead(OpenEind);
    while (Eind == LOW)
    {
      digitalWrite(EnaPin,HIGH);
      Serial.println("DraaienOpen");
      stepper.step(1000);
      
      //controleer op knop open of dicht gedrukt, dan stoppen
      Status = KnopOpen.getSingleDebouncedPress();
      if (Status == HIGH)
      {
        Serial.println("onderbroken");
        break;
      }
      Status = KnopDicht.getSingleDebouncedPress();
      if (Status == HIGH)
      {
        Serial.println("onderbroken");
        break;
      }

      //controleer of op eind is
      Eind = digitalRead(OpenEind);
    }

    digitalWrite(EnaPin,LOW);
    Serial.println("Gestopt");
  }

  //****Dicht doen****************************************
  //controleer knop dicht doen
  Status = KnopDicht.getSingleDebouncedPress();

  if (Status == HIGH)
  { 
    Serial.println("Dicht doen");

    //controleer of op eind is
    Eind = digitalRead(DichtEind);
    while (Eind == LOW)
    {
      digitalWrite(EnaPin,HIGH);
      Serial.println("DraaienDicht");
      stepper.step(-1000); 

      //controleer op knop open of dicht gedrukt, dan stoppen
      Status = KnopDicht.getSingleDebouncedPress();
      if (Status == HIGH)
      {
        Serial.println("onderbroken");
        break;
      }
      Status = KnopOpen.getSingleDebouncedPress();
      if (Status == HIGH)
      {
        Serial.println("onderbroken");
        break;
      }

      //controleer of op eind is
      Eind = digitalRead(DichtEind);
    }
    
    digitalWrite(EnaPin,LOW);
    Serial.println("Gestopt");
  }
}

Please write in English. Posting in the Dutch forum could be another option.

Ok, sorry, I thought I was on a Dutch forum. Again the question in English.

Hello,
I want to use a NEMA17 motor to slide open a sun curtain.
The programme works, but the motor does not turn properly.
It makes a lot of noise and turns very slowly.

I have already tried all kinds of test programmes, but it keeps running too slowly with a lot of noise.

First I tried it with a driver DRV8825.
However, that one got very hot, to the point of finger burning.
Then I bought a TB6600. That one doesn't get hot and is easier to connect.
However, both setups give the same problem.

The arduino code is as follows: (I have already tried different speeds).

Does anyone have and idea what I am doing wrong? or will the NEMA17 be no good?
(I assume it is a fallacy of mine)

Thanks.
I use that driver myself and it's for sure a good driver.
Please post schematics, data supply data, the setting for current and the code.

Thanks for the answer.
The code is posted at the beginning of this topic.
The current is set to 2A, (switch 4 on,5 off,6 off, on the TB660)
The steps are set to whole step, (switch 1 on, 2 on, 3 off, on the TB6600)

picture of schematics

The code is working, the switches do what they are supposed to do.
The motor is spinning as well, but very slow and with a lot of noise. That is the problem.

The Arduino Stepper library will not work correctly with step/dir drives, seems you have a mix of Arduino Stepper library code and AccelStepper library code.

Not related to the malfunction you encounter but is there any reason some switches are connected to ground and use pull-ups and others are connected to 5V and use pull-downs ?

I think you can connect them all to ground (the -5V pin on your drawing should actually be named GND or 0V as it is ground) and use the µC internal pullups :
pinMode(DichtEind,INPUT_PULLUP);
which are between 20kΩ and 50 kΩ and modify the program accordingly.

Is the motor already connected to the sun curtain? If so, it might not be strong enough to move it which can explain the issue.

This is outside my area of experience; as far as I know NEMA17 is only a description of the physical mounting. Please post a datasheet of the motor so others might be abke to help further.

@ Etienne_74
I have to use the pull-ups, because I use the Pushbutton library vor debouncing. That library only works with push-ups. And indeed, not related to the malfunction.
But thanks anyway for thinking about the problem.

@ sterretje
No, the motor is not yet connected to the curtain. I first want to have the motor running properly.

Usually a DRV8825 is sufficent to drive a NEMA17. Did you set the current properly? As @sterretje already pointed out, NEMA17 only tells about the mechanics ( size of mounting/front plate ), not anything about the electrical specification. So please post a link to the specs of the motor.

Seems to be a little too much for a typical NEMA17, but as already mentioned we need the electrical specs of the motor to be sure.

The stepper.h isn't a suitable library for a step/dir driver. The motor only runs with 1/4 of the set speed. And all calls are blocking while the stepper moves.
You could try the MobaTools library.
Steppers are not really running quiet - especially in full step. If the current isn't set properly, it may be even worse.

A link to the specs
https://www.phidgets.com/productfiles/3303/3303_0/Documentation/3303_0_Datasheet.pdf

and a picture of the purchased motor

I am going to connect the motor to an easydriver with an arduino uno and code only to turn the motor.
For a test of the motor is ok.

I connected the motor to an easydriver and an arduino uno.
I used the following code, simple turning, no more

void setup() {               
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
}

void loop() {
  digitalWrite(9, HIGH);
  delay(1);         
  digitalWrite(9, LOW);
  delay(1);         
}

The motor spins for 2 seconds, then it starts stammering and the chip on the easydriver becomes very hot.
Can I conclude that the motor is malfunctioning ? Or is that too simple a thought

Why again a new driver? That doesn't help. And the easydriver is by far too weak for your stepper. Regarding the datasheet the stepper is rated for a coil current of 2.5A. That's a lot for a NEMA17 stepper. From all drivers you tried so far, the TB6600 is the only one that can provide that much current.
Did you try your simple test- sketch with the TB6600?
What about the PSU you use? Can it provide the needed power? The stepper needs 3.3Vx2.5A = 8,25W per coil or 16.5W overall. And you must take into account the losses of the driver and some headroom. So your PSU should be able to provide at least 30W.

The problem is the weak easydriver, not the motor. How did you adjust the current? The easydriver is rated for a max of 0.7A, which is much too less for your stepper.

I use a 12V 5A power supply. That must be enough.
Also the test-sketch dit not work properly.

But, You suggested to use the MobaTools library.
I did that and now it is working like a charm. :partying_face:
So it all came through wrong programming.

Thanks to all who where helpfull.

With which driver? Which configuration? And what means 'not properly'
We cannot see what you are doing - You must tell in detail.

Yes, that should be ok

Because you now stay in the english part of the forum, it may be a good idea to change the title to english too.

Good Idea. I have done that. Thanks

It isn't really a good Idea to tell 'it's working now' in an old post. The forum usually shows new posts at first. It was a pure coincidence I read that post again.
Have fun.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.