Adafruit 16-channel PWM/Servo Shield // General questions

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
_jj
 
Posts: 1
Joined: Mon Nov 04, 2013 8:28 am

Adafruit 16-channel PWM/Servo Shield // General questions

Post by _jj »

Hi there!
We are currently planning an interactive installation which utilizes about 1600 servo motors on a 16-meters-long wall, each of which must be controlled individually. We have been thinking about using the „Adafruit 16-channel PWM/Servo Shield“ for this task, and would like to ask if you have some general thoughts about this. Do you think this is perfectly possible with this number of servos? Any recommendations? Or do you see any problems upfront? How many Arduinos would you recommend?
And do you know of anyone who has already done a project in this scale?

Thanks in advance!

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

In theory, you could do it with as few as 2 Arduinos (max 992 servos each). Possible issues might be:

Timing:
Since i2c is a serial bus, you can only send commands to one servo at a time. Having hundreds of servos on the bus may limit the responsiveness of your installation.

Servo cable length :
With things spread out over 16 meters, you will have a lot of very long servo cables. I would expect to see some interference from that many parallel long runs. You can minimize the length of your servo cables be using the breakout version of the board and mounting individual breakouts closer to the servos they are controlling http://www.adafruit.com/products/815

I2C cable length :
Using the breakouts minimizes the servo cable length, but requires an i2c connection between breakouts. I2C is not ideal for very long runs and will also be susceptible to picking up noise from the servos. This issue could be minimized by using more Arduinos to limit the i2c bus length to a few meters. 8 Arduinos, would limit the I2C bus length to 2 meters.

Power:
Servos are power hungry. If there is a possibility that a substantial fraction of those 1600 servos will be moving at the same time, they will consume a lot of power. I would strongly recommend separate power supplies for the Arduinos so that an instantaneous power surge from the servos does not cause a 'brownout' and reset the Arduino.

mtorrance
 
Posts: 2
Joined: Wed Nov 06, 2013 2:25 pm

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by mtorrance »

Question:

Is there some way I can use the library to "turn off" power to a servo after I've started it up? When I initialize my board, the servos are in a "free rotation" mode where they are not trying to achieve any particular angle. But once I've set an angle, I would like to have a command I can use to revert the servo to an "unpowered" state, without actually turning off the whole board.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

There is no way to turn-off power to individual servos since the V+ line is connected directly to the power pins on the headers.

mtorrance
 
Posts: 2
Joined: Wed Nov 06, 2013 2:25 pm

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by mtorrance »

Thanks, but I am still a little confused. Perhaps "turn off power" is not the right phrase. When I initially power up the board, even after I "initialize" the servo library from my Arduino code, the servos connected to the servo shield are still in "free rotation" mode. I don't know if they are powered or unpowered, but I can manually backdrive them and they let me -- they are not "servoing" to any particular target position.

Once I send a PWM command to a servo, it starts trying to maintain that position. I can change the target position with a new PWM command.

What I'm asking is if there's a way I can send some other command, or some particular value to the PWM command, to get the servo to revert to its initial "free rotation" state. Maybe the signal wire needs to be "floating" instead of pulsing? I apologize for my inexperience with the underlying electronics...

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

setPWM(channel, 0, 0); will effectively disable the PWM signal. This will not de-power the servos, but will prevent them from seeking to any particular position.

jlew13
 
Posts: 5
Joined: Mon Jul 28, 2014 11:29 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by jlew13 »

Hello,
Rather than start a new post I also have a general question regarding this shield (It was recommended to me by an experienced engineer).
I am building an articulated arm that will require two standard servos and a linear actuator. Is this shield overkill?
I am a beginner - I just bought my first Arduino board and I'm getting my feet wet.
Also, the arm will be required to hold and rotate an object that weighs ~300 grams (camera). Can you recommend servos that could handle the load?
Sincere thanks!

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

