Alex M0TOT has followed up on his uni-polar stepper motor project with some modifications and enhancements - it now uses a more powerful Bi-polar motor and a new driver. It's also now controlled by an Arduino Uno open-source microcontroller board. You can see the code ('Sketch' in Arduino terminology) below. It's quite easy to follow along and see how it works. Well done Alex.

This is what he had to report on his latest project. Thanks to Alex for his contributions as always.

I am not really into Arduino and Sketches but could not use the uni-polar motor P.C.B. from last time to run a bi-polar motor. It would have meant building two new 'H' Bridge PCBs.

The Arduino ‘Example Sketch’ gives all the ‘C’ Code lines for the motor:

// Example sketch to control a Stepper Motor with TB6600 Stepper Motor Driver.
// Reference: https://www.makerguides.com/tb6600-stepper-motor-driver-arduino-tutorial/
// and ‘Programming Arduino – Getting started with Sketches’ by Simon Monk (Second Edition).
// 
// Compiler defines Stepper Motor connections and steps-per-revolution:
// Each step of 1.8 degrees is divided 8 x times = 0.225 degrees. 
// 360 degrees is divided by 0.225 degrees = 1600 microsteps.
// Microsteps help to reduce the amount of vibration at slow speeds.
// In microsteps a phase is not fully 'ON' or fully 'OFF'.
// This may cause the motor to become warm/hot at low speeds.

int dirPin = 2;
int stepPin = 3;
int stepsPerRevolution = 1600;

void setup()
{
// Declare pins as OUTPUT:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}

void loop()
{
// Set the spinning direction CLOCKWISE:
// Spinning direction of the motor is set in
// the'dirPin', either HIGH or LOW.

digitalWrite(dirPin, HIGH);
// Spin the stepper motor one-revolution SLOWLY;
for (int i = 0; i <stepsPerRevolution; i++)
{

// These four-lines result in one-step:
// The speed of the motor is determined by the 
// frequency of the pulses that are sent to the
// STEP pin. The higher the frequency the faster
// The motor runs. Pulses are changed in the
// 'delayMicroseconds()'.

digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}

delay(1000);

// Set the spinning direction COUNTER-CLOCKWISE;
digitalWrite(dirPin, LOW);

// Spin the stepper motor one-revolution QUICKLY:
for (int i = 0; i <stepsPerRevolution; i++)
{

// These four-steps result in one-step:

digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}

delay(1000);

// Set the spinning direction CLOCKWISE:

digitalWrite(dirPin, HIGH);

//Spin the stepper motor five-revolutions or 8,000 microsteps FAST:
for (int i = 0; i < 5 * stepsPerRevolution; i++)
{

// These four-steps result in one-step:

digitalWrite(stepPin, HIGH);
delayMicroseconds(500);
digitalWrite(stepPin, LOW);
delayMicroseconds(500);
}

delay(1000);

// Set the spinning direction COUNTER-CLOCKWISE:

digitalWrite(dirPin, LOW);

//Spin the stepper motor five-revolutions FAST:

for (int i = 0; i < 5 * stepsPerRevolution; i++)
{
// These four-steps result in one-step:

digitalWrite(stepPin, HIGH);
delayMicroseconds(500);
digitalWrite(stepPin, LOW);
delayMicroseconds(500);
}

delay(1000);

}

Bi-polar stepper motor specification:

NEMA 17 Bi-polar Stepper Motor, 4-Wires, 12 Volt, 0.4 Amp, 28 Ncm.

When the motor is running slowly it becomes warm/hot, so I had to attach some heatsinks. In fact the two together are still too small, but I did not have anything else at the time.

Alex M0TOT

Save
Cookies user prefences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Session Cookie
A session cookie for a website only exists whilst the user is reading or navigating the website. When the user closes their web browser these cookies are removed.
Joomla Content Management System
Accept
Decline