Skip to main content

LMD18245 base Microstep 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.



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. All the project schematics and firmware source codes (including compiled binaries) are available to download at elect.wikispaces.com.


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

Full Step

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

Half Step (without torque compensation)

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};

Half Step (with torque compensation)

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};

32 Step Positions

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};

40 Step Positions

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};

Comments

Popular posts from this blog

CD2003 - yet another simple FM radio receiver

In the last few days, we are looking for some simple FM radio receiver to integrate into one of our ongoing projects. For that, we try several FM radio receiver ICs including TDA7000, CD2003/TA2003/TA8164, CXA1019, and KA22429. Out of all those chips we select CD2003 (or TA2003/TA8164) based receiver for our project because of its simplicity and outstanding performance. Except to CD2003, Sony CXA1019 also perform well but we drop it because of its higher component count. We design our receiver based on Toshiba TA2003 datasheet and later we try TA8164 and CD2003 with the same circuit. Either CD2003 or TA8164 can directly replace TA2003 IC, and as per our observations, TA8164 gives excellent results out of those 3 chips. A prototype version of CD2003 FM radio receiver The PCB design and schematic which we used in our prototype project are available to download at google drive (including pin-outs of crystal filters and inductors ). Except for CD2003 IC, this receiver consist...

Arduino superheterodyne receiver

In this project, we extend the shortwave superheterodyne receiver we developed a few years ago . Like the previous design, this receiver operates on the traditional superheterodyne principle.  In this upgrade, we enhanced the local oscillator with Si5351 clock generator module and Arduino control circuit. Compared to the old design, this new receiver uses an improved version of an intermediate frequency amplifier with 3 I.F transformers. In this new design, we divide this receiver into several blocks, which include, mixer with a detector, a local oscillator, and an I.F amplifier. The I.F amplifier builds into one PCB. The filter stage, mixer, and detector stages place in another PCB. Prototype version of 455kHz I.F amplifier. In this prototype build, the Si5351 clock generator drives using an Arduino Uno board. With the given sketch, the user can tune and switch the shortwave meter bands using a rotary encoder. The supplied sketch support clock generation from 5205kHz (tuner f...

Calculator for audio output transformers

Audio output transformers are heavily used in a vacuum tube and some (older) transistor base audio power amplifiers, but these days output transformer are quite hard to find and expensive item. For homebrew projects, the best option is to construct those transformers by ourselves and this script helps to calculate winding parameters for those transformers. This " AF output transformer calculator " script is written using Python and it works with most of the commonly available Python interpreters . The script is available to download at google drive under the terms of GNU General Public License version 3.0 . Homebrewed 25k: 4 output transformer Once supplied the input parameters this script provides a winding ratio, the number of turns required for primary and secondary winding and required copper wire gauges for both primary and secondary windings, etc. We construct several AF output transformers based on results of this script, which including transformers for M...