One of the issues in my project is that the motor driver that i’m using , the tmc2130, is too hot in use. I’m controller a regular stepper motor, a SY42STH38 -1684A, which had a rated voltage of 2.8V and a 1.68 A rated current. I am powering it with a generator with 6V because my driver only allow me to use 5.5V to 46V and set the maximum current to be 1A (the motor works fine). My program is very simple and i let it run for about 30s.
#include <iostream>
#include <unistd.h>
#include <pigpio.h>
using namespace std;
const uint8_t DIR = 27;
const uint8_t STEP = 22;
const uint8_t SENS = 17;
int i =0;
bool endCourse = true;
void init(){
gpioSetMode(DIR, PI_OUTPUT);
gpioSetMode(STEP, PI_OUTPUT);
gpioSetMode(SENS, PI_INPUT);
gpioSetPullUpDown(SENS, PI_PUD_UP);
}
void StepMoteur()
{
while (endCourse) // Increase the number of steps for testing
{
i = i+1;
cout << "Step " << gpioRead(SENS) << endl;
gpioWrite(STEP, 1);
usleep(2000); // Increase delay to 2000 microseconds (2ms)
gpioWrite(STEP, 0);
usleep(2000); // Increase delay to 2000 microseconds (2ms)
if (gpioRead(SENS) == 0){
sleep(1);
endCourse = false;
}
}
}
int main() {
if (gpioInitialise() == -1)
{
cerr << "pigpio initialization failed." << endl;
return -1;
}
init();
gpioWrite(DIR, 0);
cout << "Le moteur tourne dans le sens horaire" << endl;
StepMoteur();
gpioWrite(DIR, 1);
cout << "Le moteur tourne dans le sens contraire" << endl;
for (int i = 0; i < 1000; ++i) // Increase the number of steps for testing
{
//scout << "Step " << i << endl;
gpioWrite(STEP, 1);
usleep(2000); // Increase delay to 2000 microseconds (2ms)
gpioWrite(STEP, 0);
usleep(2000); // Increase delay to 2000 microseconds (2ms)
}
gpioTerminate();
return 0;
}
I would like in the futur to leave the power on all the time but without burning my driver.
I haven’t tried much yet, but I would appreciate any input you might have on this and am open to any ideas. I am currently controlling the motor using the step/dir mode, which is very limiting. As of today, I have very little knowledge about the SPI mode, but I know I could change a few things with it to help reduce the driver’s temperature. However, for the sake of simplicity, I would like to try other approaches before going down that path. Thanks.
Juliette Lavender is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2