Can't disable stepper motor driver CNC shield

Hi there,
I've got a really simple program running to control a stepper motor with a potentiometer. My plan here is to actually use a stepper as a hub motor for an RC vehicle (Yes, I know that they are very power hungry etc.) With that being the case, I need the motors to shut off when I stop the vehicle to save power. I have gotten the stepper turning nicely with the pot but I can't seem to shut it off with the "enable" pin. Any idea what I'm doing wrong?

Bonus question:
I swapped out the A4988 driver for a TMC2209 and it is much quieter, however, it spins at a much slower speed, even if I make the delay time tiny (as shown in code). Why could this be?

const int StepX = 2;
const int DirX = 5;
const int StepY = 3;
const int DirY = 6;
const int StepZ = 4;
const int DirZ = 7;
const int enable = 8;
int potpin = A1;
int pot;
int spd;

void setup() {
  pinMode(StepX,OUTPUT);
  pinMode(DirX,OUTPUT);
  pinMode(StepY,OUTPUT);
  pinMode(DirY,OUTPUT);
  pinMode(StepZ,OUTPUT);
  pinMode( DirZ,OUTPUT);
}

void loop() {
  pot = analogRead(potpin);
if (pot > 1){
  digitalWrite(enable, LOW);
 spd = map(pot, 0, 1023,3000, 1);
 digitalWrite(DirX, HIGH); 
 
  digitalWrite(StepX,HIGH);
  delayMicroseconds(spd);
  digitalWrite(StepX,LOW); 
  delayMicroseconds(spd);
}
else{
  digitalWrite(enable,HIGH); // This should disable the stepper, right????
}
 }

Rather than give us the chip name, it would be much better to give a link to the motor driver control board. Then we might be able to find a schematic for the board and discover how they have wire d the enable pin. It may be locked to ground by the board circuitry. If so, you will need to remove that connection.

2 Likes

Can you post a schematic, not a frizzy picture of how this is connected and how it is powered. Be sure to include all connections. Also as Paul_KD7HB asked supply links to technical information on all the hardware devices. When I searched I got over 500,000 hits for TMC2209. I am assuming the motors are connected to an external power supply as we know the Arduino A Power Supply it is Not.

Shouldn't you set the 'enable' pin as an OUTPUT?

1 Like

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