Author Topic: WebbotLib for 22+ Servos  (Read 12847 times)

0 Members and 1 Guest are viewing this topic.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #30 on: January 31, 2010, 03:32:02 PM »
After days of banging my head with the programming....I cannot get it working perfectly...

I just hope i can describe the problem....

I am running 26 servos using 12 banks (i.e. all 12 16bit Timers+Compares)...

I distributed the servos corresponding to specific Timers, (after a lot of trials) because (I don't know why) some servos hate some timers? ...they do not take pulses every after 20ms (maybe above 30ms)

However, I could eventually end up producing a combination of all the servos, so that they all hold tight, here's the code:

Code: [Select]
#include "sys/axon.h" // I am using an Axon
#include "uart.h"
#include "rprintf.h"
#include "servos.h"
#include "a2d.h"

SERVO S1 = MAKE_SERVO(FALSE, C7,1500, 500);
SERVO S2 = MAKE_SERVO(FALSE, A6,1500, 500);
SERVO S3 = MAKE_SERVO(FALSE, E7,1500, 500);
SERVO S4 = MAKE_SERVO(FALSE, H2,1500, 500);
SERVO S5 = MAKE_SERVO(FALSE, C1,1500, 500);
SERVO S6 = MAKE_SERVO(FALSE, A5,1500, 500);
SERVO S7 = MAKE_SERVO(FALSE, E2,1500, 500);
SERVO S8 = MAKE_SERVO(FALSE, H6,1500, 500);
SERVO S9 = MAKE_SERVO(FALSE, C0,1500, 500);
SERVO S10 =MAKE_SERVO(FALSE, A4,1500, 500);
SERVO S11 =MAKE_SERVO(FALSE, E3,1500, 500);
SERVO S12 =MAKE_SERVO(FALSE, H5,1500, 500);
SERVO S13 =MAKE_SERVO(FALSE, C3,1500, 700);
SERVO S14 =MAKE_SERVO(TRUE, A2,1500, 700);
SERVO S15 =MAKE_SERVO(FALSE, A3,1500, 700);
SERVO S16 =MAKE_SERVO(TRUE, H4,1500, 700);
SERVO S17 =MAKE_SERVO(FALSE, C4,1500, 500);
SERVO S18 =MAKE_SERVO(FALSE, A1,1500, 500);
SERVO S19 =MAKE_SERVO(FALSE, E5,1500, 500);
SERVO S20 =MAKE_SERVO(FALSE, A0,1500, 500);
SERVO S21 =MAKE_SERVO(FALSE, E4,1500, 500);
SERVO S22 =MAKE_SERVO(FALSE, A7,1500, 500);
SERVO W1 =MAKE_SERVO(FALSE, C2,1480, 500);
SERVO W2 =MAKE_SERVO(FALSE, C6,1480, 500);
SERVO W3 =MAKE_SERVO(FALSE, E6,1480, 500);
SERVO W4 =MAKE_SERVO(FALSE, C5,1480, 500);

SERVO_LIST servo1[] = {&S1};
SERVO_LIST servo2[] = {&S17};
SERVO_LIST servo3[] = {&S18};
SERVO_LIST servo4[] = {&S2};
SERVO_LIST servo5[] = {&S3};
SERVO_LIST servo6[] = {&S4};
SERVO_LIST servo7[] = {&S5,&S6,&S14,&S21};
SERVO_LIST servo8[] = {&S7,&S8,&S15,&S22};
SERVO_LIST servo9[] = {&S19};
SERVO_LIST servo10[] = {&S20};
SERVO_LIST servo11[] = {&W1,&W2,&W3,&W4,&S9,&S10,&S11,&S12};
SERVO_LIST servo12[] = {&S13,&S16};

SERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(servo1);
SERVO_DRIVER bank2 = MAKE_SERVO_DRIVER(servo2);
SERVO_DRIVER bank3 = MAKE_SERVO_DRIVER(servo3);
SERVO_DRIVER bank4 = MAKE_SERVO_DRIVER(servo4);
SERVO_DRIVER bank5 = MAKE_SERVO_DRIVER(servo5);
SERVO_DRIVER bank6 = MAKE_SERVO_DRIVER(servo6);
SERVO_DRIVER bank7 = MAKE_SERVO_DRIVER(servo7);
SERVO_DRIVER bank8 = MAKE_SERVO_DRIVER(servo8);
SERVO_DRIVER bank9 = MAKE_SERVO_DRIVER(servo9);
SERVO_DRIVER bank10 = MAKE_SERVO_DRIVER(servo10);
SERVO_DRIVER bank11 = MAKE_SERVO_DRIVER(servo11);
SERVO_DRIVER bank12 = MAKE_SERVO_DRIVER(servo12);
//#define threshold 8

void appInitHardware(void){
// Set UART0 to 19200 baud
uartInit(UART0, 115200);
//uartInit(UART0, 19200);
// Tell rprintf to output to UART0
rprintfInit(&uart0SendByte);

// Initialise the servo controller
servosInit(&bank1, TIMER3_COMPAREB);
servosInit(&bank2, TIMER1_COMPAREA);
servosInit(&bank3, TIMER1_COMPAREB);
servosInit(&bank4, TIMER1_COMPAREC);
servosInit(&bank5, TIMER5_COMPAREB);
servosInit(&bank6, TIMER3_COMPAREC);
servosInit(&bank7, TIMER5_COMPAREA);
servosInit(&bank8, TIMER3_COMPAREA);
servosInit(&bank9, TIMER4_COMPAREA);
servosInit(&bank10, TIMER4_COMPAREB);
servosInit(&bank11, TIMER4_COMPAREC);
servosInit(&bank12, TIMER5_COMPAREC);

// Give each servo a start value of 'stop'
}
// The loopStart parameter has the current clock value in ìS
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0; // dont pause after
}

