Control of servos with Arduino and Servo Driver or Shield

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
aive
 
Posts: 8
Joined: Wed Oct 03, 2018 9:28 pm

Control of servos with Arduino and Servo Driver or Shield

Post by aive »

Hello,

I'm looking for advice to figure out with second question

I'm want to control several number of servo motors with Arduino Uno or Due controller, and use some board to plug all servos together for assembly casing box.

Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685 or Adafruit 16-Channel 12-bit PWM/Servo Shield

I'm trying to figure out, if Shield is convenient since I can just plug it into Arduino controller and wire the motors direct to it, control with pins, what should be the reason for choosing Driver, if my project requires accelerating of 9 motors 0.03 sec/60° @ 4.8V speed from control application 2-3 messages per second with Arduino

If I follow this Connecting to the Arduino guide, I have to connect 5V and GND from Arduino controller to the GND and VCC of Servo Driver, and Analog In 4 and 5 with SCL and SDA, and additionally I have to power driver separately with 5V and 2 Amp adapter I guess

Then what is option to control with Driver, if it is not uses pin connection, how all servos must be controlled with separate command and degree value, because usually on breadboard to control 2 servos I use pins 9 and 11 with sending of value for example from C# desktop application, with value

Code: Select all

myport.WriteLine("9"); write myport.WriteLine(trackBar1.Value.ToString());
to loaded code:

Code: Select all

servo1.attach(9); servo2.attach(11); 
with

Code: Select all

val = Serial.parseInt();
condition

Code: Select all

if(val == 9) { servo1.write(Serial.parseInt()); } 
In driver case according to Adafruit-PWM-Servo-Driver-Library with single example seems must be differently

by the way, I don't have any device yet, but I've tried to check example, I have located Adafruit-PWM-Servo-Driver-Library-master folder into C:\arduino-1.8.6\libraries folder, but

Code: Select all

#include <Adafruit_PWMServoDriver.h>
does not appears as included, and I can't see it in Sketch/Included Libraries of Arduino IDE

Any advice, guide or example would be helpful

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

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by adafruit_support_bill »

the circuitry on the breakout board and the shield are identical. The only difference is that the shield version has Arduino headers, so it can plug into and Aarduino directly.

The library should be installed in your sketchbook library folder as described here: https://learn.adafruit.com/adafruit-all ... -a-library

User avatar
aive
 
Posts: 8
Joined: Wed Oct 03, 2018 9:28 pm

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by aive »

adafruit_support_bill wrote:the circuitry on the breakout board and the shield are identical. The only difference is that the shield version has Arduino headers, so it can plug into and Aarduino directly.

The library should be installed in your sketchbook library folder as described here: https://learn.adafruit.com/adafruit-all ... -a-library
Hello,

Thank you for your answer, now I can see library in Examples and Included Libraries. I'm not sure if I have to add additionally to C:\arduino-1.8.6\libraries or it is enough to keep it in C:\Users\User\Documents\Arduino only, but first of all, I'm trying to figure it out with second

Now I have a device on hand [Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685][1]

As I said I followed this Connecting to the Arduino guide, as described above, except powering, because now I have only 2 servos and using controller 5V, temporarily without separate adapter power source

I've uploaded this example without any editing, and connected servos to `0` and `1` channel, but nothing happens

Can you help me to figure out based on given code, how can I get value from C# application in uploaded code and control two servos separately, equivalent to this example:

Code: Select all

#include <Servo.h>
    Servo servo1;
    Servo servo2;
    int val;
    
    void setup() {
        Serial.begin(9600);
        servo1.attach(9); 
        servo2.attach(11);
    }
    
    void loop() { 
      val = Serial.parseInt(); 
      if(val == 9){
        servo1.write(Serial.parseInt()); 
      }
      else if(val == 11){
        servo2.write(Serial.parseInt());
      }
    }
I can't get, how it works and for some reason the downloaded code, as I've said above, also does nothing, which must turn servos without any external command, as it is needed in my case, if I get it right, but anyway, does nothing

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

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by adafruit_support_bill »

I'm not sure if I have to add additionally to C:\arduino-1.8.6\libraries or it is enough to keep it in C:\Users\User\Documents\Arduino only
You should only have one copy of the library installed.
I've uploaded this example without any editing, and connected servos to `0` and `1` channel, but nothing happens
Please post photos showing your soldering and connections.

User avatar
aive
 
Posts: 8
Joined: Wed Oct 03, 2018 9:28 pm

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by aive »

adafruit_support_bill wrote:
I've uploaded this example without any editing, and connected servos to `0` and `1` channel, but nothing happens
Please post photos showing your soldering and connections.
I don't have soldering, my connection is a Arduino Uno and Adafruit driver, according this guide this connection, except powering, now I use only 2 servos with 5V from controller, I understand that I should use the separate adapter for project, but seems like this is not the reason why I can't check this example code

here is a photo:

Image
Last edited by aive on Thu Oct 04, 2018 2:16 pm, edited 4 times in total.

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

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by adafruit_support_bill »

That is not an Adafruit board. The manufacturer or seller should be able to assist you with any technical issues.

User avatar
aive
 
Posts: 8
Joined: Wed Oct 03, 2018 9:28 pm

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by aive »

adafruit_support_bill wrote:That is not an Adafruit board. The manufacturer or seller should be able to assist you with any technical issues.
How you determined it?

I bought it in an electronic store, they told me that it Adafruit

Possible it was used, but they guaranteed that they sell it in working condition

so you say it's fake board =(

why then is the logo on it

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

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by adafruit_support_bill »

Where did you purchase the board?
Please post clear photos of the front and back of the board.

User avatar
aive
 
Posts: 8
Joined: Wed Oct 03, 2018 9:28 pm

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by aive »

adafruit_support_bill wrote:Where did you purchase the board?
Please post clear photos of the front and back of the board.
Image

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

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by adafruit_support_bill »

I don't see the Adafruit logo you mentioned. It looks generally similar to our boards. But there are differences in the design and components used.

User avatar
aive
 
Posts: 8
Joined: Wed Oct 03, 2018 9:28 pm

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by aive »

adafruit_support_bill wrote:I don't see the Adafruit logo you mentioned. It looks generally similar to our boards. But there are differences in the design and components used.

I found this video Complete guide to PCA9685 16 channel Servo controller for Arduino with code also uses some different board, which looks similar, and uses Adafruit library, but same code does not works form me. Uploading of code to Arduino Uno controller seems successful with TX and RX led

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

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by adafruit_support_bill »

We are an open source company and publish our source code and board designs. Others are welcome to use this information to build their own boards. But obviously we cannot provide engineering support for boards that we do not produce ourselves.

User avatar
cstratton
 
Posts: 294
Joined: Wed Sep 29, 2010 3:52 pm

Re: Control of servos with Arduino and Servo Driver or Shiel

Post by cstratton »

Regardless of the origin of the board, this is a simple case of neglecting to follow the part of the instructions which specify that servo power must be fed to the V+ pin.

One can see in the picture that both the header and screw terminal V+ are unused.

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

Return to “Arduino”