CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Motor soft limits not behaving
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rovtech



Joined: 24 Sep 2006
Posts: 288

View user's profile Send private message AIM Address

PostPosted: Mon Feb 20, 2017 12:52 pm     Reply with quote

Yes, #28 wires. there is very little voltage drop for the few hundred mA drawn by the motors. The wires would have to be pretty heavy to avoid voltage drop from the battery to the end of the arm (over 4ft) so the surge current has to come from the capacitor.
Each section has its own PCB, capacitor, 5v power supply, and PIC. The arm has Base section, upper arm section, forearm section, wrist section, and the gripper section with gripper, camera, lights, lasers. The power and I2C wires are daisy chained through each section so the total capacitance is the sum of the distributed capacitance. I was using 500uF per board but am ordering 4700uF which will fit the space on the board.
Exceeding the sense input on the L298 was not the problem. The sense voltage is always positive because of the H bridge and was going a bit high. I reduced the sense resistors from 2.2ohms to 0.5ohms which actually made the problem worse because it allowed more surge current.
I changed the software a bit to avoid slamming into reverse. The relevant parts are (in appropriate places and same for the forearm):

Code:
// global variables
    short arm_dir = 1;          // shows motor direction UP
    short arm_run = 0;          // arm is running

// stop if the arm has reached limits
   if (arm_posn>down_limit)          // if lower range limit exceeded
    {
     while (arm_posn>(down_limit-2))     // move off limit
     {
      move_up();
      arm_posn=read_adc();
     }
     stop_arm();                         // stop
     at_arm_limit = 1;                   // set flag in status   
    }

   if (arm_posn<up_limit)          // if upper range limit exceeded
    {
     while (arm_posn<up_limit+2)         // move off limit
     {
      move_down();
      arm_posn=read_adc();
     }
     stop_arm();                         // stop
     at_arm_limit = 1;                   // set flag in status
    }

// function 'move_up' moves the arm up
void move_up (void)
 {
   if (!arm_dir&&arm_run)
   {
    output_low (PIN_C3);            // coast to a stop
    delay_ms(250);
   }
  output_low (PIN_C6);
  output_high (PIN_C4);             // Set direction UP
  output_high (PIN_C3);             // enable L298
  arm_run = 1;
  arm_dir = 1;
  delay_ms(50);
 }

// function 'move_down' moves the arm down
void move_down (void)
 {
   if (arm_dir&&arm_run)
   {
    output_low (PIN_C3);           // coast to a stop
    delay_ms(250);
   }
  output_high (PIN_C6);
  output_low (PIN_C4);              // Set direction DOWN
  output_high (PIN_C3);             // enable L298
  arm_run = 1;
  arm_dir = 0;
  delay_ms(50);
 }

// function 'stop_arm' stops the arm motors
void stop_arm  (void)
 {
  output_low (PIN_C3);             // disable L298
  arm_run = 0;
 }
Ttelmah



Joined: 11 Mar 2010
Posts: 20059

View user's profile Send private message

PostPosted: Mon Feb 20, 2017 1:07 pm     Reply with quote

Be aware of the limitations of capacitors. Get ones with the lowest ESR you can find, and then parallel these with a smaller capacitor with good HF performance (ceramic or polyester typically). Problem is that electrolytic capacitors have poor high frequency performance. You will get better ESR performance from 2*2200uF, in parallel, rather than 1*4700uF. Generally larger capacitors in the same volume have worse ESR figures (just like high capacity batteries, where they sacrifice thickness on the electrodes to get the extra capacity). If you put an HF signal into a large electrolytic capacitor, it behaves like it has several hundred ohms of series resistance, while the same capacitor at a few kHz, may have an ESR only a tiny fraction of an ohm. Look for designs sold as 'extreme performance' (Vishay), Oscon (Sanyo) etc..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group