// This routine is called repeatedly - its your main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){

act_setSpeed(&S1,0);
act_setSpeed(&S2,0);
act_setSpeed(&S3,0);
act_setSpeed(&S4,0);
act_setSpeed(&S5,0);
act_setSpeed(&S6,0);
act_setSpeed(&S7,0);
act_setSpeed(&S8,0);
act_setSpeed(&S9,0);
act_setSpeed(&S10,0);
act_setSpeed(&S11,0);
act_setSpeed(&S12,0);
 
act_setSpeed(&S13,DRIVE_SPEED_MIN);
act_setSpeed(&S14,DRIVE_SPEED_MIN);
act_setSpeed(&S15,DRIVE_SPEED_MIN);
act_setSpeed(&S16,DRIVE_SPEED_MIN);

act_setSpeed(&W1,0);
act_setSpeed(&W2,0);
act_setSpeed(&W3,0);
act_setSpeed(&W4,0);
act_setSpeed(&S21,0);
act_setSpeed(&S22,0);

act_setSpeed(&S17,0);
act_setSpeed(&S18,0);
act_setSpeed(&S19,0);
act_setSpeed(&S20,0);

return 0;
}

I have already built my 4-legged robot (assembled using Servo brackets, etc). So once I switch ON, all the servos hold (their given) positions tightly, but when I apply a small force on one bracket (tend to change its position*), it "does" withstand that small force, BUT, not for very long... it would lose its grip suddenly any time, and the whole Loop will "restart", i.e. ALL the servos will lose power, and go back to their initial positions, and try to attain their initial positions again.

*not forcing it to change the position, it's like a small continuous torque that the servo "can" withstand.

So, technically speaking,

Problem #1: Servos do not continuously hold themselves at XmS for very long, they have a few ms break randomly after some seconds !? (where X is probably between 20ms to 25ms - assuming it from my experience of torturing servos, lol)

Problem #2: If one servo fails to get back in its position once disturbed, ALL the servos lose power, and the TICK_COUNT appControl loop restarts !

Problem #3: I have a few weeks remaining to get it working, I never expected it to be so hard to program only 26 servos (giving each of them pulses at exactly 20ms) while Axon Microcontroller can control upto 29 servos  ???

Need Help  :(

Thanks

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #31 on: January 31, 2010, 04:06:31 PM »
Ok there are a couple of things going on here:-

Quote
Problem #2:  If one servo fails to get back in its position once disturbed, ALL the servos lose power, and the TICK_COUNT appControl loop restarts !

I think you have a major batter/supply problem. Servo location, forces etc have nothing to do with the code. You are stressing the servos, the current requirement goes up and I'll bet that you are using the same batteries to power the Axon itself. With the increased current used by the servos the battery voltage drops, the regulator fails, and the whole Axon reboots. ie nothing to do with software.

Quote
Problem #3: I have a few weeks remaining to get it working, I never expected it to be so hard to program only 26 servos (giving each of them pulses at exactly 20ms) while Axon Microcontroller can control upto 29 servos  Huh
So you have successfully done it in some way before on an Axon - right? If so then your deadline isn't a problem. Or have you just 'read it somewhere'.

Problem #1: Well 22 servos running at say 1ms pulse per servo = 22ms out of every 20ms. So its VERY busy even under interrupts. I am gonna create an alternative servo driver to see if it helps but its going to take me some time - these things aren't quick/easy. I don't feel bad about that - trying to run 22 servos whilst also reading other things like, say, compass, gps, uarts etc, etc - let alone running your main program is asking a lot from a single 16MHz cpu.
In the meantime - if you're short on time then I would suggest adding a slave board - a servo controller. Very easy to make,buy,build since they don't have anything else to worry about.

« Last Edit: January 31, 2010, 06:02:36 PM by Webbot »
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #32 on: February 01, 2010, 08:01:49 AM »
I would suggest adding a slave board - a servo controller. Very easy to make,buy,build since they don't have anything else to worry about.

I (and others) have suggested this in at least two other of his threads about this problem.

paulstreats

  • Guest
Re: WebbotLib for 22+ Servos
« Reply #33 on: February 01, 2010, 03:41:44 PM »
Both Admin and myself have mentioned the power issue in this topic (You cant expect to get any consistent results from your code unless you fulfill the power requirements of your setup.)

Quote
So you have successfully done it in some way before on an Axon - right? If so then your deadline isn't a problem. Or have you just 'read it somewhere'.

 He did read this. Its in the Specification list of the Axon (presumably as a selling point).

http://www.societyofrobots.com/axon/

now is the time to prove it is possible :)

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #34 on: February 01, 2010, 04:52:25 PM »
now is the time to prove it is possible :)

