Big Stepper Motors with Arduino
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
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.
Like: Python, Adept: C++, Don't like: Java
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
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.
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
Uses LCD Keypad module
Modified from Cytron example code
DroneBot Workshop 2019
// Include libraries for LCD Display
// 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
// Variable to represent PWM value
int pwm_value = 0;
// Variable to represent Keypad value
// Setup LCD
// Define Pins
// Scan keypad to determine which button was pressed
localKey = keypad.getKey();
// Toggle motor direction if LEFT button pressed
// Increase motor speed if UP button pressed
// Decrease motor speed if DOWN button pressed
// Ensure PWM value ranges from 0 to 255
// Send PWM to output pin
// Display results on LCD
I have commented what basically everything does in hopes that it will be easy to understand.
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?
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.
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.