go_away

Author Topic: urgent servo help  (Read 1716 times)

0 Members and 1 Guest are viewing this topic.

Offline aruna1Topic starter

  • Supreme Robot
  • *****
  • Posts: 381
  • Helpful? 4
  • I'm an Ordinary guy
urgent servo help
« on: April 30, 2010, 12:01:44 PM »
hi
i just received two metal gear servos i ordered two weeks ago from ebay
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=290424210724.

my problem is both servos only rotate in clock wise direction.that is they can move from 1500us--> 2200us but fail to move 2200us-->1500us. so i have to rotate arm manually by hand.

this is the code I'm using (CCS C v4.084 on 12F675)

Code: [Select]
#include "G:\Aruna\My Electronic projects\servo tester\main.h"

void main()
{
   INT16 preset = 0;
   INT16 time = 1500;
   INT16 temp1 = 0;
   INT16 temp2 = 0;
   INT16 i = 0;
   INT16 j = 0;
   setup_adc_ports (sAN2|VSS_VDD);
   setup_adc (ADC_CLOCK_INTERNAL);
   setup_timer_0 (RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1 (T1_DISABLED);
   setup_comparator (NC_NC);
   setup_vref (FALSE);
   //set_adc_channel (2);
   //delay_us (100);
   
   // TODO: USER CODE!!
   
   WHILE (1)
   {
 
     
         output_high (PIN_A4);
         delay_us (2000);
         output_low (PIN_A4);
         delay_us (20000 - 2000) ;

     
   }
}

can someone tell is there anything I'm doing wrong or are these servos faulty coz i need to return them asap if they are faulty
I'm Me

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: urgent servo help
« Reply #1 on: April 30, 2010, 02:56:23 PM »
You won't be able to return them easily. Basically you would send it off to China and hope in a few months they will refund you.

 If you want your  money back, claim that you never received your items - usually they dont ship with tracking so you will win the case. Not entirely ethical but I had to do it once for a product that I received that was a scam.

Offline aruna1Topic starter

  • Supreme Robot
  • *****
  • Posts: 381
  • Helpful? 4
  • I'm an Ordinary guy
Re: urgent servo help
« Reply #2 on: April 30, 2010, 03:03:03 PM »
You won't be able to return them easily. Basically you would send it off to China and hope in a few months they will refund you.

 If you want your  money back, claim that you never received your items - usually they dont ship with tracking so you will win the case. Not entirely ethical but I had to do it once for a product that I received that was a scam.
they didnt provide a tracking number.if i do this will they refund me?
I'm Me

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: urgent servo help
« Reply #3 on: April 30, 2010, 05:34:16 PM »
Well, you should really see if the servo is faulty or not. If it can move one direction in a range, it should move the other way. Is your code the latest version because all you have it doing is sending the 2000us signal and thats it.

Offline aruna1Topic starter

  • Supreme Robot
  • *****
  • Posts: 381
  • Helpful? 4
  • I'm an Ordinary guy
Re: urgent servo help
« Reply #4 on: April 30, 2010, 09:09:32 PM »
this is my latest code,still not working

Code: [Select]
#include "G:\Aruna\My Electronic projects\servo tester\main.h"

void main()
{
   INT16 preset = 0;
   INT16 time = 1500;
   INT16 temp1 = 0;
   INT16 temp2 = 0;
   INT16 i = 0;
   INT16 j = 0;
   setup_adc_ports (sAN2|VSS_VDD);
   setup_adc (ADC_CLOCK_INTERNAL);
   setup_timer_0 (RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1 (T1_DISABLED);
   setup_comparator (NC_NC);
   setup_vref (FALSE);
   //set_adc_channel (2);
   //delay_us (100);
   
   // TODO: USER CODE!!
   
   WHILE (1)
   {
      /* preset = read_adc ();

      WHILE ( ! adc_done ())
      {
      }

     
      temp1 = preset / 1023;
      temp2 = 1800 * temp1;
      time = 600 + temp2;
      temp1 = 0;
      temp2 = 0; */
     
      FOR (i = 0; i < 150; i++)
      {
         output_high (PIN_A4);
         delay_us (2200);
         output_low (PIN_A4);
         delay_us (20000);
      }

      FOR (i = 0; i < 150; i++)
      {
         output_high (PIN_A4);
         delay_us (1500);
         output_low (PIN_A4);
         delay_us (20000) ;
      }

      FOR (i = 0; i < 150; i++)
      {
         output_high (PIN_A4);
         delay_us (900);
         output_low (PIN_A4);
         delay_us (20000) ;
      }

     
     
     
     
     
     
     
     
   }
}
I'm Me

Offline Cristi_Neagu

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 5
Re: urgent servo help
« Reply #5 on: May 01, 2010, 04:54:17 AM »
Hi

The code above won't work.

The period of the pulses is 20000ms. But since you're doing a delay of 2200ms before that, the total period is 22200ms. Not good.
Why aren't you using the internal timer?

Offline aruna1Topic starter

  • Supreme Robot
  • *****
  • Posts: 381
  • Helpful? 4
  • I'm an Ordinary guy
Re: urgent servo help
« Reply #6 on: May 01, 2010, 06:51:50 AM »
Hi

The code above won't work.

The period of the pulses is 20000ms. But since you're doing a delay of 2200ms before that, the total period is 22200ms. Not good.
Why aren't you using the internal timer?
hi
its us not ms
I'm Me

Offline amando96

  • Robot Overlord
  • ****
  • Posts: 187
  • Helpful? 1
Re: urgent servo help
« Reply #7 on: May 01, 2010, 07:25:50 AM »
Rorcle, 60% complete
AATV, 5% complete

Offline Cristi_Neagu

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 5
Re: urgent servo help
« Reply #8 on: May 01, 2010, 07:50:08 AM »
hi
its us not ms

Heh....sorry :D just replace ms with us in everything i said above. I said ms while i was thinking us.

And a servo tester will at least tell you if the servo is defective or your code needs some tweaking.

Good luck.

 


Get Your Ad Here