A little googling can prove it. :-p

Of course it's possible. You just can't do that much else at the same time. There is RoboRealm that controls 29 servos fine using an Axon.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #35 on: February 01, 2010, 07:41:24 PM »
Agree with everything madsci1016 has said,

I'm also perfectly happy to recognise there may be room for improvement in WebbotLib - but it IS driving 22+ servos - its only 'torque' that has been the issue. Again this could be related to the fundamental power supply issue:- if the battery draw is high, and voltage is dropping, then the servos may not be getting enough 'oomph' for the expected torque.

So whatever the solution is - it will require a suitable power supply. Without that solved we are all 'guessing'.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #36 on: February 01, 2010, 08:01:55 PM »
I think the best approach for that many servos on a multi-limb robot is to have a dedicated servo controller, a cheap one or a nice one that lets you program gaits. That way you have a master controller that can make all the decisions and process input without being brought down by the daunting task of generating that many PWM channels.

Sure, since you only need to send PWM between 0 and 2ms of a 20ms cycle, you could program it to pause everything for the first 2 ms and only handle the PWM generation, but then you uC is ignoring everything else, like bytes being sent over Uart. (I think) this is why the RoboRealm code has a 'sync' byte in it's serial coms to the computer, so the computer only sends new data when the Axon is ready to accept it, or else it will come in when it is busy generating PWM and be ignored.

I think many people gain a better appreciation for uC and programming them after they take a university course on micro-processors and the assembly language. When you have a AVR with 50 something I/O and 4 uarts BUT can only ever handle one thing at a time, timing becomes a very important thing. Webbot is very good at what he does for being able to build a library that runs as smoothly as Webbotlib does.
« Last Edit: February 01, 2010, 08:04:16 PM by madsci1016 »

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
DETAILS OF THE PROBLEM !
« Reply #37 on: February 21, 2010, 04:04:06 AM »
Problem (same as before): The servos cannot take any load !..


I think you have a major batter/supply problem. Servo location, forces etc have nothing to do with the code. You are stressing the servos, the current requirement goes up and I'll bet that you are using the same batteries to power the Axon itself.

After trying with a 6V battery of 3200mAh, still did not solve the problem...

so I tried with a powerful DC Power Supply Unit (that can go upto 10A).

If I have all the 25 servos in the banks (12 banks, using all 16-bit Timers), then the microcontroller doesn't get enough power to even get the servos to their initial positions, they fluctuate (as in trying to get into position, but loses power - its like a reset every second)....and that is when I have kept Current to (max) 5A.. and it shows 0.3A something on the Unit's display. <-- Note: this is when the servos are not able to get in the initial positions - because it requires a small load, since its a 4-legged robot

