C36R servo motor

LINIX Brushless, VEXTA Brushless, RC Servo, DC Geared, Linear, Stepper, Tamiya.....

Re: C36R servo motor

Postby picpicpikapika » Sat Feb 12, 2011 5:25 pm

So, the normal battery is not applicable to servo is it?? Thanks.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: C36R servo motor

Postby robosang » Mon Feb 14, 2011 9:38 am

picpicpikapika WROTE:So, the normal battery is not applicable to servo is it?? Thanks.


Depends on the word "normal", because this is kind of general word. I am not sure about other, but I am using Li-po for servo, like hyng said, you will require special regulator for high current pass-through.

If your normal require to 3xA battery, 9V battery..... I would say yes, those batteries are not suitable for driving servo motor, at least not in long hour.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: C36R servo motor

Postby picpicpikapika » Mon Feb 14, 2011 5:13 pm

Hi, I have tested the servo motor using DC power supply, it worked perfectly.
Distinctly, it is the problem of the power shortage.
So, apart from adapter, I need to choose among lithium polymer battery and lead acid battery in order to drive my servo.
Are these battery easy to find??? Are they dangerous?? Sorry, I dun know much about these batteries. Thanks a lot.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: C36R servo motor

Postby picpicpikapika » Tue Feb 15, 2011 5:27 pm

Hi, actually a new enigizer and sanyo 9V battery are able to drive servo as well, but it works fine for only a few dozens of testing...haha by the way I met a new problem associated to my servo, I would like to ask for you guys comment, thanks a lot:

(1) Again, the servo I am using is C36R 180 degree servo with 0.5ms pulse width for minimum angle and 2.35ms pulse width for maximum angle. I have try to repeat these two pulses in my codes ( I put delays after the pulse instruction) and it is able to turn from 0 degree to 180 degree and vice versa (not exactly 0 and 180 degree). But when I modified my codes to make my motor to move a certain degree and stop, and move a certain degree again and stop, and so on, the nearer the servo reaching the two edge angles(0 and 180 degree), the more the servo is stucked. I mean the servo will stuck at around 170 degree and 10 degree. My problem is when I applied long delays after the pulse instruction, the servo is able to turn from 0 to 180 and 180 to 0, but when I applied short delay the servo will stucked when reaching the edge angles. So how if I want to make my servo to move only a small degree? Can I have your comment please, thanks a lot.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: C36R servo motor

Postby hyng » Wed Feb 16, 2011 10:04 am

I'm not so sure about your question. I am assuming that you are writing the code to control the servo motor without any servo controller. Do you refer to the sample code at Servo Motor product page? Any way, you can post your code here so that we can take a look if there is any mistake.
User avatar
hyng
Moderator
 
Posts: 292
Joined: Thu Apr 16, 2009 11:35 am

Re: C36R servo motor

Postby picpicpikapika » Thu Feb 17, 2011 7:55 am

I am using 20MHz crystal oscillator for these codes. These are just some portion of my codes, I have omitted the seven segments part to make it brief. Thanks a lot.
My problem is the servo only works when the delays is long enough, if the delay (for loop delay) is short the servo sometimes works sometimes not works when pressing buttons. My another problem is when the servo is reaching the edge angles (0 and 180 degree), it will stuck. Thanks a lot.
CODE: SELECT_ALL_CODE
#include<pic.h>
__CONFIG ( 0x3F32 );
unsigned char b=0;
unsigned char tssdisplay[3];
unsigned char high=0;
unsigned char total=250;
unsigned char COUNT0=0;
unsigned char COUNT1=0;
unsigned long int i;
void tsselection(void);


void interrupt isr()
{
   if(T0IE==1&&T0IF==1)
   {
      COUNT0++;
      COUNT1++;
      if(COUNT0>=total)
      {
         COUNT0=0;
         COUNT1=0;
         RB1=0;
      }
      if(COUNT1==high)
      {
         RB1=1;
      }
      TMR0 =156;
      T0IF =0;
   }
   
}

void main(void)
{
   TRISA = 0x00;
   TRISB = 0xC0;
   TRISC = 0x00;
   PORTA = 0x00;
   PORTC = 0x00;
   RB0=0;
   RB1=0;
   GIE = 1;
   PEIE = 1;
   T0IE = 1;
   OPTION = 0x01;
   TMR0 = 156;
   high = total-29;                                                       //initialize, make the motor turn all the way down to 0 degree.
   for(i=0;i<100000;i++){
   }
   high = total;
   for(;;)
   {
      if(!RB7)
      {
         while(!RB7){
         }
         for(i=0;i<55000;i++){
         }
         if(b<36)
         {
            b++;                                                 //for displaying seven segments
            high = total-6;             //turning clockwise for a certain degree
            }
            high = total;
         }
         RB0=1;                   //buzzer
         for(i=0;i<10000;i++){
         }
         RB0=0;
      }
      if(!RB6)
      {
         while(!RB6){
         }
         for(i=0;i<55000;i++){
         }
         if(b>0)
         {
            b--;                                               //for displaying seven segments
            high = total-29;                             //turning counter clockwise for a certain degree
            for(i=0;i<5000;i++){
            }
            high = total;
         }
         RB0=1;                                                         //buzzer
         for(i=0;i<10000;i++){
         }
         RB0=0;
      }
      tsselection();                                                               //for displaying seven segments
   }
}
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: C36R servo motor

Postby hyng » Thu Feb 17, 2011 2:55 pm

Please elaborate your program :mrgreen:
User avatar
hyng
Moderator
 
Posts: 292
Joined: Thu Apr 16, 2009 11:35 am

Re: C36R servo motor

Postby picpicpikapika » Thu Feb 17, 2011 9:02 pm

Actually, these are the major parts in the codes:
(a) high = total-6; //supply cw pulse
for(i=0;i<5000;i++){
}
high = total;
(b) high = total-29; //supply ccw pulse
for(i=0;i<5000;i++){
}
high = total;

I am using timer0 interrupt to create pwm signal pulse,(a) part is to make the motor to turn clockwise and then stop, (b) part is to make the motor to turn counterclockwise and then stop. My problem is the motor is working if the delay is long enough, if the FOR delay is too short, it sometime works and sometimes not works (I control these using push buttons). So, if it can't work for short delay, how am I going to control the motor to move only a small distance?
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: C36R servo motor

Postby shahrul » Thu Feb 17, 2011 10:18 pm

Of course, I think servo only can response at some minimum time changes. I use this Timer Interrupt to develop 50Hz PWM.
CODE: SELECT_ALL_CODE
static void interrupt isr(void)
{
if(TMR0IF==1){
   TMR0IF=0;
   counter++;
   if(counter==position) SERVO=0;
   if(counter==390){
      counter=0;
      SERVO=1;}
}
}

Minimum angle at position=10 and maximum angle at position=50.
Then I can control the servo speed with
CODE: SELECT_ALL_CODE
for(position=10;position<=50;position++){
       for(i=0;i<speed;i++) __delay_ms(1);}

You vary the speed value to get different servo speed movement. View example code here.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: C36R servo motor

Postby picpicpikapika » Fri Feb 18, 2011 11:59 am

Sorry, I dun really understand what do you mean, the speed you mentioned is the lenght of the delay or what? So, is my concept correct, now if I want to make my servo to turn clockwise and counter clockwise I just apply the minimum and maximum angle pwm pulse right? And the distance of the movement is depends on the lenght of the delay right?
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

PreviousNext

Return to DC Motor

Who is online

Users browsing this forum: No registered users and 21 guests

cron