Big Stepper Motors ...
 
Notifications
Clear all

Big Stepper Motors with Arduino

7 Posts
4 Users
1 Likes
2,667 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1053
Topic starter  

Today I’ll be working with a BIG stepper motor. I'll show you how to use a microstep driver module and an Arduino to drive a NEMA 23 size motor.

Article with code: https://dbot.ws/bigstep

Today we will work with a bigger motor than the ones used in the original stepper motor video. This motor is a NEMA 23 size beast that takes up to 4.2 amperes per coil, more than we can drive using the drivers and H-Bridges we used earlier.

To drive this motor I'll be using a microstep module, a common device available on eBay, at Amazon, and at your local electronic and electrical supply store. The module I used is a model MA860H but the wiring and coding will work for any one of these modules.

In order to select a module suitable for your stepper motor you will need to know how to read and interpret some of the stepper motor specifications, so I’ll cover that. One spec that fools a lot of people is the voltage rating, I'll explain why the number in the spec sheets can be ignored!

I’ll show you how to hook the microstep module up to an Arduino and how to code for it, using a simple sketch and also the AccelStepper library.

Here is what you will find in today's video:

00:00 - Introduction
02:18 - Reading Stepper Motors Specifications
08:49 - Selecting a Microstep Driver
12:33 - Arduino Hookup and Demo
22:44 - Using AccelStepper

If you’d like the sketch or want additional information you can find it all in the article on the DroneBot Workshop website at https://dbot.ws/bigstep

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote
WhitneyDesignLabs
(@whitneydesignlabs)
Member
Joined: 3 years ago
Posts: 99
 

My local salvage yard offered up this monster stepper motor, for only a couple bucks. So I had to duplicate Bill's experiment. The stepper driver was about eight bucks on eBay. It was a very rewarding experiment. I am thinking of using this motor to drive the steering of a 3-wheel trike robot/electric vehicle project I have been thinking about. This motor would also make a nice force-feedback for my flight sim yoke, Cessna 172 cockpit project.

BigStepper

 

Imagine by thought, create, don't wait, Scott.


   
Centari reacted
ReplyQuote
(@valkrider)
Member
Joined: 3 years ago
Posts: 16
 

Anyone tell me how to make use of this and remove the ability to switch direction? I only ever want my stepper motor to turn one way on my rose engine lathe. Thanks

--
Colin
My website


   
ReplyQuote
(@valkrider)
Member
Joined: 3 years ago
Posts: 16
 

Any suggestions I have tried this sketch and even though there is power to the stepper driver and it is properly configured my stepper motor does not move. Any debug info most welcome as I am new at the Arduino and using it for something like this.

--
Colin
My website


   
ReplyQuote
(@stortag)
Member
Joined: 3 years ago
Posts: 2
 

@valkrider

Since there is three months since you wrote this, perhaps you allready got it figured out? But any way I will share my own experience with it.

I started out with the "Basic Arduino PWM Sketch" and decided to create an even more basic version. Skipping the display and many buttons and instead hook up a potentiometer, as shown in the picture below.

/*
PWM Motor Test
pwm_motortest.ino
Uses LCD Keypad module
Modified from Cytron example code

DroneBot Workshop 2019
https://dronebotworkshop.com
*/
// Include libraries for LCD Display
#include <LiquidCrystal.h>
#include <LCD_Key.h>

// Define keycodes
#define None 0
#define Select 1
#define Left 2
#define Up 3
#define Down 4
#define Right 5

// Pin for analog keypad
#define diy_pwm A2
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2

// Define LCD display connections
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// Setup LCD Keypad object
LCD_Key keypad;

// Variable to represent PWM value
int pwm_value = 0;

// Variable to represent Keypad value
int localKey;

void setup(){

// Setup LCD
lcd.begin(16, 2);
lcd.clear();

// Define Pins
pinMode(pwm,OUTPUT);
pinMode(dir,OUTPUT);

}

void loop()
{
while(1)
{
// Scan keypad to determine which button was pressed
localKey = keypad.getKey();

// Toggle motor direction if LEFT button pressed
if(localKey==Left){
digitalWrite(dir,!digitalRead(dir));
delay(200);}

// Increase motor speed if UP button pressed
if(localKey==Up){
pwm_value++;
delay(200);
lcd.clear();}

// Decrease motor speed if DOWN button pressed
else if(localKey==Down){
pwm_value--;
delay(200);
lcd.clear();}

// Ensure PWM value ranges from 0 to 255
if(pwm_value>255)
pwm_value= 255;
else if(pwm_value<0)
pwm_value= 0;

// Send PWM to output pin
analogWrite(pwm,pwm_value);

// Display results on LCD
lcd.setCursor(0,0);
lcd.print("PWM:");
lcd.print(pwm_value);
lcd.setCursor(0,1);
lcd.print("DIR:");
lcd.print(digitalRead(dir));
}
}

 

I have commented what basically everything does in hopes that it will be easy to understand.

Capture

If you need to debug your code to see why the motor is not spinning up you can insert "Serial.println()" after each row where you do something. Like for instance in my example after I red the value from the potentiometer I could write "Serial.println(pot_value)" in order to see the value that has been red in the serial monitor up in the right qorner of the arduino ide. Then when I know that it was successful I could move on to the next row and see row by row if something is working as expected or not. When you are satisfied that the pwm signal coming out of the arduino is correct you can move on to the hardware.

Here it's a bit trickier to check without an oscilloscope, so you will probably have to look up some documentation for your motor driver and see that all the cables are correct.

What model are you using?


   
ReplyQuote
(@stortag)
Member
Joined: 3 years ago
Posts: 2
 

As mentioned in my previous reply I did my own variant with a potentiometer instead of the display with buttons. I read the signal that it gives and re-map it within the 0-255 range. I then finally write that to the pwm pin. Since nothing is being written to the direction pin it goes only one way by default.

I recently bought my very own oscilloscope, a Rigol DS1102 and decided to do the exact same test where I would measure the pwm signal that is coming out of the arduino (yellow) and also the signal going out to the motor (blue). The motor is a big 24V 250W (0,5 horse power) E-scooter motor.

DS1Z QuickPrint1

My lines are quite good but there is some slight disturbance like seen in Bill's video also, on the default clock frequency of the Arduino nano every that I am using. I will try to increase the frequency and take a new screenshot. I will of course post it here as well.


   
ReplyQuote
(@valkrider)
Member
Joined: 3 years ago
Posts: 16
 

@Stortag Thanks for the reply I will have a play with your code over the weekend and report back. 👍 👍 

--
Colin
My website


   
ReplyQuote