Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: aruna1 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 (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)
#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
-
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.
-
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?
-
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.
-
this is my latest code,still not working
#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) ;
}
}
}
-
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
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
-
Build a servo tester:
http://www.aaroncake.net/CIRCUITS/servocon.asp (http://www.aaroncake.net/CIRCUITS/servocon.asp)
-
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.