AUTOMATED MANUFACTURING IN REMOTE AREAS USING MICRO-CONTROLLERS
BY
PUNIT ANAND
GRADUATE STUDENT
FACULTY OF BUSINESS ADMINISTRATION
McMASTER UNIVERSITY
HAMILTON, ONTARIO, CANADA
E-MAIL:
AND
ANAND M. SHARAN
PROFESSOR
MECHANICAL ENGINEERING
MEMORIAL UNIVERSITY OF NEWFOUNDLAND,
ST JOHN’SNEWFOUNDLAND, CANADA A1B 3X5
E-MAIL:
ABSTRACT
· To achieve economical production, automation using micro-controllers have been used.
· This is carried out by mounting a frame for weaving a pattern on the end effector of an X-Y robot. The robot operates in conjunction with a sewing machine.
· The energy for driving these dc motor powered machines is obtained using photo-voltaic panels.
· The co-ordinated motions for the robot and sewing machine are obtained by programming a controller in mikrobasic language.
KEYWORDS: Robots in manufacturing, Microcontroller based manufacturing, Robot and machines having co-ordinated motions.
1. INTRODUCTION
In vast areas of the world, economical manufacturing in rural areas has become a necessity as the cities are becoming over-crowded.
This requires introduction of high-tech industries to be located in such areas. Quite often, such places require introduction of low cost machines due to the shortage of capital in these areas.
For an example, stitching / weaving type of industries require very small amount of power but are labour intensive.
To reduce the cost – automation and mechanization is needed even here because hand-made products of matching quality are difficult to be produced economically in large quantities since the probability of error is there in every piece made.
Secondly, if we introduce robots, they can make many more variety of products than earlier generation of machines like existing lathes and milling machines with human operators .
This paper deals with programming a microcontroller to make a pattern using a sewing machine. The microcontroller is used to provide motions to an X-Y or Cartesian robot as well as to a sewing machine as shown in Fig. 1.
FIG. 1 MOTION TO EMBROIDERY FRAME BEING PROVIDED BY X-Y MOTION ROBOT
2. ILLUSTRATION OF DEVICES FOR AUTOMATED MANUFACTURING
Fig 2 shows an arrangement where on a fabric, a geometrical shape has to be weaved (made).
FIG. 2 BATTERY BEING CHARGED BY A SOLAR PANEL
To have co-ordinated motion in the X, Y and Z directions, one uses micro-controller shown in Fig. 3.
FIG. 3 USE OF MICRO-CONTROLLER TO PROVIDE MOTION CONTROL
Here two Pulse Width Modulated (PWM) signals are generated and sent to two respective H-Bridges (Fig. 4) corresponding to X and Y motions. The third motion, that of the needle along the Z direction, is given by motor 3.
FIG. 4 THREE DC MOTORS CONTROLLED BY MICRO-CONTROLLER THROUGH H BRIDGES
These H Bridges are switching devices which open the high current gates using MOSFETs. The signals generated by micro-controllers in Fig. 3 can drive the two dc motors shown in Figs 1, and 2 using these H Bridges.
3. PROGRAMMING A MICRO-CONTROLLER
A computer program written in MikroBasic was used to drive the motors in Fig. 5.
The program was written for making embroidery of circular shape as shown in Fig. 5.
This figure shows a circle whose equation was obtained using a Fourier series.
The Fourier coefficients were obtained using Fast Fourier Transform subroutine in MATLAB software
These coefficients were stored in the memory of the controller.
The pattern to be weaved was carried out in a sequential manner where a vertical line of variable length (1) was stitched followed by a very small horizontal line of fixed length(2) and then, again a vertical line(3) and so on.
Clearly, the end points of the vertical line were computed using Fourier coefficients on line.
The associated computer program was written by referring to [9].
The chip used was Pic 18F45K22 which was mounted on an Easy Pic V7 Development Board. The experimental set up is shown in Fig. 7.
Using these principles, one can introduce automation in rural and remote areas where one can manufacture other parts or products at reduced cost and of far better quality than what is being done presently.
4 CONCLUSIONS
· In this paper, a methodology was presented to introduce automation in rural and remote areas.
· By the introduction of micro-processors, these automated machines can be manufactured in rural areas, as well as such machines can be used to manufacture products.
· By introduction of automation, people will find employment in villages and it will reverse the migration to cities for better life.
5 ACKNOWLEDGEMENTS
· The author is thankful to Dr M. J. Hinchey, for his generous help in building hardware for controller.
· The author is also indebted to Dr. T. Iqbal for valuable assistance in course of this research.
6 REFERENCES
1. Ostwald , P.F., Amstead, B. H., and Begeman, M. L., “Manufacturing Processes” , 7th Edition, John Wiley and Sons, Toronto, Canada , pp 450-466.
2. Sharan, A.M. , and Prateek, M. , 2006, “ Automation of Minimum Torque Based Accurate Solar Tracking Systems Using Microprocessors “ 86, Sept – Oct. , pp . 415 - 437 Journal of Indian Institute of Science
3. Craig, J.,J.,” Introduction to Robotics, and Control”, 3rd Edition, Prentice Hall, New Jersey, USA, pp 62-92.
4. Klafter, R. A., Chmielewski, T.A., and Negin, M, “Robotic Engineering: An Integrated Approach”, 1989 Edition. Prentice Hall, New Jersey, USA, pp 58-70.
5. Guru, B.,S., and Hiziroglu, H.,R., “Electric Machinery and Transformers “,Third Edition, BJS Publishers, New York, USA, pp 201-244 ; 421-428
6. Sewing Machines, http://en.wikipedia.org/wiki/Sewing_machine
7. MOSFET, http://en.wikipedia.org/wiki/MOSFET
8. Fourier Analysis of Time Series, http://people.uncw.edu/hermanr/signals/Notes/Signals.htm
9. Mazidi, M.,A., Mazidi, J., G., and McKinlay, R., D.,” The 8051 Microcontroller and Embedded Systems “, 2nd Edition, Prentice Hallm , New Jersey, USA, pp 153-178.
PROGRAM
'------
' FULL CIRCLE FILLUP
'------
'PIK 18F45K22 on Easy Pic V7 Development Board; mikroBasic Pro for PIC V6.0.0
' External 8 MHZ Oscillator
' Config Parameters
' Oscillator Frequency = 8 MHZ
' Oscillator Selection = HS Oscillator (medium power 4 -16 MHZ)
' 4X PLL Enable = Disabled
' Fail - Safe Clock Monitor Enabled
' Internal / External Oscillator Switchover = Enabled
' Power-up Timer = Enabled
' Brown-Out Reset = "Brown - Out Reset enabled in Hardware only (SBOREN is disabled)
' Brown out Reset Voltage = "VBOR set to 1.90 V nominal"
' Watch Dog Timer = Disabled
' Watchdog Timer Postscale = 1:32768
' CCP2 MUX bit = CCP2 input/output is multiplexed with RC1
' PORTB A/D = Enabled
' P3A/CCP3 Mux bit = P3A/CCP3 input/output is multiplexed with RB5
' HFINTOSC Fast Start-up = Enabled
' Timer3 Clock input mux = T3CK1 is on RC0
' ECCP2 B Output mux = P2B is on RD2
' MCLR PIN = MCLR pin enabled, RE3 input pin disabled
' Stack Full/ UnderFlow Reset = Enabled
' Low Voltage Program = Disabled
' Extended Instruction Set = Disabled
' Background Debug = Disabled
' Code Protection Block 0 = Block 0 not Code Protected
' Code Protection Block 1 = Block 1 not Code Protected
' Code Protection Block 2 = Block 2 not Code Protected
' Code Protection Block 3 = Block 3 not Code Protected
' Boot Block Code Protection = Disabled
' Data EEPROM Code Protection = Disabled
' Write Protection Block 0 = Disabled
' Write Protection Block 1 = Disabled
' Write Protection Block 2 = Disabled
' Write Protection Block 3 = Disabled
' Configuration Register Write Protection = Disabled
' Boot Block Write Protection = Disabled
' Data EEPROM Write Protection = Disabled
' Table Read Protection Block 0 = Disabled
' Table Read Protection Block 1 = Disabled
' Table Read Protection Block 2 = Disabled
' Table Read Protection Block 3 = Disabled
' Boot Block Table Read Protection = Disabled
program MotorControl
' Global Declarations section
' PWM at 80% duty cycle is required to move by 1 resolution in +ve dir &
' PWM at 20% duty cycle is required to move by 1 resolution in -ve dir
' Number of PWM waves required to move the motor by a minimum X,Y Resolution
const motor_res_x as longint = 100
const motor_res_y as longint = 100
' minimum resolution in mm
const res_x_mm as float = 1.0
const res_y_mm as float = 1.0
'PIC18F45K22 running at 8 MHZ
' PWM Timer to be at 500 HZ
' Timer0 is running at (8 Mhz/4) * (1/256), i.e 7812.5 HZ
' Therefore Timer0 multiple is 7812.5 / 500 = 15.625
const frequencymult as float =15.625
'const frequencymult as float =4000
const timerscale as float =1.0
const Constword as word = 0xFFFF
' global variables that always contain position vectors of the frame
dim xpos as float
dim ypos as float
'counter
dim cnt as word
'------Timer Interrupt handling------
'This program uses TMR0L as a counter and when the register overflows it
'interrupts. This interrupt is used to generate PWM
'sub procedure Timer0_Interrupt iv 0x000008 ics ICS_AUTO
'sub procedure interrupt_low
sub procedure interrupt
'IF INTCON.TMR0IF =1 Then
TMR0H=0
TMR0L=0 'TMR set to initial value of 0
'INTCON.=0x20 'Interrupt control register only TMR0 overflow interrupt enabled
'INTCON.GIE=1
'INTCON.PEIE=1
'INTCON.TMR0IE=1
'INTCON.INT0IE=0
'INTCON.RBIE=0
INTCON.TMR0IF=0
'INTCON.INT0IF=0
'INTCON.RBIF=0
cnt = cnt +1 ' Counter incremented
'end if
end sub
sub function AbsoluteValueFloat(dim abspara as float) as float
IF abspara <0
THEN
result = -abspara
else
result = abspara
end if
end sub
'------MoveX_pos------
'This subroutine moves the frame so that the needle is at xnew coordinate
'The exact number of PWM pulses are provided to the X motor to position the
' frame exactly below the needle. Position xnew in mm;
' PWM1 is used for generating pulse. For PIC18F45K22 its RC2 (port c 3rd bit)
' which for 40pin DIP is pin #17
sub Procedure MoveX_pos(dim xnew as float)
'local declaration
dim xmove, xtemp as float
dim pwm_time as word
dim cnt_limit as word
dim cnt_start as word
'dim xtimerhi, xtimerlo as byte
'Delta movement computation
xtemp = xnew - xpos
xmove = xtemp / res_x_mm
' compute the # of PWM required to reach X position
'pwm_time = integer((AbsoluteValueFloat(xmove) * motor_res_x)/timerscale)
pwm_time = integer((AbsoluteValueFloat(xmove) * motor_res_x * frequencymult)/timerscale)
cnt_limit =1
' By default it is set to cnt_limit setup
IF pwm_time > Constword then
cnt_limit = 1+ (pwm_time div Constword)
cnt_start = pwm_time - Constword*(cnt_limit-1)
else
cnt_limit =1
cnt_start = Constword - pwm_time
end if
cnt =0
'Duty cycle set on the choice of direction
IF xmove >0 THEN
PWM1_Set_Duty (204) 'function takes only values in byte, 204 is 80% duty cycle
'INTCON = 0xA0 'Interrupt control register Global interrupt & TMR0 overflow enab
else
PWM1_Set_Duty (51) 'function takes only values in byte, 51 is 20% duty cycle
'INTCON = 0xA0 'Interrupt control register Global interrupt & TMR0 overflow enab
end if
'TMR0L Loaded
'T0CON.7=0
'xtimerhi = Hi(cnt_start)
'xtimerlo = Lo(cnt_start)
'TMR0H = xtimerhi
'TMR0L = xtimerlo
'T0CON.7=0
TMR0H = Hi(cnt_start)
TMR0L = Lo(cnt_start)
T0CON.TMR0ON =1
' loop until timer overflow interrupt
do
loop until cnt = cnt_limit
'delay_ms(500)
PWM1_Set_Duty (127)
'PWM1_Stop()
cnt=0
xpos = xnew ' New xposition
T0CON.TMR0ON =0
end sub
'------MoveX_pos_delta------
' Move the motor by the smallest possible amoount in positive x direction
sub Procedure MoveX_pos_delta
dim posdelta as float
posdelta = xpos + res_x_mm
MoveX_pos(posdelta)
'MoveX_pos(xpos + res_x_mm)
end sub
'------MoveX_neg_delta------
' Move the motor by the smallest possible amoount in positive x direction
sub Procedure MoveX_neg_delta
dim negdelta as float
negdelta = xpos - res_x_mm
MoveX_pos(negdelta)
'MoveX_pos(xpos - res_x_mm)
end sub
'------MoveY_pos------
'This subroutine moves the frame so that the needle is at ynew coordinate
'The exact number of PWM pulses are provided to the Y motor to position the
' frame exactly below the needle. Position ynew in mm;
' PWM2 is used for generating pulse. For PIC18F45K22 its RC1 (port c 2nd bit)
' which for 40pin DIP is pin #16
sub Procedure MoveY_pos(dim ynew as float)
'local declaration
dim ytemp, ymove as float
dim pwm_time_y as word
dim cnt_limit_y as word
dim cnt_start_y as word
' xmove
'Delta movement computation
ytemp = ynew - ypos
'Motor direction control to be determined by xmove
ymove = ytemp / res_y_mm
' compute the # of PWM required to reach X position
'pwm_time = integer((AbsoluteValueFloat(ymove) * motor_res_y)/timerscale)
pwm_time_y = integer((AbsoluteValueFloat(ymove) * motor_res_y * frequencymult)/timerscale)
cnt_limit_y =1
' By default it is set to cnt_limit setup
IF pwm_time_y >Constword then
cnt_limit_y = 1+ (pwm_time_y div Constword)
cnt_start_y = pwm_time_y - Constword*(cnt_limit_y-1)
else
cnt_limit_y =1
cnt_start_y = Constword - pwm_time_y
end if
cnt =0
TMR0H = Hi(cnt_start_y)
TMR0L = Lo(cnt_start_y)
T0CON.TMR0ON =1
'PWM2_Init(488)
'PWM2_Start()
IF ymove >0 THEN
PWM2_Set_Duty (204) 'function takes only values in byte, 204 is 80% duty cycle
'INTCON = 0xA0 'Interrupt control register Global interrupt & TMR0 overflow enab
else
PWM2_Set_Duty (51) 'function takes only values in byte, 51 is 20% duty cycle
'INTCON = 0xA0 'Interrupt control register Global interrupt & TMR0 overflow enab
end if
' TMR0H & TMR0L Loaded
' Loop until timer overflows
do
loop until cnt = cnt_limit_y
'delay_ms(500)
PWM2_Set_Duty (127)
'PWM2_Stop()
cnt=0
ypos = ynew
T0CON.TMR0ON =0
end sub
'------MoveY_pos_delta------
' Move the motor by the smallest possible amount in positive y direction
sub Procedure MoveY_pos_delta
dim posdelta as float
posdelta = ypos + res_y_mm
MoveY_pos(posdelta)
end sub
'------MoveY_neg_delta------
' Move the motor by the smallest possible amount in negative y direction
sub Procedure MoveY_neg_delta
dim negdelta as float
negdelta = ypos - res_y_mm
MoveY_pos(negdelta)
end sub
' 6th bit of Port C RC5, 24th pin of 40 DPI is 1