Society of Robots - Robot Forum

General Misc => Misc => Topic started by: ukesh on September 18, 2009, 09:27:08 AM

Title: URGENT! axon Keeps Resetting
Post 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.

Code: [Select]
void control(void)
{
while(1)
{
servo(PORTE,2,0);
servo(PORTA,5,1400);
delay_ms(20);
}
}
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 18, 2009, 11:47:34 AM
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?
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 18, 2009, 08:00:30 PM
Code: [Select]
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.

Code: [Select]
What does the Axon output during the reset?the servos rotate for a second or so and then axon resets itself.

Code: [Select]
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? ???
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 18, 2009, 08:26:14 PM
How many servos?

Whats the battery type?
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 18, 2009, 09:03:25 PM
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! ???
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 19, 2009, 06:33:26 AM
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?
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 19, 2009, 10:36:00 AM
Code: [Select]
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

Code: [Select]
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!

Code: [Select]
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?

 
 
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 19, 2009, 10:47:53 AM
Code: [Select]
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)

Quote
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)
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 19, 2009, 11:09:47 AM
Code: [Select]
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!

Code: [Select]
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)

Code: [Select]
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 19, 2009, 11:27:00 AM
Code: [Select]
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 19, 2009, 12:13:47 PM
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

Code: [Select]
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);
}
}
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 19, 2009, 12:20:17 PM
What code version are you using?
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 19, 2009, 12:29:43 PM
version 1.09, August release..
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 20, 2009, 04:41:34 AM
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

Code: [Select]
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 ???
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 20, 2009, 07:48:26 AM
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:

Code: [Select]
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);
}
}
}
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 20, 2009, 08:22:07 AM
Quote
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?


Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 20, 2009, 08:28:39 AM
Quote
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 20, 2009, 08:40:14 AM
Quote
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! :-[)
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 20, 2009, 08:42:04 AM
 :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)
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 20, 2009, 09:49:36 AM
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?

Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 20, 2009, 10:36:48 AM
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 20, 2009, 08:17:15 PM
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! ???
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 21, 2009, 06:40:10 AM
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.


Quote
Regarding the pwm, it compiles for only H6 port when i try to change the port, i get the same error! ???
code, please ;)
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 21, 2009, 08:30:59 AM
Quote
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.
Quote
Try using the Axon code unmodified. Does it work fine?
i will try it soon..
Quote
Its possible to cause a reset in software.
so, might there be a problem in my code?
Quote
code, please Wink
Code: [Select]
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);
}
}
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 21, 2009, 09:12:17 AM
Quote
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 21, 2009, 09:16:48 AM
Quote
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.

Quote
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 21, 2009, 09:58:28 AM
Quote
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.

Quote
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!
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 21, 2009, 10:10:22 AM
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 21, 2009, 10:52:47 AM
Quote
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!

Quote
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?
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 21, 2009, 11:19:54 AM
Tell me what you are going to try, and we'll verify its safe before you do it.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 21, 2009, 11:36:07 AM
Quote
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?
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 21, 2009, 11:56:03 AM
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)
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 21, 2009, 12:03:35 PM
Sure admin!As you say! ;)
I'll get back with you as soon as i measure the current! ;D
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 22, 2009, 06:46:24 AM
Quote
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?
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 22, 2009, 06:48:54 AM
I'd just use wires and gator clips . . . whatever is easiest for you.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 22, 2009, 07:42:49 AM
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?
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 22, 2009, 08:14:37 AM
You have to tell the servo to do something or it won't use any current :P

So far the connections sound correct.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 22, 2009, 08:22:39 AM
Quote
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 ???
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 22, 2009, 09:32:03 AM
Thats because you have it set for 200mA, and it maxed out :P
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 22, 2009, 09:42:49 AM
Quote
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 22, 2009, 09:59:10 AM
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)
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 22, 2009, 10:04:20 AM
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 24, 2009, 08:35:21 AM
hey admin! Measured the current as you said, But no reply from you. . .?
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 24, 2009, 11:46:33 AM
both servos do the same?
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 25, 2009, 10:37:46 AM
Quote
both servos do the same?
Yes, both the servos show the same values..
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 25, 2009, 11:20:02 AM
Can you tell me one more time exactly what battery you are using? A link or part number?
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on September 27, 2009, 11:10:00 PM
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)
Title: Re: URGENT! axon Keeps Resetting
Post by: Admin on September 28, 2009, 07:11:40 AM
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.
Title: Re: URGENT! axon Keeps Resetting
Post by: ukesh on October 03, 2009, 11:02:45 AM
Hey admin, I dont have my axon now, so i cant test my servos. IL get back when i get back my axon:)