(with the battery, they'd get into the intial positions once switched ON, "only" when the battery is fully charged !)

Anyway, I tried with different number of servos.... starting with 1 servo !

Any 1 Servo works fine !...holds firm enough and if I drag its position forcefully, it can take the load (maybe 1.5A+)

similar case with around 4 servos, when I drag all 4 servos (to check the load), it goes upto 2A.

BUT, when I try with up to 11 servos, they can take a load up to (around) 2.6A, and then loses power (and resets).
[although should have been more, when I have the max Current set to 5A+]

And beyond 11 servos, it can not even get into the initial positions, (unless I help the servos, if so then they hold "almost" firm) and can take load up to (around) 1.8A, and dies again.

Now since it works (almost) fine for less than 11 servos, I have already tried with replacing those 11 with other 11 servos (to see if some servos are causing problem, but not), it still works with 11 servos.

Hence, it doesn't work when I use "many" servos simultaneously. (they don't even get pulses exactly after 20ms, I'm sure about that)


Again this could be related to the fundamental power supply issue:- if the battery draw is high, and voltage is dropping, then the servos may not be getting enough 'oomph' for the expected torque.

So whatever the solution is - it will require a suitable power supply. Without that solved we are all 'guessing'.


I have set the voltage to 6V, and also tried measuring from one of the empty ports, it shows a little fluctuations but average ~ 6V (5.9V to 6.2V)

Here's the code:

Code: [Select]
// Place any #define statements here before you include ANY other files
// You must ALWAYS specify the board you are using
// These are all in the 'sys' folder e.g.
#include "sys/axon.h"
#include "uart.h"
#include "rprintf.h"
#include "servos.h"
#include "a2d.h"
#include "Sensors/Distance/Sharp/GP2D12.h"
#define P 100//107
#define N 120//113
#define time(x) if(clockGetus()>((x*1000000)-1000) && clockGetus()<((x*1000000)+1000))
//Sharp_GP2D12 sensor = MAKE_Sharp_GP2D12(F7);

//+107 | 113-
int ss1=-14;
int ss2=0;
int ss3=8;
int ss4=0;
int ss5 = 3;
int ss6 = 5;
int ss7 = 10;
int ss8 = 8;
int ss9 = -7;// -120;
int ss10 = 7;// +120;
int ss11 = 0;// -127;
int ss12 = -7;// +131;
int ss13 = -18;
int ss14 = -29;
int ss15 = -10;
int ss16 = -27;
int ss17 = -22;
int ss18 = -14;
int ss19 = -14;
int ss20 = -8;
int ss22 = -60;
int ww1 = 13;
int ww2 = 13;
int ww3 = 7;
int ww4 = 13;

SERVO S1 = MAKE_SERVO(FALSE, C7,1500, 880);
SERVO S2 = MAKE_SERVO(FALSE, A6,1500, 880);
SERVO S3 = MAKE_SERVO(TRUE, E7,1500, 880);
SERVO S4 = MAKE_SERVO(FALSE, H2,1500, 880);
SERVO S5 = MAKE_SERVO(FALSE, C1,1500, 880);
SERVO S6 = MAKE_SERVO(FALSE, A5,1500, 880);
SERVO S7 = MAKE_SERVO(FALSE, E2,1500, 920);
SERVO S8 = MAKE_SERVO(FALSE, H6,1500, 900);
SERVO S9 = MAKE_SERVO(FALSE, C0,1500, 960);
SERVO S10 =MAKE_SERVO(FALSE, A4,1500, 930);
SERVO S11 =MAKE_SERVO(FALSE, E3,1500, 880);
SERVO S12 =MAKE_SERVO(FALSE, H5,1500, 880);
SERVO S13 =MAKE_SERVO(FALSE, C3,1500, 880);
SERVO S14 =MAKE_SERVO(TRUE, J6,1500, 880);
SERVO S15 =MAKE_SERVO(FALSE, E6,1500, 880);
SERVO S16 =MAKE_SERVO(TRUE, H4,1500, 880);
SERVO S17 =MAKE_SERVO(FALSE, C4,1500, 1000);
SERVO S18 =MAKE_SERVO(FALSE, A1,1500, 1000);
SERVO S19 =MAKE_SERVO(FALSE, E5,1500, 1000);
SERVO S20 =MAKE_SERVO(FALSE, A0,1500, 1000);
//SERVO S21 =MAKE_SERVO(FALSE, E4,1500, 880);
SERVO S22 =MAKE_SERVO(FALSE, A7,1500, 880);
SERVO W1 =MAKE_SERVO(FALSE, C2,1480, 500);
SERVO W2 =MAKE_SERVO(FALSE, C6,1480, 500);
SERVO W3 =MAKE_SERVO(FALSE, H3,1480, 500);
SERVO W4 =MAKE_SERVO(FALSE, C5,1480, 500);

SERVO_LIST servo1[] = {&S1};
SERVO_LIST servo2[] = {&S14,&S17};
SERVO_LIST servo3[] = {&S18};
SERVO_LIST servo4[] = {&S2};
SERVO_LIST servo5[] = {&S3};
SERVO_LIST servo6[] = {&S4};
SERVO_LIST servo7[] = {&S5,&S6,&S22};
SERVO_LIST servo8[] = {&S7,&S8};
SERVO_LIST servo9[] = {&S15};
SERVO_LIST servo10[] = {&W1,&W2,&W3,&W4,&S19};//
SERVO_LIST servo11[] = {&S9,&S10,&S11,&S12,&S20};//
SERVO_LIST servo12[] = {&S13,&S16};

SERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(servo1);
SERVO_DRIVER bank2 = MAKE_SERVO_DRIVER(servo2);
SERVO_DRIVER bank3 = MAKE_SERVO_DRIVER(servo3);
SERVO_DRIVER bank4 = MAKE_SERVO_DRIVER(servo4);
SERVO_DRIVER bank5 = MAKE_SERVO_DRIVER(servo5);
SERVO_DRIVER bank6 = MAKE_SERVO_DRIVER(servo6);
SERVO_DRIVER bank7 = MAKE_SERVO_DRIVER(servo7);
SERVO_DRIVER bank8 = MAKE_SERVO_DRIVER(servo8);
SERVO_DRIVER bank9 = MAKE_SERVO_DRIVER(servo9);
SERVO_DRIVER bank10 = MAKE_SERVO_DRIVER(servo10);
SERVO_DRIVER bank11 = MAKE_SERVO_DRIVER(servo11);
SERVO_DRIVER bank12 = MAKE_SERVO_DRIVER(servo12);

#define threshold 64

void appInitHardware(void){
uartInit(UART1, 115200);
rprintfInit(&uart1SendByte);
//distanceInit(sensor);
// Initialise the servo controller
servosInit(&bank1, TIMER3_COMPAREB);
servosInit(&bank4, TIMER1_COMPAREC);
servosInit(&bank5, TIMER5_COMPAREB);
servosInit(&bank2, TIMER1_COMPAREA);
servosInit(&bank3, TIMER1_COMPAREB);
servosInit(&bank6, TIMER3_COMPAREC);
servosInit(&bank7, TIMER5_COMPAREA);
servosInit(&bank8, TIMER3_COMPAREA);
servosInit(&bank9, TIMER4_COMPAREA);
servosInit(&bank10, TIMER4_COMPAREB);
servosInit(&bank11, TIMER4_COMPAREC);
servosInit(&bank12, TIMER5_COMPAREC);

// Give each servo a start value of 'stop'

/* If i disconnect some banks to leave around 11 servos connected, they can take load
servosDisconnect(&bank1);
servosDisconnect(&bank2);
servosDisconnect(&bank3);
servosDisconnect(&bank4);
servosDisconnect(&bank5);
servosDisconnect(&bank6);
servosDisconnect(&bank7);
servosDisconnect(&bank8);
servosDisconnect(&bank9);
servosDisconnect(&bank10);
servosDisconnect(&bank11);
servosDisconnect(&bank12);
*/
}
// The loopStart parameter has the current clock value in uS
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0;
}

