Thursday, October 28, 2010

2.5 DOF Multipurpose Computer controlled Machine


This is my college Major project which won First prize at PEC-Open House 2010. Me and my pals (Aseem Grover, Eshesh Gupta, Manik Malhotra and Vineet Kumar) worked on this project for 4months, developing the entire Mechanical and Electronics Hardware from scratch and the VB6 code to run the machine.
The concept was to develop a machine run by High Torque Stepper Motors ( which will turn the lead screws, moving the platform forward) controlled by a Microcontroller (ATMega32) which will be interfaced with the computer (running VB6 code) taking values from the user to run the machine accordingly.

1 comment:

  1. // ........The C Code.......Compiled in AVR studio
    // MCU : ATMEGA32
    //
    #define F_CPU 11059200UL
    #define S_FACTOR 50
    #include
    #include

    unsigned short arr1[8] = {0b00001001,0b00000001,0b00000101,0b00000100,0b00000110,0b00000010,0b00001010,0b00001000};

    unsigned short arr2[8] = {0b10010000,0b00010000,0b01010000,0b01000000,0b01100000,0b00100000,0b10100000,0b10000000};

    unsigned short x=0,y=0,xp=0,yp=0; // current and previous co-ordinates

    unsigned short x1=0,x2=0,y1=0,y2=0; // line co-ordinates

    void usart_init(){
    unsigned int baud;
    baud = F_CPU/(9600 * 16UL) -1;
    UBRRL = (unsigned char)baud; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
    UBRRH = (unsigned char)(baud >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
    UCSRB |= (1<=0 ;i --)
    {
    PORTA = arr1[i%8];
    delay();
    }
    }
    else if (m==2)
    {
    for (i = x ;i>=0 ;i --)
    {
    PORTA = arr2[i%8];
    delay();
    }
    }
    }

    void gotoxy() // Goto x,y cordinates and update xp,yp
    {
    if(x>xp){
    forward(1,(x-xp)*S_FACTOR);
    xp=x; // update xp
    }
    else if (xyp){
    forward(2,(y-yp)*S_FACTOR);
    yp=y; // update yp
    }
    else if (y<yp){
    backward(2,(yp-y)*S_FACTOR);
    yp=y;
    }
    }

    void tool_on()
    {
    }
    void tool_off()
    {}
    int main()
    { DDRA = 0xff; //output
    DDRB = 0xff; //output
    unsigned char ch1;
    float m=0;
    usart_init(); // initialize USART
    delay(); // Initial Delay
    while(1)
    {
    ch1 = receive(); // receive signal from computer
    if(ch1 == 'D') // Drill Action
    {
    send('D'); // send ack
    x= receive(); // receive M1 (steps)
    send(x); // Ack
    y = receive(); // receive M2 (steps)
    send(y); // Ack

    gotoxy();
    tool_on(); // Perform Drill operation
    send('C'); // ack completion of task
    }

    else if (ch1=='L') // Line Action
    {
    send('L'); // Ack
    x1=receive(); // Get X1
    send(x1); // Ack
    y1=receive(); // Get Y1
    send(y1);
    x2=receive(); // Get X2
    send(x2);
    y2=receive(); // Get Y2
    send(y2);
    x=x1; // set x as x1
    y=y1;
    gotoxy(); // goto x1,y1 co-ordinate
    tool_on(); // Start tool
    for(x=x1+1;x<=x2;x++)
    { m= (y2-y1)/(x2-x1);
    y = m*(x-x1) + y1;
    gotoxy();
    }
    tool_off();
    send('C');
    }

    else
    {send('E');} // send error

    } // end of while

    } // end of main

    ReplyDelete