8051 motor controller

Discussion in 'Programmer's Corner' started by jayanthyk192, Aug 3, 2010.

  1. jayanthyk192

    Thread Starter Member

    Jan 23, 2010
    80
    0
    hi,

    i'm building a brrushless motor controller using 8051.here's the program i wrote.

    #include<reg51.h>
    #define port P0
    int main(void)
    {
    int n=1000,i;
    while(1)
    {
    port=0x90;
    for(i=0;i<=n;i++);
    if(n>200)
    n--;


    port=0x24;
    for(i=0;i<=n;i++);
    if(n>200)
    n--;


    port=0x48;
    for(i=0;i<=n;i++);
    if(n>200)
    n--;

    }
    }


    i don't know if it is efficient.but the program does'nt work completely.the motor starts with low speed,gains speed and then it starts squealing.the motor does'nt move.i can only hear the squealing.please help me debug.

    thank you.
     
    Last edited: Aug 10, 2010
  2. jayanthyk192

    Thread Starter Member

    Jan 23, 2010
    80
    0
    please can anyone help?
     
  3. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    To help we need to know how you have connected your motor to the mcu and the time for each instruction cycle so we could calculate the delay.
     
  4. jayanthyk192

    Thread Starter Member

    Jan 23, 2010
    80
    0
    ok, here's the h-bridge mosfets array i used.i used one port(port0) to switch on the mosfets in the order:

    10010000
    00100100
    01001000

    the order of connection of pins from MC to gates is:

    pin8 of mc:gate1

    pin7 of mc:gate2

    pin6 of mc:gate3 and so on.the motor properly turns in the beginning but stall after it gains speed.i'm giving 12v to the motor.
    i hope the details are clear.
     
  5. jayanthyk192

    Thread Starter Member

    Jan 23, 2010
    80
    0
    and the time delay is 500ms for n=500,but i dont know if it's the same for 2000(i.e 2000ms)
     
  6. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Ok their are different types of brushless DC motors so what you are using I have no idea but as per the diagram I think its a 3 phase type,so to control it you have to make a PWM signal that makes the motor rotates one complete rotation not just half what you did in your program.

    What will be the step for CW rotation?

    1) Turn on the mosfet 1 and 4
    2) delay**
    3) Turn on the mosfet 1 and 6
    4) delay**
    5) Turn on the mosfet 3 and 6
    6) delay**
    7) Turn on the mosfet 3 and 2
    8) delay**
    9) Turn on the mosfet 5 and 2
    10) delay**
    5) Turn on the mosfet 5 and 4

    **Now for the delay stuff ,the delay comes from the position of the rotor of the motor by some type of sensor so that the phase could be known..

    Good Luck
     
  7. jayanthyk192

    Thread Starter Member

    Jan 23, 2010
    80
    0
    it still doe'nt work.here's the modified code:

    #include<reg51.h>
    #define port P3
    int main(void)
    {
    int n=1000,i;
    while(1)
    {
    port=0x90;
    for(i=0;i<=n;i++);
    if(n>50)
    n--;


    port=0x84;
    for(i=0;i<=n;i++);
    if(n>50)
    n--;


    port=0x24;
    for(i=0;i<=n;i++);
    if(n>50)
    n--;
    port=0x60;
    for(i=0;i<=n;i++);
    if(n>50)
    n--;


    port=0x48;
    for(i=0;i<=n;i++);
    if(n>50)
    n--;


    port=0x18;
    for(i=0;i<=n;i++);
    if(n>50)
    n--;

    }
    }

    the same old sqealing takes place.please help again.
    the motor 3-phase.delta.
     
  8. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Look ,I said it before the delay you are giving is a constant one and it doesnt make sence because the phase of the motor depends on the position of the rotor. In case of three phase motor you have to set two phase at a time i.e.. you have to energize two coils out of three at a time,and which two coil should be energize depends upon the position of the rotor and this position is measured by some kind of sensor and as per the sensor signal we change the phase.
    Yes their are sensor less system to control 3 phase brushless dc motor,but its just for name its also kind of sensor which use the back EMF of the coils to know about the position of the rotor and this process is also very complex.

    In your case I am not sure what type of motor it is ,i.e.. does it have sensor in built?
    if not then you have to add those sensor.But before that google a bit about "Controlling Brush Less DC Three Phase Motor"

    Good Luck
     
  9. jayanthyk192

    Thread Starter Member

    Jan 23, 2010
    80
    0
    yes you are right.the problem is with the feedback(that i'm not providing),i learnt more about sensorless back emf feedback system.trying to build it now.thank you for the help.:)
     
Loading...