16 Channel PWM Servo Shield Library

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
foogee
 
Posts: 6
Joined: Fri Mar 17, 2017 4:38 pm

16 Channel PWM Servo Shield Library

Post by foogee »

I'm a novice at this so I might be overlooking something but I've a problem that's driving me mad.

I just got the 16 channel pwm servo shield and hooked it up to an Arudnio Uno and some servos.

I'm running the 1.8.5 Arduino IDE straight off the windows store on a windows 10 machine.

I downloaded Adafruit-PWM-Servo-Driver-Library-master.zip and renamed the file therein to Adafruit_PWMServoDriver and put that directory into C:\Users\paul\BANNED\Documents\Arduino\libraries and confirmed that the files Adafruit_PWMServoDriver.cpp and Adafruit_PWMServoDriver.h were in the directory. I had closed all instances of the IDE.

I try to upload the example pwmtest and I get the below error. The file that it can't find is the one I'm trying to run and I've confirmed that it does in fact exist. what gives?

Code: Select all

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\paul\BANNED\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\paul\AppData\Local\Temp\arduino_build_428823 -warnings=none -build-cache C:\Users\paul\AppData\Local\Temp\arduino_cache_887981 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\paul\BANNED\Documents\Arduino\libraries\Adafruit_PWMServoDriver\examples\pwmtest\pwmtest.ino
readlink C:\Users\paul\BANNED\Documents\Arduino\libraries\Adafruit_PWMServoDriver\examples\pwmtest\pwmtest.ino: The system cannot find the file specified.

Error compiling for board Arduino/Genuino Uno.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: 16 Channel PWM Servo Shield Library

Post by adafruit_support_carter »

Try installing the library using the Library Manager:
Sketch -> Include Library -> Manage Libraries...
and then see if you can get the example sketch to build:
File -> Examples -> Adafruit PWM Servo Library -> pwmtest

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

Hi, I am having the same problem uploading. I go into Manage libraries add the .zip and then look for it under examples but it never shows up. Then I if just go into the folder from my desktop and get this message when I try to compile. What should I do?

/Users/r19kaste/Desktop/Adafruit_PWMServoDriver /examples/servo/servo.ino:20:37: fatal error: Adafruit_PWMServoDriver.h: No such file or directory
#include <Adafruit_PWMServoDriver.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

I have Arduino: 1.6.9 (Mac OS X), Board: "Arduino/Genuino Uno" programmer is AVRISP mkll

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: 16 Channel PWM Servo Shield Library

Post by adafruit_support_carter »

I have Arduino: 1.6.9 (Mac OS X)
I'd recommend updating to the latest Arduino IDE.

Then try reading this for an overview of manual library installation:
https://learn.adafruit.com/adafruit-all ... nstall-use
However, it should be available under the Library Manager, and that should be an easier way to install it.

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

ok thanks, I got that to work. I am trying to use the shield to control 2 servos(Standard Size - High Torque - Metal Gear Servo
1142 )and have them both work at the same pace. I am used to working with Spektrum servos which use degrees, while these servos use pulses could you explain pulses to me and how they compare to the 0-180 degrees? I was trying to use this

;

Code: Select all

for (uint16_t pulselen = SERVOMAX; pulselen > SERVOMIN; pulselen--) {
    pwm.setPWM(1, 0, pulselen);
     pwm.setPWM(2, 0, pulselen);
but it won't work. I put it in the loop.

any suggestions?

thanks!

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: 16 Channel PWM Servo Shield Library

Post by adafruit_support_carter »

Try adding a short delay() to your loop

Code: Select all

delay(10)
Servos don't move instantly to the set angle, so you need to wait a little. The actual value depends on servo and is a matter of tuning.

This has some details that might help:
viewtopic.php?f=50&t=103718&p=519073&#p519073
and in general, 1ms = the minimum angle and 2ms = the maximum angle, but you can often go beyond these limits.

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

ok so now my uno/ shield combo just won't move. I try uploading to the uno and run a simply led blink/servo sweep and it works, then when I plug the shield in and run the normal example code the servo just sits there. both LEDs are lit and the power works because it won't move. what should I do? the upload also works and I have pressed the reset button a few times.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: 16 Channel PWM Servo Shield Library

Post by adafruit_support_carter »

Post a photo of your setup showing all connections.

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

Now I got a new Uno and everything works except the servo when connected to the shield. I can get one my spectrum 0-180 servo to work with just the Uno and then when I connect the shield and use one of the high torque Adafruit servos with servo example code or PWM code it doesn't move, but the current is flowing bc I cant move the horn. here are the pictures. The Uno is connected to a 6v and the shield has 5v
Attachments
adafruit shield 4.JPG
adafruit shield 4.JPG (339.86 KiB) Viewed 1855 times

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

another pic
Attachments
adafruit shield 2.JPG
adafruit shield 2.JPG (401.89 KiB) Viewed 1855 times

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

last one
Attachments
adafruit shield 1.JPG
adafruit shield 1.JPG (395.43 KiB) Viewed 1855 times

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

.
Attachments
adafruit shield 5.jpg
adafruit shield 5.jpg (131.59 KiB) Viewed 1855 times

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: 16 Channel PWM Servo Shield Library

Post by adafruit_support_carter »

Looks like you might have some cold soldering on a few pins. Try running this sketch to see if the servo shield is being seen:
https://playground.arduino.cc/Main/I2cScanner

And check this out for info on common soldering issues:
https://learn.adafruit.com/adafruit-gui ... n-problems

If the scanner sketch does not see the shield, see if you can touch up the soldering by reflowing it to get better wetting. Then try the scanner sketch again.

User avatar
rkasten
 
Posts: 9
Joined: Tue Oct 17, 2017 1:05 pm

Re: 16 Channel PWM Servo Shield Library

Post by rkasten »

ok I reheated all pads and then I run the code and it doesn't even say its scanning or finding anything. Any other suggestions?

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: 16 Channel PWM Servo Shield Library

Post by adafruit_support_carter »

Can you post the output you get from the sketch when you run it.

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

Return to “Arduino Shields from Adafruit”