
The first section of the sketch defines all of the pin connections between the RedBoard and the Easy Driver. Once you have everything connected, your circuit should look like the following: Here are the following pin connections for our example. However, any microcontroller that works at 3.3V or 5V logic and has digital I/O with PWM capability will work for this example. Connect a Microcontrollerįor this example, we will be using the SparkFun RedBoard. REMEMBER to disconnect the power before connecting/disconnecting your motor. You can use any kind of power supply (desktop, wall adapter, battery power, etc.), but verify that whatever choice you go with is capable of providing up to 2A and falls in the range of 6V to 30V.Ĭonnect the power supply to M+ and GND. Once your motor is connected, you can then connect a power supply to the Easy Driver.
#4 wire stepper motor arduino code driver#
If any of the motor wires comes loose while power is applied, the driver can be damaged. Note: Do not connect or disconnect the motor while the Easy Driver is powered. The connections between the Easy Driver and motor are as follows. In our example, we are using a 4-coil motor. There is no polarity on the coils, so you don’t need to worry about plugging in a coil backwards on the board. The first coil pair should be plugged into Coil A+ and Coil A-, while the second coil pair plugs into Coil B+ and Coil B. Once you have determined the coil wire pairs, you will need to attach them to the Easy Driver. Repeat for the second group of three wires. Once the three wires for one coil have been determined, find two of the three that show the highest resistance between them.

Two wires should show some resistance between them and the first wire picked, while the other three will show no connection at all.

Pick one wire, and test this against all other wires. The remaining two wires should show similar resistance between the two of them.įor a 6-wire motor, you will need to determine which of three the wires go together for one coil. Whichever wire shows the lowest resistance against the first wire is the pair mate. However, if you are using a 4-wire or 6-wire stepper motor, it is still possible to determine the coil wire pairs without the datasheet.įor a 4-wire motor, take one wire and check its resistance against each of the three remaining wires. If the jumper is closed, VCC is 3.3V.Ĭoil wire diagram from the datasheet our NEMA 16 Stepper Motor with Cable.

There are also pins across the bottom of the board. If set to LOW, all FETs will be enabled, allowing motor control. If set to HIGH, the FETs will be disabled, and the IC will not drive the motor. Enables the FET functionality within the motor driver. Must be pulled HIGH to enable STEP control. When set LOW, all STEP commands are ignored and all FET functionality is turned off. Mixed decay occurs at 0.21Vcc< PFD < 0.6Vcc. If PFD < 0.21Vcc, fast decay mode is activated. If PFD > 0.6Vcc, slow decay mode is activated. PFD - Voltage input that selects output current decay mode.Half of connection point for bi-polar stepper motor coil B.

Half of connection point for bi-polar stepper motor coil A.
