Mechatronics Case Study

Read Complete Research Material

Mechatronics Case study

Digital Control of Motors and Mechatronics Case study

Digital Control of Motors and Mechatronics Case study

Task 1

Introduction

Objective of task 1 of assignment is to use LJ units to connect/configure the systemfor the control of a small D.C. motor in both clockwise and anti clockwise directions but at a fixed speed. Secondly there will be a delay of two seconds during the change in the direction of motor at this fixed speed.

Discussion

The basic coding refers to us as we need to rotate the motor in clockwise and counter clockwise direction. Initially, after getting the positive input, the delay of two seconds will occur. After the two seconds of delay, the motor will begin to move in a clockwise direction. The decided time for motor to rotate clockwise is five seconds. After five seconds, the motor will stop and will take the delay of two seconds. After two seconds of delay it will move in counter clockwise direction for five seconds. Then again, it will take the delay of two seconds, and this process continues till it stops.

We designed the function to give 5 second delays. This delay will be used between these different outputs of Port A. Machine cycle of PIC is 1µsec and some takes 2 to complete so to achieve the delay we save initial value in some variable and will increment it to achieve our desired result of 5 sec and 2 sec. We created a subroutine of delay which generates 1 second delay and thus repeating it 5 times gives us 5 sec delay and two times calling of this routine generates delay of 2 sec. Below is the subroutine of delay.

The above sub routine is used to generate delay with the use of R_0 and R_1 and R_2 variable value. The desired delay value is passed to this subroutine of delay with the help of these variables and thus we got delay of 2 and 5 sec. The value of R_2 is 250, thus DELAY_3 generates 749µsec delay. Moreover we initialized R_1 with 133 to get delay of 1 sec with the use of DELAY_2 and DELAY_3. R_0 is sometime initialized with 2 and sometime with 5 to get the delay of 2 or 5 seconds respectively. We get the delay near to 5 and 2 sec with some error in a microsecond which is ignorable at this stage. Below is the screen shot of program with 4 MHz crystal frequency? In this simulation we can see that there is an error of 84µsec which is neglect able.

Conclusion

The direction of D.C. motor is controlled by interfacing PIC16F84 between point A and B using SPDT relay. The program in the memory of controller shifts the direction of motor according to the above flow graph. The activating and deactivating of relay actually connect the motor windings to either 12V or 0V D.C. So when there is a potential difference of 12V between the point A and B of winding the motor will rotate otherwise it will remain ...