NEMA17 Smart Stepper Misfit Tech support

Hey guys,

I’ve recently bought one of these aliexpress clones of the Smart Stepper and Mechaduino board:

I was thinking I was going to be able to use with the BLDC motors as well as for the steppers but it turned out to be far trickier than I though :smiley:

Anyway I spent some time on it today and was able to make it work with the simplefoc without too many problems. The boards is super simple to mount and has many great features. I am not sure that this aliexpress clone is the best one to buy but the boards like this one are pretty common and are a good choice for the simplefoc.

The support is still in the early stage, and there might be some issues though. SAMD21 is still in the early stage of the support as well.

Simple code example

So the code to run this board is almost a standard example code of the simplefoc library:

/**
 * Smart Stepper support with SimpleFOClibrary
 */
#include <SimpleFOC.h>

// magnetic sensor instance - SPI
MagneticSensorSPI sensor = MagneticSensorSPI(AS5147_SPI, A2);

// Stepper motor & driver instance
StepperMotor motor = StepperMotor(50);
// pin 12 is not connected anywhere and in the version v2.1.1 of the library we need 
// to provide the enable pins for all the phases so here it is twice :D
// this will be resolved in the new release
StepperDriver2PWM driver = StepperDriver2PWM(4, 5, 6, 9,  A4, 7,12, 12);

// instantiate the commander
Commander command = Commander(SerialUSB);
void doMotor(char* cmd) { command.motor(&motor, cmd); }

void setup() {

  // initialise magnetic sensor hardware
  sensor.init();
  // link the motor to the sensor
  motor.linkSensor(&sensor);

  // power supply voltage
  driver.voltage_power_supply = 12;
  driver.init();
  motor.linkDriver(&driver);

  // set motion control loop to be used
  motor.controller = MotionControlType::torque;

  // use monitoring with SerialUSB 
  SerialUSB.begin(115200);
  // comment out if not needed
  motor.useMonitoring(SerialUSB);

  // initialize motor
  motor.init();
  // align sensor and start FOC
  motor.initFOC();

  // add target command M
  command.add('M', doMotor, "my motor");

  SerialUSB.println(F("Motor ready."));
  SerialUSB.println(F("Set the target voltage using Serial terminal:"));
  _delay(1000);
}

void loop() {
  // main FOC algorithm function
  motor.loopFOC();

  // Motion control function
  motor.move();
  
  // user communication
  command.run();
}

Beware

This board does the current control itself and allows the user to set the voltage that is proportional to the current he wants to set. So even though you are running the code in the voltage mode you are actually not setting the voltage :smiley:
. It has integrated A4954 dual half bridge which support a very custom type of current control. The duty cycle of the PWM you send to the driver is not interpreted directly as the value to be set to the motor but as a current limit command.
http://elecanisms.olin.edu/handouts/2.3_A4954-Datasheet.pdf

I am still not sure what is the exact conversion ratio in between the current and the voltage on this board but it is fixed. Maybe some of you already know it. :smiley:
If not, I suggest you to start small. Set your motor into the torque(voltage) mode and rise the voltage until you have too much noise/heat. :smiley:

Also this board still has a considerable amount of noise, not as much as the regular steppers but there this type of current control introduces a high pitch noise which cannot really be overcome with high pwm frequency.

The video of it in action will be in this link once when it’s uploaded :smiley:

3 Likes