// This routine is called repeatedly - its your main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
//distanceRead(sensor);
//clockGetus();

act_setSpeed(&S1,ss1);
act_setSpeed(&S2,ss2);
act_setSpeed(&S3,ss3);
act_setSpeed(&S4,ss4);
act_setSpeed(&S5,ss5);
act_setSpeed(&S6,ss6);
act_setSpeed(&S7,ss7);
act_setSpeed(&S8,ss8);
act_setSpeed(&S9,ss9);
act_setSpeed(&S10,ss10);
act_setSpeed(&S11,ss11);
act_setSpeed(&S12,ss12); 

act_setSpeed(&S13,ss13);
act_setSpeed(&S14,ss14);
act_setSpeed(&S15,ss15);
act_setSpeed(&S16,ss16);

act_setSpeed(&W1,ww1);
act_setSpeed(&W2,ww2);
act_setSpeed(&W3,ww3);
act_setSpeed(&W4,ww4);

act_setSpeed(&S17,ss17);
act_setSpeed(&S18,ss18);
act_setSpeed(&S19,ss19);
act_setSpeed(&S20,ss20);

act_setSpeed(&S22,ss22);
//act_setSpeed(&S21,ss21);

//rprintf("%u \r\n",sensor.distance.cm);

return 0;
}


Summary:

1) Servos can't take enough load even when supplied sufficient power and current !
2) Servos do not hold tight enough when I increase the number of servos

Have been struggling, since 2 months, to program 25 servos simultaneously (while holding tight)....need Help !

