|
~: Stepper motor drive Panel :~
Abstract: - Here is the application that drives unipolar stepper motor as one enters desire no of rotations and desire RPM. This circuit rotates any unipolar stepper motor for no. Of rotations at set RPM both entered by user. Any stepper motor has basically three parameters that we can change direction, no of rotations and RPM. All these three parameter we can set here and then press start button to rotate motor. So this is actually a panel board for stepper motor where user can set the parameters through keypad and start the operation.
______________________
Let us start with panel design. The figure given below shows unipolar stepper motor control panel.

There are
-
20X2 LCD panel to display various messages and parameters.
-
SPDT sliding switch is used to select direction of rotation
-
4X3 numeric keypad to enter parameters and start operation
-
LED indicators to indicate rotating direction
-
Stepper motor connector to connect unipolar stepper motor. (C - common, L1 - coil 1, L2 - coil 2 and like wise)
Now let us see the internal circuit diagram

As shown in above figure the one and only major component is micro controller 89C51 that will take care of all the operations. Other components are 20X2 LCD, current driver chip ULN2003A and 4x3 numeric keypad.
Connections: -
all 4 rows of keypad are connected with P1.0-P1.3 and columns are connected with P1.4 - P1.6. Datalines (D0-D7) are connected with P2 and control lines Rs & En are connected with P3.0 & P3.1 respectively. Rw is directly grounded. 2 LEDs are connected with P3.2 and P3.3. P3.4 to P3.7 drives stepper motor through ULN chip. One SPDT switch connected to P0.0 to connect it with Vcc or Gnd. C1 is used for power on reset feature. Crystal X1 (12 MHz) along with 2 33pf capacitors provides clocking signal to 89C51.
Operation: -
-
Initially the message "enter rotation in 2 digits" is displayed
-
After pressing 2 digits as one enters it, again message "enter RPS in 2 digits" is displayed
-
When both rotations and RPS are entered then message "press start" is displayed and system waits for start switch to be pressed
-
Before pressing start switch one can select CW or CCW direction using SPDT switch.
-
As one presses start switch the motor will start rotating. It rotates at entered RPS and completes desired no of rotations.
-
If motor rotates CW then LED1 blinks at PRF (pulse repetition frequency) and if it rotates CCW then LED2 blinks.
-
Again same above cycle repeats for next operation.
Now this entire operation is handled by the software program written in C language that is loaded in micro-controller 89C51. So now let us understand it.
Software program: -
writecmd function sends command byte to LCD. It takes one argument byte and sends it to P0
writedata function sends data byte to be displayed on LCD. It also takes one argument byte and sends it to P0
writestr function writes whole string (message) on LCD. It takes pointer as an argument that points address of first character of string. Then through pointer it sends all the character one by one to P0
lcdbusy function provides delay after sending command or data byte to LCD
dely function is a variable delay that is applied between consecutive pulses to motor so that RPM will change.
keydly is key debounce delay of 0.1 sec.
display function takes hex value and first convert it into decimal, then convert it to ASCII. Then display these ASCII characters on LCD
main function handles entire operation.
-
It initializes all input output ports
-
Initializes LCD and displays messages
-
Detects and finds key press and performs corresponding tasks
-
It calculates no of pulses required to rotate motor till desire no of rotation are completed.
-
It calculates RPM from RPS and then determines the required delay between pulses applied to motor
-
It displays the number pressed on LCD, also displays both entered parameters and rotates the motor
Click here for C program code |