AED 24.15
Description
EasyDriver is a Stepper Motor Driver that can drive up to about 750mA per phase of a bipolar stepper motor. It defaults to 8 step microstepping mode. (So if your motor is 200 full steps per revolution, you would get 1600 steps/rev using EasyDriver.) This setting can be easily overridden by tying the MS1 and/or MS2 pin to ground to set the driver to use 1/8, 1/4, or 1/2 micro-step mode. It is a chopper microstepping driver based on the Allegro A3967 driver chip. It has a variable max current from about 150mA/phase to 750mA/phase. and can take a maximum motor drive voltage of around 30V and includes onboard 5V regulation, so only one supply is necessary. The best part - low cost.
Stepper Motor Driver A3967 Easy Drive pinout Description:
GND: There are three GND (Ground) pins on the Easy Driver. They are all connected together inside the board.
M+: This is the power input to the EasyDriver. Connect this to the positive power supply lead. This should be a 6V to 30V, 2A (or more) power supply that is clean (low ripple);
A and B : (four pins) These are the motor connections. A and B are the two coils of the motor and can swap the two wires for a given coil (it will just reverse the direction of the motor). Make CERTAIN that this connection to the motor is solid, and NOT through a connector that has any chance of intermittent contact (which will fry the motor driver chip);
STEP: This needs to be a 0V to 5V (or 0V to 3.3V if you’ve set your Easy Driver that way) digital signal. Each rising edge of this signal will cause one step (or micro-step) to be taken;
DIR (Direction): This needs to be a 0V to 5V (or 0V to 3.3V if you’ve set your Easy Driver up that way) digital signal. The level if this signal (high/low) is sampled on each rising edge of STEP to determine which direction to take the step (or micro-step).That’s it — those are the only signals that you absolutely need to connect to anything. All the rest below are optional — in other words, the Easy Driver sets them to reasonable default values.
MS1/MS2: These digital inputs control the microstepping mode. Possible settings are (MS1/MS2) : full step (0,0), half step (1,0), 1/4 step (0,1), and 1/8 step (1,1 : default);
RST (reset): This normally high input signal will reset the internal translator and disable all output drivers when pulled low;
SLP (sleep): This normally high input signal will minimize power consumption by disabling internal circuitry and the output drivers when pulled low;
ENABLE: This normally low input signal will disable all outputs when pulled high;
+5V: You see that the EasyDriver has a pin labeled 5V. What is it for? Well, there is a lot of confusion about this pin. It is NOT for powering the Easy Driver at 5V. In other words, it is NOT a power input or input of any kind. In fact, it’s an output pin! Yup, the EasyDriver’s 5V regulator has some extra juice, and so we brought out the 5V output of the regulator for you to use if you want. This means that you can connect other things to this pin that need 5V to operate, and the EasyDriver will power them. To a limit, of course. So, his is an OUTPUT pin that will provide either 5V (default) or 3.3V from the voltage regulator, at a small amount of current (say 50mA — depends on input voltage) to power a circuit that you may need power. If you cut jumper APWR (SJ1) then you can use the 5V pin as a VCC input to the Easy Driver, powering it with your own VCC supply;
3/5V JUMPER: What does this jumper do on the board? The way I designed the EasyDriver is with a power supply that can supply either 3.3V or 5V to the EasyDriver’s logic-level power rail (Vcc on the schematic). This allows people to use the Easy Driver with a microcontroller that output either 3.3V or 5V control signals;
APWR: The purpose of APWR is to allow users to disconnect the built-in logic power supply of the EasyDriver and power it using their own 5V or 3.3V logic level power supply. You might want to do this for power savings reasons. For example, if you’re using a 24V M+ motor power supply for the EasyDriver, the built-in voltage regulator (IC2 on the schematic) will get very hot because it’s dropping that 24V down to 5V and giving up all of that extra voltage as heat. This is very inefficient and will raise the temperature of the board
Stepper Motor Driver A3967 Easy Drive Step Resolution Table:
MS1 | MS2 | Resolution |
low | low | Full Step (2 phase) |
high | low | Half step |
low | high | Quarter step |
high | high | Eight step |
The get Schematic for Easy Drive V4.3 CLICK HERE.
Changing Stepper motor speed using Easy Drive V4.3
Sometimes you need to have real-time control of the speed of the stepper motor.
One easy way is to use a potentiometer, which produces an analog voltage output that you can control. The sketch code can read this analog value using the analogRead() command. Then we can use that value to change how fast we move the motor.
Here's a simple example. We've added a pot and three pushbuttons to our single stepper motor circuit. Pushing switch S1 will cause the motor to turn in one direction, S3 will cause it to turn in the other direction, and S2 will stop the motor. You can then use the pot to adjust the exact speed of the motor while stepping. You may want to adjust the MAX_SPEED and MIN_SPEED values in the code for your application.
And this is How to wire the Stepper Motor Driver A3967 Easy Drive With Arduino:
The Code for Stepper Motor Driver A3967 Easy Drive with Arduino:
First, you need to Download and Add the AccelStepper library to the Arduino IDE Click Here to Download.
#include
// Define the stepper and the pins it will use AccelStepper stepper1(AccelStepper::DRIVER, 9, 8); // Define our three input button pins #define LEFT_PIN 4 #define STOP_PIN 3 #define RIGHT_PIN 2 // Define our analog pot input pin #define SPEED_PIN 0 // Define our maximum and minimum speed in steps per second (scale pot to these) #define MAX_SPEED 500 #define MIN_SPEED 0.1 void setup() { // The only AccelStepper value we have to set here is the max speeed, which is higher than we'll ever go stepper1.setMaxSpeed(10000.0); // Set up the three button inputs, with pullups pinMode(LEFT_PIN, INPUT_PULLUP); pinMode(STOP_PIN, INPUT_PULLUP); pinMode(RIGHT_PIN, INPUT_PULLUP); } void loop() { static float current_speed = 0.0; // Holds current motor speed in steps/second static int analog_read_counter = 1000; // Counts down to 0 to fire analog read static char sign = 0; // Holds -1, 1 or 0 to turn the motor on/off and control direction static int analog_value = 0; // Holds raw analog value. // If a switch is pushed down (low), set the sign value appropriately if (digitalRead(LEFT_PIN) == 0) { sign = 1; } else if (digitalRead(RIGHT_PIN) == 0) { sign = -1; } else if (digitalRead(STOP_PIN) == 0) { sign = 0; } // We only want to read the pot every so often (because it takes a long time we don't // want to do it every time through the main loop). if (analog_read_counter > 0) { analog_read_counter--; } else { analog_read_counter = 3000; // Now read the pot (from 0 to 1023) analog_value = analogRead(SPEED_PIN); // Give the stepper a chance to step if it needs to stepper1.runSpeed(); // And scale the pot's value from min to max speeds current_speed = sign * (((analog_value/1023.0) * (MAX_SPEED - MIN_SPEED)) + MIN_SPEED); // Update the stepper to run at this new speed stepper1.setSpeed(current_speed); } // This will run the stepper at a constant speed stepper1.runSpeed(); }
Some explanation on this example code: Because reading the analog value takes a (relatively) long period of time, and during that time we can't be updating the stepper motor's position (that only happens in the runSpeed() call) we only grab a new analog value every 3000 times through the main loop. We do this by using a counter called analog_read_counter, and decrementing it each time through the loop until it gets to zero. Then we reload it with 3000 and perform the analog conversion.
We've also inserted a runSpeed() call between the analog conversion and the math necessary to scale the result to MAX_SPEED and MIN_SPEED. This is because math also takes a (relatively) long time, and so we want to give the stepper a chance to step (if it needs to) in between these to time-intensive operations.
You can adjust the values of MIN_SPEED and MAX_SPEED to make the range of speeds whatever you want. Note that there are only 1024 possible values that the analogRead() call can return, and so there are only that many discrete speeds the motor can take on.
For this example (because we wanted it to be just a fixed speed) we did not use the normal AccelStepper run() call, but rather the runSpeed() call.