Thanks  :(

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #38 on: February 21, 2010, 05:04:44 AM »
When you say
Quote
Any 1 Servo works fine !...holds firm enough and if I drag its position forcefully, it can take the load (maybe 1.5A+)

Are you :

1. Leaving the code the same, ie all 25 servos, but only physically connecting one servo (in which case it would be a hardware/supply issue) coz the code doesn't care if the servos are actually there or not; or

2. Are you changing the code so that it is only using one servo (in which case its a timing issue) - in which case:- see previous reponses from lots of people about having dedicated servo controllers.

 
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: WebbotLib for 22+ Servos
« Reply #39 on: February 21, 2010, 05:21:10 AM »
Depending on the servo you are using, it can use an average 0.5A and up to 1A peak.

22+ servos means 22A+ peak.

A single battery, assuming you are using NiMH, is likely to not handle more than about 10A.

Do the math, and you'll see that 2 or 3 batteries need to be put in parallel to power your system.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #40 on: February 21, 2010, 06:51:17 AM »
@Webbot ... Im doing it through programming... using servosDisconnect(bank) code, leaving only 1 servo...

@Admin ... hmm but, that won't affect the microcontroller right?... because, its datasheet says, it can handle up to 5A only?... but yea.. i'll try to add another battery in parallel then.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: WebbotLib for 22+ Servos
« Reply #41 on: February 21, 2010, 06:58:48 AM »
@Admin ... hmm but, that won't affect the microcontroller right?... because, its datasheet says, it can handle up to 5A only?... but yea.. i'll try to add another battery in parallel then.
A '6V battery' is a misnomer. Despite the name, its almost never 6V. When fully charged, it could be 7V. When fully drained, it can be 5V.

And when you suck huge amounts of current from a battery all at once, the voltage will temporarily drop. So lets say you suck 10A out of a battery with a voltage measured at 6V. That voltage could temporarily drop to 4V - but the Axon requires at least 5.3V to operate - causing a reset. A high quality battery can hold the voltage steady better than cheap batteries, and different battery types act differently.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #42 on: February 21, 2010, 08:11:00 AM »
no no no nooo....

with Fully charged (6V - ~3200mAh) battery,that voltmeter measures as 7.24V, it actually works for some time without reseting (until I apply some torque on servos - OR - it's drained enough)...

HOWEVER, as i said, I have been using a DC Power Supply lately, keeping 6.1V constant, and varying the current (that can go upto 10A) but I was surprised that it turned out to be worse than the battery !? ...I have no idea why !

Offline KurtEck

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: WebbotLib for 22+ Servos
« Reply #43 on: February 21, 2010, 09:13:49 AM »
Hi,
So far with my Brat with the Axon2, I have had no power issues with the 7 servos using 1 1600mah lynxmotion NIMH battery.

Also I do run my Lynxmotion CHR-3 hex robot that has 18 HS-645MG servos on one 2800mah 6v battery.  The servos are all plugged into an SSC-32, which is controlled by Basic Atom Pro BAP28 plugged into a Lynxmotion Bot Board 2.  However the reason this works is on both of these boards, there are two power inputs (VS and VL).  The 2800mah battery is only connected to VS.  When the servo are working it can and does pull the voltage below 5.x volts which would reset the processor(s).  So I have a second battery, which currently is another 1600mah NIMH.  On others I have used simply a 9v battery to run VL.  I know on the Axon2 you can unsolder some bridge to allow 2 batteries, but I have not looked yet to see if this separates the power going to the processor from the servo power.  If so I would strongly suggest that you take this route.

Edit: Side note: actually the SSC-32 has possible 3 battery inputs: VL/VS1/VS2.  This allows you to have a seperate battery for each of the 16 servo connections.  I have not used this capablity yet, but I believe others have...

Good Luck
Kurt
« Last Edit: February 21, 2010, 10:10:30 AM by KurtEck »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #44 on: February 21, 2010, 10:59:35 AM »
no no no nooo....

with Fully charged (6V - ~3200mAh) battery,that voltmeter measures as 7.24V, it actually works for some time without reseting (until I apply some torque on servos - OR - it's drained enough)...

This is still in-line with what Admin said.

When you think of the electrical characteristics of a battery, you have to imagine a resistor connected in series.

---| +     - |----/\/\/\-----   

This is called the battery's 'internal resistance'. This is the problem with drawing too much load, as the current out of the battery goes up, the voltage drop across the 'imagined' resistor goes up, so the voltage out of the battery goes down.

Now, the load (current) from the servos trying to move is going to be a 'noisy' or fast changing load. A regular volt meter is going to have a hard time measuring voltage or current accurately, as they have a very slow sample rate. The same goes for your bench power supply, it may be 'reporting' it's only sourcing 6 Amps, but it may be getting spikes higher then it's rated load, and droping out voltage.

 If you really want to see if the servo's are drawing too much and the voltage drop (from the batteries internal resistance) is resetting the Axon, you need to use a decent Oscilloscope to measure voltage or current, as a o-scope would be fast enough to give you a better idea of what's happening.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #45 on: February 21, 2010, 03:06:05 PM »
@Webbot ... Im doing it through programming... using servosDisconnect(bank) code, leaving only 1 servo...

Ok so as far as WebbotLib is concerned then the full number of 25 servos are still present. Whether they are 'connected' or not makes no difference to the library - it only effects whether the I/O pin has a pulse.
So if you've defined all 25 and use 'disconnect' to remove some - it makes no difference to the code. The code is still running all 25.

Therefore: it's NOT a software issue.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: WebbotLib for 22+ Servos
« Reply #46 on: February 21, 2010, 04:31:44 PM »
Hasan,
what happens when you leave the program set up for all 25 servos but only physically plug one servo in?

if the servo works fine then the problem is the power bus.
if the servo exhibits problems then the problem is the program.


dunk.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: WebbotLib for 22+ Servos
« Reply #47 on: February 22, 2010, 10:28:04 PM »
Quote
I know on the Axon2 you can unsolder some bridge to allow 2 batteries, but I have not looked yet to see if this separates the power going to the processor from the servo power.
Yeap, you can separate mcu and servo voltages by removing the bridge.


and varying the current (that can go upto 10A) but I was surprised that it turned out to be worse than the battery !?
I repeat:
22+ servos means 22A+ peak.
;D

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #48 on: March 07, 2010, 06:38:41 AM »
Sorry for the late reply...

@Dunk and Webbot, yes, 1 Servo connected would work perfectly fine, as it doesn't require enough load, even after external torque is applied. (yes, I do agree that "that" problem was because of the power supply)

As Admin also said, I need even higher current supply in order to let the servos take the load.
(I have changed the robot design a bit, and reduced the servos to "21" now - so I need up to 21A current)

I am having a hard time in getting more batteries (budget problem) and hence, in the meantime, I was trying to solve the other problem. That one is a software problem:

As already mentioned, (you guys must be fed up of hearing this actually, but) the servos do not hold tight... the reason as I could figure out was because of using more than 1 servo in 1 bank of Webbot Library.

The effect might not be noticable on 2 naked servos, but for my Robot, each servo is under some load, and it simply rotates if I use 2 or more servos in 1 bank. [I would request someone to try a large number of servos in 1 bank, and compare the servos' grip for 1 servo per bank]

For that reason, I asked a question in another* thread, about how to use 8-Bit Timers on Webbot Library in order to increase number of banks, (*since I assumed that I am just making a programming mistake - as I'm new to Webbot library).

Anyway, for the power problem, I will inform as soon as I buy more batteries, and plug in parallel to the existing 3200mAh 6V battery (that, btw, is also a combination of two packs).

Apart from the 8-bit Timer question, I do have a few more quick noob electronics questions:
1) How much in "mAh" would I require for around 20A Supply?
2) Wouldn't that damage the Axon uC, as it can support max ~5A?

Thanks Admin, Webbot, and others.


Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: WebbotLib for 22+ Servos
« Reply #49 on: March 07, 2010, 12:32:08 PM »
@Dunk and Webbot, yes, 1 Servo connected would work perfectly fine, as it doesn't require enough load, even after external torque is applied. (yes, I do agree that "that" problem was because of the power supply)
Hasan999. I want you to think very carefully about that answer  :o
Our question was phrased very carefully - ie your code should be written as if ALL the servos were present - ie loads of them. But physically unplug all the servos except for one. After all - the software will still generate the pulses for all of the servos as it doesn't know or care if you've actually plugged them in or not.
If you are saying that is what you have done - then it is definitely NOT a software problem and more timers wont help. It is PURELY a supply problem.

However: if all you have done is to change your code so that it only knows about one servo - then thats a different story.


Quote
1) How much in "mAh" would I require for around 20A Supply?
Its kinda the wrong question. The "mah" suggest how long your battery will last ie a 3300mah battery can supply 3.3 amps for an hour. This suggests you could draw 20 amps for around 10 minutes.
But don't be fooled! If your battery is measured at 7.2V when fully charged and under no load then it DOES NOT mean it can provide 20 amps at 7.2V. If you draw a large load then the actual voltage will drop - and the more Amps you require then the more it will drop. This is why your Axon resets when you put a load on the servo as the current increases and the voltage drops.
Think of your battery as having a resistor on the power lead. And knowing that Volts=Amps * Resistance then as the Amps increases the Volts drop across the resistor also increases and hence you see a lower voltage at the input to your Axon.

You may have to do it by trial and error. ie start with one servo, put it under stress and measure how much the battery voltage falls. Try it again with two servos, etc.
Then add another battery and repeat your readings for 1,2,3 etc servos. The voltage drop will be less.
You will then get a better idea of how many batteries you need so that the voltage drop is not significant.






Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Servos Do Not Hold Tight !
« Reply #50 on: March 07, 2010, 01:14:28 PM »
ummm...  :-\

Webbot, there are 'two' different problems,

1) Battery Problem (thanks again, to You, Admin and Dunk, to help me figure out) - I will buy more batteries soon.

2) The Servo_not_holding_tight problem.

