[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");
}
}

