for my project i’m trying to control up to 12 servo SG90.
I am using an Arduino Mega with a Sainsmart sensor sheild v2.
My arduino is connected with a raspberry pi via bluetooth HC05 module.
My servos are attached by demand with the instructions coming from the raspberry pi (not attached at start)
With 6 or 7 servo connected, it’s working perfectly. But when i connect more servo on the board (but not attached yet by the program), the bluetooth module do not start. If i do severals restarts, it sometime works with 8 servos…
My power supply is a DC 5V and 3A with a splitter cable in order to seprarate the arduino and the shield.
I feel like it is enough because when i use a servo i attach it, use it and detach…
Is it possible that non-attached servos consume power ? At start, i can ear just a little sound from the servos.
I put the arduino program down there, if some one has a clue ?
Thanks
#include <SoftwareSerial.h>
#include <Servo.h>
Servo servo;
int table[3]; //for buffer reception
void setup() {
Serial.begin(9600);
Serial.println("btServos connect = OK");
}
void loop() {
while (Serial.available()) {
// Buffer reception : a 3 char code
for (int i = 0 ; i<3 ; i++) {
char c = Serial.read()-'0';
table[i] = c;
delay(10);
}
while (Serial.available()) {
Serial.read(); }
int a = (int)table[0];
int b = (int)table[1];
int num = (a*10) + b ;
int action = (int)table[2];
Serial.print(num);
Serial.println(action);
Fservo(num,action);
delay(150);
}
}
int Fservo (int n, int act) {
servo.attach(n);
delay(150);
if (act==1) {
servo.write(90);
delay(150);
servo.detach();
delay(150);
}
if (act==2) {
servo.write(0);
delay(150);
servo.detach();
delay(150);
}
if (act==9) {
servo.detach();
delay(150);
}
}
Those servos seem to be the same size as the HobbyKing servos I have. I recently measured the resting current at 6mA and I think the max on-load current was about 150mA.
For the future please just post a JPG or PNG that can be visible on this Forum. See this Image Guide
Now I have a good idea what your shield is like, It was obviously designed for lots of servos.
But your diagram does not show how power is shared with the Mega.
Can you post a link to the datasheet for the shield?
Sure, i should try with 12A supply, to see if it's working (need to find one).
Controling 12 servo is the bigining, after i will need 32 servos.
I do'nt know if i can put a 32A suplly on my shield ?
It seems that those TowerPro SG90 servo does not consume so much. But there no information about it in data sheet and all the posts i found give conflicting informations.
I thought that my method : attaching / moving / detaching servo one after another when needed, allows to use a smaller supply cause they're not used (neither attached) in the same time. But maybe i'm wrong ?
Does non-attached servo consume power at start ? That the question ?
The problem is the peak consumption, not the average - it you know you only operate a few servos at
a time you can downrate the supply somewhat. If the supply is overloaded the voltage drops and all
the servos can then jitter / move at random.
For large bunch of servos consider using a battery to buffer your supply, since large power supplies are
expensive and bulky, a battery can handle the peaks. However ensuring a battery is correctly charged
while under load is tricky to get right.
The underlying issue is that hobby servos are a compromise design, designed to be cheap and used in
RC models. A decent servo would have separate motor and controller supplies which would be a whole
lot better behaved under momentary over-load.
Pranamerti:
2. It seems that those TowerPro SG90 servo does not consume so much.
Get out your multimeter and measure the current on one of them - especially while it is pushing against a heavy load. Though don't apply the heavy load for more than a few seconds - just long enough to get a meter reading.