Results 1 to 6 of 6

Thread: slow-spinning driver firmware

  1. #1
    Registered
    Join Date
    Apr 2009
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    slow-spinning driver firmware

    I have written a simple stepper controller designed for a PIC with equally simple support circuitry; just a bunch of transistor arrays IC's between the microcontroller and the steppers. It does move the motors, but there is a problem--the motors can only move very slowly, capping out at something like 5 revolutions per second. Any more and they stutter and jam. I believe it is due to the firmware, but I don't know how or why. I have tried graduating the speed, ramping up until it jams, but that still occurs at the same speed. The current stepping scheme is 2-coils energized at a time--I've tried reducing that to just one, and it still spins, but just as slowly, so that's not it either. Here's the code. Right now it doesn't respond to parallel port control, it just spins when there's power. You'll notice the code which hopefully will one day allow parallel port control. Any insight into my slow speed is appreciated!! Thanks!



    #include "C:\Program Files\PICC\Projects\stepper controller.h"
    #include <stdio.h>


    unsigned long wait, stateNum;
    unsigned long waitincrementer;
    unsigned int accelRate, minWait, deltaWait;
    void state(int);



    void main()
    {

    setup_adc_ports(NO_ANALOGS|VSS_VDD);
    setup_adc(ADC_OFF);
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
    setup_timer_1(T1_DISABLED);
    setup_comparator(NC_NC);
    setup_vref(FALSE);
    // enable_interrupts(INT_RA);
    // enable_interrupts(GLOBAL);



    while(1){
    // if (input(STEP)){
    if (1){//for testing. ignore step input.
    // if (input(DIR)){
    if (1){//for testing. ignore dir input.
    stateNum = (stateNum+1)%4; //select state
    state(stateNum); //change state
    }
    else{//in testing, this never happens.
    stateNum = (stateNum-1)%4; //same thing in other direction
    state(stateNum);
    }
    // while(input(STEP)); //wait for the pulse to end. ignored in testing.
    }

    delay_us(1800);//wait until proceeding until the next step so as to avoid jamming/stuttering

    }
    }


    void state(int state1){

    switch(state1){
    case 0:
    OUTPUT_LOW(COIL3);
    OUTPUT_LOW(COIL4);
    output_high(COIL1);
    output_high(COIL2);
    break;

    case 1:
    output_low(COIL1);
    OUTPUT_LOW(COIL4);
    output_high(COIL2);
    OUTPUT_high(COIL3);
    break;


    case 2:
    OUTPUT_LOW(COIL1);
    output_low(COIL2);
    output_high(COIL3);
    OUTPUT_high(COIL4);
    break;

    case 3:
    output_low(COIL2);
    OUTPUT_LOW(COIL3);
    output_high(COIL4);
    OUTPUT_high(COIL1);
    break;

    defaultutput_high(COIL1);
    break;
    }

    }


  2. #2
    Registered
    Join Date
    Feb 2007
    Location
    canada
    Posts
    669
    Downloads
    0
    Uploads
    0
    , capping out at something like 5 revolutions per second.
    If you motor runs up to 5 tps, then your code is probably ok, but it could be that you need to code it in assembler to run faster. I write most of my fast pic code in assembler, and just use the c for slower stuff.
    Your use of the delay may be the problem. You should be looping while checking for the rising edge then the falling edge of the step pulse. No delay should be needed.

    300 rpm is not that slow for a stepper, 600 rpm is about as fast as you should expect it to have reliable useable torque.

    The supply voltage has a lot to do with speed. Increase the voltage and your motor should be able to run a lot faster. You may need resistors in series with the windings to give it a constant current source.

    Also whats your motor winding inductance ? Higher current, lower inductance motors perform much better than motors with lower current higher inductance.

    Larry K
    Manufacturer of CNC routers and Viper Servo Drives
    www.LarkenCNC.com and www.Viperservo.com


  3. #3
    Registered
    Join Date
    Apr 2009
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    thanks for the reply

    Just to clarify: the delay is only there for testing, and when it is hooked up to Mach3 the delay will be taken care of by the control software. My understanding is that if the hardware is seizing up, writing more efficient code won't help, as the problem is electro-mechanical limitations of the stuff outside the microcontroller. I don't know what my inductance is, but the motors are about 3.1 ohm/coil, and I'm running them at 5v. If I step that up to, say, 12v, should I add resistors to keep the coil current the same? Or should I have proportionally less current to keep the wattage the same?

    Right now the motors are turning hardware store threaded rod at 22tpi, and at (an optimistic) 5revs/sec it takes 1.76 minutes for the y-stage to traverse its full travel of 2 feet. That's slow. If it turns out that these motors can't go much faster with much torque, I'm thinking of switching to belt drive. Does that make sense?


  4. #4
    Registered
    Join Date
    Feb 2007
    Location
    canada
    Posts
    669
    Downloads
    0
    Uploads
    0
    At 3.1 ohm/coil,its a low-mid performance motor. What is the current rated at, thats the important spec.

    I would suggest running a 24volt powersupply minimum and using a power resistor to set the current at its rated level.

    eg; if your motor is rated at 1.5 amps/winding then 24volts / 1.5amps = 16 ohms (then subtract the resistance of the coil = 13 ohms)
    That resistor will need to be 19.5 watts (13 ohms x 1.5amps)

    You would need 1 resistor for each winding,

    PS: If its a cold winter, it will also help to heat your house.

    Larry K
    Manufacturer of CNC routers and Viper Servo Drives
    www.LarkenCNC.com and www.Viperservo.com


  • #5
    Registered
    Join Date
    Apr 2009
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0
    Hmm...I only have a power source from a gutted computer to work with, which only provides 12v max (unless I connect +12 to -12 instead of ground, but then I only have 800mA to use). Would 12v give me faster rpm? What kind of gains could I expect from 12 or 24v?


  • #6
    Registered
    Join Date
    Feb 2007
    Location
    canada
    Posts
    669
    Downloads
    0
    Uploads
    0
    12 Volt will only give a bit better speed.

    As the motor runs faster, the inductance increases and you need a higher voltage to charge the windings.

    Get a 18-24 volt 3 amp transformer (radioshack) rectifier and filter cap. Ditch the PC power supply.
    Manufacturer of CNC routers and Viper Servo Drives
    www.LarkenCNC.com and www.Viperservo.com


  • Similar Threads

    1. New PICStep firmware available
      By Garfield2 in forum PicStep Controllers
      Replies: 19
      Last Post: 12-07-2010, 12:07 AM
    2. VSD-A firmware upgrade
      By Xerxes in forum Granite Devices
      Replies: 4
      Last Post: 10-27-2008, 04:18 PM
    3. VF2 I/O chip firmware
      By Haim H. in forum Haas Mills
      Replies: 1
      Last Post: 08-30-2007, 09:33 AM
    4. Hi Firmware V1.1 20MHz
      By elogicca in forum PicStep Controllers
      Replies: 0
      Last Post: 10-01-2006, 06:46 PM
    5. need help fet3 driver motor is choppy and slow at low steps per inch
      By mike10 in forum Stepper Motors and Drives
      Replies: 7
      Last Post: 01-02-2005, 03:41 PM

    Tags for this Thread

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.