You are on page 1of 6

~: Wireless Stepper motor controller :~

Abstract:- This is actual wireless application because RF interface is used instead of IR to overcome all the drawbacks of IR interface. Again this is software cum hardware project. The software program in a computer (written in C++) generates a specific code and transmit it over 433.92MHz carrier frequency. This code is demodulated and decoded by receiver and it performs a specific task. So the computer and a small modulator circuit works as transmitter and micro-controller with demodulator on the other hand work as receiver. ICs HT12E and HT12D are used as RF encoder and decoder chips to establish proper protocol between Tx and Rx.

Transmitter:To better understand transmitter section let us divide it in two parts 1) software part 2)hardware part. Hardware part is to much small and easy to understand if you first go through the software part. Software program :- Software is written in C++ language. The CLASS 'panel' handles all the functions which are frequently used in main program. All the functions are divided in four major parts 1) The functions that creates the design of panel 2) The functions that handles mouse interfacing 3) The function that generates specific code for each button pressed 4) The functions that display output results on screen There are three functions in first part. Sr. No. Function name 1 2 3 Button Textanim Text Description It takes four arguments and draws button on screen at different places It takes five arguments and creates animation effect of text when that button is pressed It takes two arguments and change the color of text

Second part includes four functions

Sr. No. Function name 1 Initmouse 2 3 Showmptr Resmptr

getmpos

Description It is a function with no arguments and it initializes mouse driver It is also a function with no arguments and it shows mouse pointer on program screen It's function with four arguments and it restrict the mouse movement within boundary specified by these variables It is a three argument function and it captures the current mouse position from program screen when left mouse button is pressed and return it to main program

In the third part there is only one function called 'output'. This is the main function in whole program. It's a two argument function and it generates different code and a sound when ever it is called. it sends that code to LPT port to transmit it. Last but not the least fourth part includes two functions that displays result of the program on screen. Sr. No. 1 2 Function name Textxy Verbxy Description Three argument function. Displays text at cursor position given by first two arguments Three argument function. Displays variable at cursor position given by first two arguments

The main program access all these functions whenever they are needed through class object 'z'. Main program first initializes the graphics mode and then it initializes all the variables. Then it completes the design of panel and enters into continuous while loop. While loop is executed till any key is not pressed. In a while loop the program waits for left mouse button to be pressed. When it is pressed it will capture the coordinate and start comparing it with the button co-ordinate. If click event is on the button then that particular if loop is executed. There are six if loops because of six buttons. All six button performs same task that when ever they are pressed they send a particular code to LPT port with different sound. These code performs suggested tasks on receiving side. The first two buttons are for rotating motor clockwise and anticlockwise with entered RPM and for entered number of rotations. They just sends the code to receiver to rotate motor clockwise or anticlockwise.

Next two buttons are for incrementing/decrementing the RPM. You can increment the RPM count up to any limit. RPM is incremented every time by 10 if it is above 10 and if it is less then 10 then incremented by 1. Same way when you start decrementing up till 10 it will be decremented by 10 after then decremented by 1. Min limit of RPM is 1. You can not decrement it further. Next two buttons are for incrementing/decrementing the No. of rotations. You can increment the it up to any limit. it is incremented every time by 1 if it is above 1 and if it is less then 1 then it will be doubled. Same way when you start decrementing up till 1 it will be decremented by 1 after then it will be halved every time. Min limit of is 0.25. You can not decrement it further. means you can restrict the motor to rotate only quarter revolution !!!!!! This is the resolution of the controller. This is the end of software part. It has send the code to LPT port. Now the rest will be handled by small hardware. Hardware part:- The function of this part is to generate a standard protocol for RF interface and transmit the code via 433.92 MHz carrier frequency using 433.92 MHz serial data transmitter. Standard HT12E RF encoder IC is used for this purpose. Below figure shows circuit diagram.

Connections:- The data pins (D0-D3) of 25 pin D-Type female connector is directly connected to the data pins of IC HT12E. Data pin D4 is connected with TE

(transmission enable) pin of IC. All the address line (A0-A7) are connected to ground to set address 00000000. 1.1M? resistor is connected between oscillator pins. Dout pin of IC is connected with Din pin of 433.92MHz serial data transmitter. LED1 is connected between Vcc and TE pin to indicate data transmission. Operation:

When you press any button on program screen the code is generated and given to LPT port to D0-D3 data pins. Because they are directly connected to data pins of IC the data is set in IC. At the same time program will pull TE pin low So 8-bit Address and 4-bit data transmitted serially through Dout pin. LED1 will blink to indicate transmission. 433.92 MHz serial data transmitter will modulate the address & data with carrier frequency and transmit it.

Receiver:Receiver circuit includes 433.92 MHz serial data receiver, RF encoder IC HT12D, Micro-controller 89C51 and LCD display. Below figure shows block diagram.

Connections:- The Dout pin of serial data receiver is connected to Din pin of HT12D. All the data pins D0-D3 of HT12D are connected to port pins P3.4-P3.7 of 89C51. 51K? resistor is connected between two oscillator pins on HT12D. The VT (valid transmission) o/p drives LED through transistor 2N2222. The collector o/p is also connected to INT1 (P3.3) pin of 89C51 to generate interrupt when data is received. Port P2 is utilized to drive bipolar stepper motor through NOT gates. P1 port is connected with data pins D0-D7 of LCD. P0 port pins are used for generating control signals for LCD. LCD is used to display three things direction of rotations, current RPM and no. of rotations. When motor is stopped current RPM and no. of rotations are displayed in second line of LCD as shown in figure. Then When ever you press 'clockwise' or 'anticlockwise' button on program screen, in the first line of LCD message is displayed "running clockwise/running anticlockwise". If you press RPM 'increase/decrease' button on program screen RPM will be incremented on both side on program screen and also on LCD. And both displays same value. Same thing happens for number of rotations also. In micro-controller program there is different subroutine for each code received. So when ever it will receive a particular code it will execute that particular subroutine. Suppose it receives code for increasing RPM then it will switch to that subroutine, increase the RPM and displays it. Before we start with operation, to understand it better first go through these links
LCD interfacing using 89C51 Stepper motor controller with LCD display

Operation:

The code transmitted by transmitter will be demodulated by 433.92 MHz serial data receiver and given to HT12D HT12D will first compares address thrice and if it matches it will latch the code to data lines and gives high o/p on VT pin As VT pin goes high LED will blink and at the same time 89C51 will be interrupted. When 89C51 gets interrupted it will jump to interrupt subroutine and receives code on port P3.

Then it will start comparing code and when it find it's match it will execute that subroutine For example you pressed clockwise (or anticlockwise) button so the code "EE" (or "ED") is transmitted Receiver will receive it, compare it and then start rotating motor in clockwise direction. The message is displayed on LCD screen "running clockwise". Motor will rotate with current RPM till desired number of rotations are completed. Then it will stop If you press RPM inc/dec or rotations inc/dec button then it will be inc/dec and this changed RPM or rotations will be displayed on both the sides.
__________________________

You might also like