Unless you skipped the part where I described the 2nd problem's cause, I can actually prove (via a practical example) that both problems are not linked with each other.

Everything below is what I have tried (again) just now to illustrate the problem through observations :

I used 12 servos in 12 different banks:

Code: [Select]
SERVO_LIST servo1[] = {&S1};
SERVO_LIST servo2[] = {&S2};
SERVO_LIST servo3[] = {&S3};
SERVO_LIST servo4[] = {&S4};
SERVO_LIST servo5[] = {&S5};
SERVO_LIST servo6[] = {&S6};
SERVO_LIST servo7[] = {&S7};
SERVO_LIST servo8[] = {&S8};
SERVO_LIST servo9[] = {&S9};
SERVO_LIST servo10[]= {&S10};
SERVO_LIST servo11[]= {&S11};
SERVO_LIST servo12[]= {&S12};

Hence, using all 16-bit Timers, and when I run the problem, All the servos hold extremely tight.

When I still try to apply external torque (such that I actually drag like 6 servos by 90º against their will), the battery can resist that load (no axon reseting) ! (Point is: the power from my battery is more than sufficient for 12 servos)

So, there is no battery problem, in fact, no problem, in this case !

--> Now, I change the code to use 1 bank for all 12 servos:
Code: [Select]
SERVO_LIST servo1[] = {&S1,&S2,&S3,&S4,&S5,&S6,&S7,&S8,&S9,&S10,&S11,&S12};

Hence, using only (any) one 16-bit Timer, when I run the problem,

==> The servos do not hold tight at all... I can easily turn the position of the servos ! (it is same like, having at least 50ms delay between pulses, you can imagine !) ...btw, the battery can again, of course, resist any load here.

I really beg you, or anyone else, to try this !..

For my robot, I need all 21 servos to remain as tight as they are when I put them alone in each bank. Therefore, I need to use 8-bit Timers (as well) to have more banks.

Thanks  :(


« Last Edit: March 07, 2010, 01:21:13 PM by Hasan999 »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #51 on: March 07, 2010, 03:41:00 PM »
Lol Webbot, I already tried explaining internal resistance in this thread.


When you think of the electrical characteristics of a battery, you have to imagine a resistor connected in series.

---| +     - |----/\/\/\-----   

This is called the battery's 'internal resistance'. This is the problem with drawing too much load, as the current out of the battery goes up, the voltage drop across the 'imagined' resistor goes up, so the voltage out of the battery goes down.

Hasan,

Have you found the number of servo's where they start failing? You said 1 was fine but 12 is too much per bank, have you tried increasing up from one to see how many servo's per bank you can do before it starts delaying too long to keep the servo's powered?

Offline dellagd

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 731
  • Helpful? 5
  • Come to the dark side... We have cookies!
    • Exodus Rocketry
Re: WebbotLib for 22+ Servos
« Reply #52 on: March 07, 2010, 05:45:09 PM »
um, I apoligize but I really tried to understand your problem.
Why cant you just use 12 banks for 12 servos (yes I am familiar with WebbotLib)?
does it make your code to slow?
to me it seems like you solved your problem but obviously you havent :P
Innovation is a product of Failure, which leads to Success.

If I helped, +1 helpful pls

I Won!
3rd place! I'm taking $100

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: WebbotLib for 22+ Servos
« Reply #53 on: March 07, 2010, 09:07:24 PM »
Quote
2) Wouldn't that damage the Axon uC, as it can support max ~5A?
It can safely support up to ~13A (calculated, not tested). Thats per trace, however, so if you evenly distribute your batteries across the unregulated power bus you can safely keep the current below that value.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #54 on: March 08, 2010, 01:38:27 AM »
Have you found the number of servo's where they start failing?

