LMD18245+Microstep+Stepper+Motor+Driver

This article describe the LMD18245 and PIC16F877A base 16 step bipolar stepper motor driver which is design to work with 12V 18 º bipolar stepper motors. In this design we use pair of LMD18245 DMOS full bridge motor drivers to control 2 phases of the stepper motor and PIC16F877A MCU is used as controller.

We test this driver with several stepper motors (including 1.8 º - 12V stepper motors) and all of them provide excellent smooth output with this driver. The supplied firmware of this driver is design for 16 micro-steps but it can be easily change to full-step, half-step, 8, 32 or 40 micro-steps.

media type="custom" key="24086156" align="center" In this given design LMD18245 current sense resistor is calculated for 200mA and it can be extend to 3A by changing the value of R2 and R4 resistors. For more information refer the LMD18245 datasheet.

This project is released as open hardware project. Firmware of this project is released under the terms of MIT License and schematic is released under the terms of Creative Commons Attribution 3.0 Unported License.

Data tables and configurations for full-step, half-step, 8, 32 or 40 micro-steps

 * Full Step**

code format="c" MOTOR_STEP_COUNT = 4; char MOTOR_DATA_PORTB[4] = {0b00111110, 0b00000000, 0b00111101, 0b00000011}; char MOTOR_DATA_PORTD[4] = {0b0000, 0b1111, 0b0000, 0b1111}; code


 * Half Step (without torque compensation)**

code format="c" MOTOR_STEP_COUNT = 8; char MOTOR_DATA_PORTB[8] = {0b00111110, 0b00111110, 0b00000000, 0b00111100, 0b00111101, 0b00111101, 0b00000011, 0b00111111}; char MOTOR_DATA_PORTD[8] = {0b0000, 0b1111, 0b1111, 0b1111, 0b0000, 0b1111, 0b1111, 0b1111}; code


 * Half Step (with torque compensation)**

code format="c" MOTOR_STEP_COUNT = 8; char MOTOR_DATA_PORTB[8] = {0b00000011, 0b00101111, 0b00111110, 0b00101110, 0b00000000, 0b00101100, 0b00111101, 0b00101101}; char MOTOR_DATA_PORTD[8] = {0b1111, 0b1011, 0b0000, 0b1011, 0b1111, 0b1011, 0b0000, 0b1011}; code


 * 32 Step Positions**

code format="c" MOTOR_STEP_COUNT = 32; char MOTOR_DATA_PORTB[32] = {0b00000011, 0b00001111, 0b00011011, 0b00100011, 0b00101111, 0b00110011, 0b00111011, 0b00111111, 0b00111110, 0b00111110, 0b00111010, 0b00110110, 0b00101110, 0b00100010, 0b00011010, 0b00001110, 0b00000000, 0b00001100, 0b00011000, 0b00100000, 0b00101100, 0b00110000, 0b00111000, 0b00111100, 0b00111101, 0b00111101, 0b00111001, 0b00110101, 0b00101101, 0b00100001, 0b00011001, 0b00001101}; char MOTOR_DATA_PORTD[32] = {0b1111, 0b1111, 0b1110, 0b1101, 0b1011, 0b1000, 0b0110, 0b0011, 0b0000, 0b0011, 0b0110, 0b1000, 0b1011, 0b1100, 0b1110, 0b1111, 0b1111, 0b1111, 0b1110, 0b1101, 0b1011, 0b1000, 0b0110, 0b0011, 0b0000, 0b0011, 0b0110, 0b1000, 0b1011, 0b1100, 0b1110, 0b1111}; code


 * 40 Step Positions**

code format="c" MOTOR_STEP_COUNT = 40; char MOTOR_DATA_PORTB[40] = {0b00000011, 0b00001011, 0b00010111, 0b00011111, 0b00100111, 0b00101111, 0b00110011, 0b00110111, 0b00111011, 0b00111111, 0b00111110, 0b00111110, 0b00111010, 0b00110110, 0b00110010, 0b00101110, 0b00100110, 0b00011110, 0b00010110, 0b00001010, 0b00000000, 0b00001000, 0b00010100, 0b00011100, 0b00100100, 0b00101100, 0b00110000, 0b00110100, 0b00111000, 0b00111100, 0b00111101, 0b00111101, 0b00111001, 0b00110101, 0b00110001, 0b00101101, 0b00100101, 0b00011101, 0b00010101, 0b00001001}; char MOTOR_DATA_PORTD[40] = {0b1111, 0b1111, 0b1110, 0b1101, 0b1100, 0b1011, 0b1001, 0b0111, 0b0101, 0b0010, 0b0000, 0b0010, 0b0101, 0b0111, 0b1001, 0b1011, 0b1100, 0b1101, 0b1110, 0b1111, 0b1111, 0b1111, 0b1110, 0b1101, 0b1100, 0b1011, 0b1001, 0b0111, 0b0101, 0b0010, 0b0000, 0b0010, 0b0101, 0b0111, 0b1001, 0b1011, 0b1100, 0b1101, 0b1110, 0b1111}; code

Project Related Downloads
[|Complete schematics and project files of LMD18245 - Micro-step Stepper Motor Driver]