Is this shield overkill?
The shield does have more channels than you need, but that should not be a problem. The advantage of using this shield compared with direct control from the Arduino is that all the PWM overhead is handled by the shield, relieving the Arduino to do other things.
Also, the arm will be required to hold and rotate an object that weighs ~300 grams (camera). Can you recommend servos that could handle the load?
A lot depends on the geometry of the arm (longer arms will require more torque to lift).
And the motion requirements (faster movements require more torque also).
Start by calculating the static load (e.g. a 300 gm load at the end of a 20cm arm requires 6 Kg-force/meters or about 59Nm of torque just to maintain position. http://www.convert-me.com/en/convert/torque/gfm.html)
Then figure out what you will need in addition to that to achieve the acceleration necessary to meet your motion requirements.

jlew13
 
Posts: 5
Joined: Mon Jul 28, 2014 11:29 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by jlew13 »

Great, thank you for the reply.
After analyzing the geometry, I did the math and determined I'd need 13.3 N-cm and 16 N-cm, from servo 1 and 2 respectively, to hold my rig steady. I am locating standard servos that stall out at 147 N-cm so I believe I will be able to find servos that can handle the load.
Now the question is, I am only going to rotate these servos +or- 5 degrees in each direction from center-line. Are there a certain type of servo that is better suited for precision/small angle movements - or is it simply a matter of writing the software to move the servos at smaller angles?
Also, I am looking to control a linear actuator on my rig: http://www.robotshop.com/en/firgelli-te ... -12-i.html
Would I be able to control the linear actuator with this shield or would I need a separate control board?

User avatar
zootoy
 
Posts: 3
Joined: Sat Aug 09, 2014 8:41 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by zootoy »

Hi i was wondering if you could explain something from the tutorial on this product
the section titled "Converting from Degrees to Pulse Length"
does this mean that by adding the line "pulselength = map(degrees, 0, 180, SERVOMIN, SERVOMAX);"
i could command the servos by giving them an angle to go to, instead of the pulse value?
could you please give me an example of how i would write/use this to make use of it?
I would prefer to use angles for the servos instead of pulse as it would make more sense to me, and be more like the arduino servo.h library
I am making a quadruped with 3 servos in each leg i plan to define a bunch of positions for each servo to go to, then i plan to call them in groups for each step.
I dont know if you are familiar with it but one day i would like to be able to use something like the phoenix code with inverse kinematics; https://github.com/KurtE/Arduino_Phoenix_Parts
i have seen it used (with lynxmotions ssc32 but that no longer seems available). for hexapods and quadrupeds, it would be great to have support for the adafruit servo controller as its so small

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

You can use the formula in the tutorial directly, or write a function to 'wrap' it for convenience. Assuming you have "pwm" defined already, something like this should work.

Code: Select all

void moveServo(int servo, int angle)
{
    int pulselength = map(degrees, 0, 180, SERVOMIN, SERVOMAX);
    pwm.setPWM(channel, 0, 0, pulselength);
}

User avatar
zootoy
 
Posts: 3
Joined: Sat Aug 09, 2014 8:41 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by zootoy »

Thank you.
so i would use "int pulselength = map(degrees, 0, 180, SERVOMIN, SERVOMAX);
pwm.setPWM(channel, 0, 0, pulselength)"
somewhere near the top of the sketch,
and that would let me use "void moveServo(int servo, int angle)" like this: void moveservo(servo1,180)?

Would this also work with making more than one servo move from a single command?
void moveServo(servo1,servo2,servo3, 90,90,180) for example? or am i miss understanding?

Thank you

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

so i would use "int pulselength = map(degrees, 0, 180, SERVOMIN, SERVOMAX);
pwm.setPWM(channel, 0, 0, pulselength)"
somewhere near the top of the sketch,
and that would let me use "void moveServo(int servo, int angle)" like this: void moveservo(servo1,180)?
No. You would define moveServo as in my previous post, somewhere near the top of the sketch. Then you can call it from elsewhere in your sketch.
Would this also work with making more than one servo move from a single command?
void moveServo(servo1,servo2,servo3, 90,90,180) for example? or am i miss understanding?
No. the function accepts a single parameter for a servo. If you want to move multiple servos, you need to make multiple calls.

User avatar
zootoy
 
Posts: 3
Joined: Sat Aug 09, 2014 8:41 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by zootoy »

Would you be able to point me to some sample code that uses that?
so i can get an idea

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-channel PWM/Servo Shield // General question

Post by adafruit_support_bill »

Code: Select all

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

#define SERVOMIN  150 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  600 // this is the 'maximum' pulse length count (out of 4096)

void moveServo(int servo, int angle)
{
    int pulselength = map(angle, 0, 180, SERVOMIN, SERVOMAX);
    pwm.setPWM(servo, 0, pulselength);
}

void setup() 
{
  pwm.begin();
  
  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates
}

void loop() 
{
  moveServo(0,0);
  moveServo(1,0);
  delay(1000);
  moveServo(0,180);
  moveServo(1,180);
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”