Yea, for only 1 servo in 1 bank, it holds tight as it is supposed to. For 2 servos in 1 bank the grip (of each servo) becomes slightly looser, and would keep getting looser as I add more and more servos in the same bank.

Why cant you just use 12 banks for 12 servos (yes I am familiar with WebbotLib)?

Sorry, you're familiar with WebbitLib, but you're not familiar with my problem :P ...I actually need to control 21 Servos (all should hold tight) - WebbotLib, apparently, works perfectly with up to 12 servos (and thats why I showed the observations while using 12 servos for an example, and also to make sure the battery is not the cause of the problem)

It can safely support up to ~13A (calculated, not tested).


Thanks, I think I'll be the first one to test that lol... you owe me an Axon uC if something bad happens  :P ;D

Still awaiting Webbot's reply...

« Last Edit: March 08, 2010, 01:39:57 AM by Hasan999 »

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: WebbotLib for 22+ Servos
« Reply #55 on: March 08, 2010, 11:16:30 AM »
Quote
Tongue ...I actually need to control 21 Servos (all should hold tight) - WebbotLib, apparently, works perfectly with up to 12 servos (and thats why I showed the observations while using 12 servos for an example, and also to make sure the battery is not the cause of the problem)

I've been following this thread and have a thought.
Have you considered that you have just run into the limits of what the processor/code can do? It is very likely that 12 servos is the limit and still maintain the required refresh timing for the servos to hold position.

Could you consider using a second processor and splitting half (or less) the servos to this processor?

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #56 on: March 08, 2010, 05:43:00 PM »

I've been following this thread and have a thought.
Have you considered that you have just run into the limits of what the processor/code can do? It is very likely that 12 servos is the limit and still maintain the required refresh timing for the servos to hold position.

Could you consider using a second processor and splitting half (or less) the servos to this processor?

This horse has been effectively beaten to death in this venture. We have all suggested a dedicated servo controller at one point in the many threads Hasan started on this topic.

There is no pretty way to run this many servos with a microcontroller AND be able to do everything else Webbot's lib can do; Webbot is facing an up-hill battle trying to support as many as he can. I think if anything comes of this, Webbot will be able to figure out the hard limit of servos he can support with his library; and only allow that number to be defined without getting a new Webbot error code.

As far as helping Hasan,

I think his only options are to write his own code for the Axon that 'concentrates' on running that many servos with little overhead much like the servo control software that he tried before,

 or get a dedicated servo controller and end his troubles.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #57 on: March 08, 2010, 11:34:10 PM »
Have you considered that you have just run into the limits of what the processor/code can do? It is very likely that 12 servos is the limit and still maintain the required refresh timing for the servos to hold position.

Could you consider using a second processor and splitting half (or less) the servos to this processor?


We have all suggested a dedicated servo controller at one point in the many threads Hasan started on this topic.

There is no pretty way to run this many servos with a microcontroller AND be able to do everything else Webbot's lib can do;

Are you saying, indirectly, that the Admin has provided a false claim on the main Axon website when he mentioned that the servo can control up to '29 servos' with no conditions mentioned.

If an additional servo controller is required, Admin should provide it with the Axon itself (oh wait, then what is the point of Axon and its small size, and the 29 servo ports).

I do agree it would solve my problem, but it is not easy for me to buy one (I'm not in UK/USA etc) and waste another month making it work together with Axon.

Thanks for the tip anyway,

I still awaiting Admin's and Webbot's response.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: WebbotLib for 22+ Servos
« Reply #58 on: March 09, 2010, 06:53:14 AM »
Are you saying, indirectly, that the Admin has provided a false claim on the main Axon website when he mentioned that the servo can control up to '29 servos' with no conditions mentioned.

If an additional servo controller is required, Admin should provide it with the Axon itself (oh wait, then what is the point of Axon and its small size, and the 29 servo ports).

There is no false claim, you have proven that. You tried that computer controlled servo software (whose name i can't remember) and it was able to control your servos just fine. As far as the hardware of the Axon is concerned, you can run that many servos. It's not the Admin's fault that you have failed to write code efficient enough to provide control signals for that many servos.

It's nice that people like Webbot write software for the Axon to make it easier to use, but it's not a given that you will get software that does everything you need just because you bought a piece of hardware that says it's capable of doing it.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: WebbotLib for 22+ Servos
« Reply #59 on: March 12, 2010, 03:40:04 AM »
@Webbot, please reply to my post #50 ... and kindly let me know if it is possible? (to implement 8 bit Timers)...

Thanks.

 


Get Your Ad Here

data_list