Society of Robots - Robot Forum
General Misc => Misc => Topic started by: ukesh on September 18, 2009, 09:27:08 AM
-
hey guys!
im on the verge of completing my bot and suddenly axon keeps resetting when i run an simple code( making 2 servos to run) I checked the voltage at the supply and its around 6.5V. following is my code.
void control(void)
{
while(1)
{
servo(PORTE,2,0);
servo(PORTA,5,1400);
delay_ms(20);
}
}
-
Do the resets happen with the default photovore code?
What does the Axon output during the reset?
Do the resets occur with you un-attach your sensors and servos?
-
Do the resets happen with the default photovore code?I didnt try the photovore code, but i tried another code of just reading the sensor values and it worked.
What does the Axon output during the reset?the servos rotate for a second or so and then axon resets itself.
Do the resets occur with you un-attach your sensors and servos?No, the axon works fine without the servos. what could be the problem? ???
-
How many servos?
Whats the battery type?
-
How many servos?
Whats the battery type?
2 servos...battery type is NimH 2100mAh.I get around 6.5 volts constantly. I tried adding a delay function between the servo commands and both the servos worked for a couple of times and again the problem started! >:( The servos individually work well ie when 1 servo is connected it works but when both the servos are connected the axon resets! ???
-
Do you have anything else other than servos attached? What battery voltage type is it (6V, 7.2V, etc)?
Run your run while checking with the multimeter. What does the voltage drop to when the servos are running?
Are there any other changes to the code that you made?
-
Do you have anything else other than servos attached? What battery voltage type is it (6V, 7.2V, etc)?3 IR sensors. battery voltage is 7.2V
What does the voltage drop to when the servos are running?when a single servo is working the voltage drops to 6V. I cant make the 2 servos work simultaneously!
Are there any other changes to the code that you made?I removed the while(button_pressed()) function from the main program.
Apart from this admin, i initially decided to use motors for my bot. But had problems with the PWM function in the axon. So i switched to servos. you said u will correct the pwm bug in the next source code release. have you corrected it?
-
Do you have anything else other than servos attached? What battery voltage type is it (6V, 7.2V, etc)?3 IR sensors. battery voltage is 7.2V
There are both of your problems.
First, if a 7.2V battery measures 6.5V, that means its a dead battery. You need to recharge it. It still has a good voltage, but it has no juice (current) left.
Second, you need to add capacitors for the Sharp IR:
http://www.societyofrobots.com/axon/axon_FAQ.shtml#sharp_ir_reset (http://www.societyofrobots.com/axon/axon_FAQ.shtml#sharp_ir_reset)
you said u will correct the pwm bug in the next source code release. have you corrected it?
Well, the only bug was that it was missing code to PWM the LED. It'll work fine for motors. The post before had the code for you to add. :P
(the fix is not yet in the most recent posted version)
-
First, if a 7.2V battery measures 6.5V, that means its a dead battery. You need to recharge it. It still has a good voltage, but it has no juice (current) left.okay, Im charging my batteries and get back with the results! hope it solves my problem!
you need to add capacitors for the Sharp IRIm not using sharp IR sensors, im using IR reflectance sensors from pololu electronics. Do i have to add capacitors for those sensors too?
http://www.pololu.com/catalog/product/958 (http://www.pololu.com/catalog/product/958)
Well, the only bug was that it was missing code to PWM the LED. It'll work fine for motors.I will check that too.
-
you need to add capacitors for the Sharp IRIm not using sharp IR sensors, im using IR reflectance sensors from pololu electronics. Do i have to add capacitors for those sensors too?
http://www.pololu.com/catalog/product/958 (http://www.pololu.com/catalog/product/958)
Oh, in that case, nope you won't need capacitors.
-
hey admin, I tried compiling this code for trying pwm function. But i still get the error. I've attached the error message as a pic
void control(void)
{
while(1)
{
rprintf("Initializing timer2 for PWM\r\n");
PWM_Init_timer2_H6(10);
rprintf("Turning on both PWM channels\r\n");
PWM_timer2_On_H6();
delay_ms(1000);
rprintf("Setting PWM to 1%% duty cycle\r\n");
PWM_timer2_Set_H6(1);
delay_ms(1000);
rprintf("Setting PWM to 50%% duty cycle\r\n");
PWM_timer2_Set_H6(127);
delay_ms(1000);
rprintf("Setting PWM to 99%% duty cycle\r\n");
PWM_timer2_Set_H6(254);
delay_ms(1000);
rprintf("Turning off PWM\r\n");
PWM_timer2_Off_H6();
delay_ms(1000);
}
}
-
What code version are you using?
-
version 1.09, August release..
-
hey admin!
I Got another set of batteries, i get around 7.7 Volts while the total volts is 8. So i guess its not yet dead. Both the servos worked fine, but again i ended up with an problem. My sensors, when reads an black line shows values above 100 & when reads a white line it shows below 20( i checked in hyper terminal). I wrote a program according to that. when the sensor reads the value greater than 150, both the servos must go forward or else the bot must take right turn. when i tested it, the axon works fine if the sensors reads a white line. If the sensor reads a black line, axons resets and because of it, the bot gets off the line by a certain distance(due to the jerk) and starts taking right turns(since the track is white) below is my source code
void control(void)
{
a2dInit();
a2dSetPrescaler(ADC_PRESCALE_DIV32);
a2dSetReference(ADC_REFERENCE_AVCC);
while(1)
{
int l=0, r=0, m=0;
l=a2dConvert8bit(10);
r=a2dConvert8bit(2);
m=a2dConvert8bit(6);
rprintf("%d....%d....%d\n", l, m, r);
if(m>150)
{
servo(PORTE,5,1400);
delay_ms(20);
servo(PORTA,6,0);
delay_ms(20);
}
else
{
servo(PORTA,6,700);
delay_ms(20);
servo(PORTE,5,1400);
delay_ms(20);
}
}
}
what could be possible problem in the setup ???
-
hey admin, I tried compiling this code for trying pwm function. But i still get the error. I've attached the error message as a pic
I looked into it, and I think I fixed it. Let me know if it doesn't work.
http://www.societyofrobots.com/axon/downloads/Axon_Source_092009.zip (http://www.societyofrobots.com/axon/downloads/Axon_Source_092009.zip)
v1.10 September 20th, 2009
when timer640.c was rewritten, it broke all PWM code
-added pwm.c to SoR_Utils.h
-added pwm.c and pwm.h
(compiles, and only used working old code, so assumed to work - but not tested)
I Got another set of batteries, i get around 7.7 Volts while the total volts is 8. So i guess its not yet dead.
It could still possibly be dead. I really recommend trying out a fully charged battery first.
Also, try this code instead:
void control(void)
{
a2dInit();
a2dSetPrescaler(ADC_PRESCALE_DIV32);
a2dSetReference(ADC_REFERENCE_AVCC);
while(1)
{
int l=0, r=0, m=0;
l=a2dConvert8bit(10);
r=a2dConvert8bit(2);
m=a2dConvert8bit(6);
rprintf("%d....%d....%d\n", l, m, r);
if(m>150)
{
servo(PORTE,5,1100);
servo(PORTA,6,300);
delay_ms(30);
}
else
{
servo(PORTA,6,700);
servo(PORTE,5,1100);
delay_ms(30);
}
}
}
-
It could still possibly be dead. I really recommend trying out a fully charged battery first.
okay il charge the batteries and get back with you admin!
If i want to run both the servos At full load conditions & three sensors for at least a minimum of 20 mins continuously, what will be the required specifications of the battery ie the current and voltage ratings?
-
It could still possibly be dead. I really recommend trying out a fully charged battery first.
okay il charge the batteries and get back with you admin!
If i want to run both the servos At full load conditions & three sensors for at least a minimum of 20 mins continuously, what will be the required specifications of the battery ie the current and voltage ratings?
http://www.societyofrobots.com/mechanics_energy.shtml (http://www.societyofrobots.com/mechanics_energy.shtml)
http://www.societyofrobots.com/batteries.shtml (http://www.societyofrobots.com/batteries.shtml)
Determine average current draw. Multiply that by 1 hour. Divide by 60min/20min = 3 (for 20 minutes). Thats the number of mAh that your battery will need.
For example, you determined that all of your sensors and servos draw an average 2A (or 2000mA). For one hour, you'll need 2000mAh. So for 20 minutes, thats 2000/3 = 667mAh.
How much current does something draw? Datasheets and multimeter.
-
How much current does something draw? Datasheets and multimeter.
I checked the datasheet for the servos from where i bought, but i couldn't find the current draw specification.
http://robokits.co.in/shop/index.php?main_page=product_info&cPath=2_5&products_id=187 (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=2_5&products_id=187)
And how do i check the current draw using a multimeter? (sorry for the noobishness! :-[)
-
:P
http://www.google.com/search?q=how+to+measure+current+with+a+multimeter (http://www.google.com/search?q=how+to+measure+current+with+a+multimeter)
-
okay admin!
I got 6 1.2V, 2100mah Nimh batteries(fully charged) connected in series and i get an output voltage of 7.8V. is this correct? logically i should get only 7.2V rite?
-
I got 6 1.2V, 2100mah Nimh batteries(fully charged) connected in series and i get an output voltage of 7.8V. is this correct? logically i should get only 7.2V rite?
Fully charged, it should be higher. This sounds about right.
-
admin, I used the fully charged batteries which i mentioned above, But NO improvements what so ever. The axon keeps resetting! Actually, what are the possibilities for resetting? Is there some error in the code that causes this problem? Or is it an hardware issue? The servos run fine until the sensor reads an value and if it reads axon resets! Its like an hopping bot! :P rather than an line following bot >:(
Regarding the pwm, it compiles for only H6 port when i try to change the port, i get the same error! ???
-
admin, I used the fully charged batteries which i mentioned above, But NO improvements what so ever. The axon keeps resetting! Actually, what are the possibilities for resetting? Is there some error in the code that causes this problem? Or is it an hardware issue? The servos run fine until the sensor reads an value and if it reads axon resets! Its like an hopping bot! :P rather than an line following bot >:(
Is the regulator warm? Are the servos warm when you run them?
Try using the Axon code unmodified. Does it work fine? Its possible to cause a reset in software.
Regarding the pwm, it compiles for only H6 port when i try to change the port, i get the same error! ???
code, please ;)
-
Is the regulator warm? Are the servos warm when you run them?
the servos are not warm. But, the regulator seems to be slightly warm.
Try using the Axon code unmodified. Does it work fine?
i will try it soon..
Its possible to cause a reset in software.
so, might there be a problem in my code?
code, please Wink
void control(void)
{
while(1)
{
rprintf("Initializing timer2 for PWM\r\n");
PWM_Init_timer2_H3(10);
rprintf("Turning on both PWM channels\r\n");
PWM_timer2_On_H3();
delay_ms(1000);
rprintf("Setting PWM to 1%% duty cycle\r\n");
PWM_timer2_Set_H3(1);
delay_ms(1000);
rprintf("Setting PWM to 50%% duty cycle\r\n");
PWM_timer2_Set_H3(127);
delay_ms(1000);
rprintf("Setting PWM to 99%% duty cycle\r\n");
PWM_timer2_Set_H3(254);
delay_ms(1000);
rprintf("Turning off PWM\r\n");
PWM_timer2_Off_H3();
delay_ms(1000);
}
}
-
Try using the Axon code unmodified. Does it work fine?
NO, even the axon code is not working fine! the same reset happens!..I've have uploaded hyper terminal pic.
-
so, might there be a problem in my code?
Yea, you're trying to do PWM with the wrong timers. You can only use the functions here:
http://www.societyofrobots.com/axon/axon_function_list.shtml#pwm (http://www.societyofrobots.com/axon/axon_function_list.shtml#pwm)
Basically different pins use different timers for PWM.
NO, even the axon code is not working fine! the same reset happens!..I've have uploaded hyper terminal pic.
Disconnect everything from your Axon, then run the code. Slowly add components, starting with the sensors, until it starts resetting. You should also measure current of each sensor, perhaps one is shorting or something.
Also, make 100% sure you installed *ALL* files from the latest version. One of the old code versions had reset problems.
-
Also, make 100% sure you installed *ALL* files from the latest version. One of the old code versions had reset problems.
I'm 100% sure that im using the latest release of the source code.
Disconnect everything from your Axon, then run the code. Slowly add components, starting with the sensors, until it starts resetting. You should also measure current of each sensor, perhaps one is shorting or something.
I disconnected everything from the axon and i ran the code, axon didnt reset. frst i added 1 servo and it woked fine. If i add the 2nd servo slowly it resets, but if i add the 2nd servo fastly it works. But, when i add the sensor it resets!
-
You forgot to start with the sensors :P
Measure the current to each device, something is draining too much power. Also, measure the current coming out of the battery.
-
You forgot to start with the sensors Tongue
oops!, Sorry
this time i started with the sensors first. I connected the 1st sensor, axon worked fine, next i connected the 2nd sensor, axon worked fine. When i connected the 1st servo it ran for some time and this time axon resetted! The next time 1st servo worked, but when i connected the 2nd servo axon immediately resetted! So, I guess there is something wrong with the servos!
Measure the current to each device, something is draining too much power. Also, measure the current coming out of the battery.
hey admin, I googled myself how to measure the current. But i couldnt understand clearly! :-[ I'm scared whether i will damage the axon or my components while trying to measure the current. :'( Can you please help me out measuring the current with the components i have..just once?
-
Tell me what you are going to try, and we'll verify its safe before you do it.
-
Tell me what you are going to try, and we'll verify its safe before you do it.
First say i want to measure the current from the battery, where do i have to keep the 2 probes from the multimeter?
Nest, say if i want to measure the current drawn by the servo. where do i have to keep the 2 probes from the multimeter?
-
ukesh, I know you want me to give you the answer to everything, but it isn't fair to me.
You need to learn how to read the manual, search google, and generally try hard to figure it out before asking a question.
It'll be faster for you, too, to simply google search now than wait a few hours for me to help.
read this, start to finish, no excuses :P
http://www.sciencebuddies.org/science-fair-projects/project_ideas/Elec_primer-multimeter.shtml (http://www.sciencebuddies.org/science-fair-projects/project_ideas/Elec_primer-multimeter.shtml)
-
Sure admin!As you say! ;)
I'll get back with you as soon as i measure the current! ;D
-
Measure the current to each device, something is draining too much power.
A small doubt, should i check the current drawn by a servo directly on the axon or should i check it on a breadboard?
-
I'd just use wires and gator clips . . . whatever is easiest for you.
-
k admin, I tried to measure & got an value. I dont know whether the method is correct or not. I connected the red probe of the mutimeter to the positive of the battery. Black probe of the multimeter to the positive terminal of the servo & connected the negative of the battery to the negative terminal of the servo. I set the multimeter range to 200mA and got the value as 10.5. Is this correct?
-
You have to tell the servo to do something or it won't use any current :P
So far the connections sound correct.
-
So far the connections sound correct.
thanks!. Okay the default axon code is stored in the axon. When i turned on the axon and pushed the button, the servo started to run, but the multimeter showed the value 1 ???
-
Thats because you have it set for 200mA, and it maxed out :P
-
Thats because you have it set for 200mA, and it maxed out
fine..i set the limit to 10A & the value i get is 0.18 when the servo runs.
-
Ukesh, I'm going to reply less often (like only once a day). That'll encourage you to research/try before asking :P
(yes, use the setting for the proper measurement)
-
Ukesh, I'm going to reply less often (like only once a day). That'll encourage you to research/try before asking :P
(yes, use the setting for the proper measurement)
Sorry admin, pls check my previous post. I modified it. anyways il post again :P
i set the limit to 10A & the value i get is 0.18 when the servo runs.
-
hey admin! Measured the current as you said, But no reply from you. . .?
-
both servos do the same?
-
both servos do the same?
Yes, both the servos show the same values..
-
Can you tell me one more time exactly what battery you are using? A link or part number?
-
Yes, Its Ni mh 1.2V 2100mAh batteries made by sanyo connected in series. it looks like this
http://www.greenbatteries.com/sa23mahaanib.html (http://www.greenbatteries.com/sa23mahaanib.html)
-
Yes, Its Ni mh 1.2V 2100mAh batteries made by sanyo connected in series. it looks like this
http://www.greenbatteries.com/sa23mahaanib.html (http://www.greenbatteries.com/sa23mahaanib.html)
5 of them in series?
I need to know the exact battery name. The problems/symptoms you describe are that of an insufficient power supply. Either your batteries aren't rated to supply enough current, or they are old/damaged, or your charger isn't fully charging them.
I recommend trying different batteries.
-
Hey admin, I dont have my axon now, so i cant test my servos. IL get back when i get back my axon:)