0

Adafruit 16-Channel 12-bit PWM/Servo Driver
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Tue May 29, 2012 5:32 pm

The video for the 16-Channel PWM/Servo Driver shows a capacitor on the board that does not come as part of the kit. Is this an optional component and if so when would it be recommended? Also, if I were to install the cap - what would be the recommended component?
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit on Tue May 29, 2012 5:39 pm

you dont necessarily need it unless you have a lot of servos and if you have a separate motor power supply you dont need it at all
a 220uf/10V or higher should do the job

adafruit
 
Posts: 12149
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Wed May 30, 2012 9:41 am

Thanks. For the hookup do I need to create my own common ground, or can I independently connect the positive and ground from my power source to the terminal block and the I2C from the arduino?

Also, is there a plug end that works with the supplied terminal block or are you limited to just using a bare wire connection.

And yes, I'm a noob but I'm having fun learning.
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit_support_bill on Wed May 30, 2012 10:08 am

If you are using the external power terminal, just be sure you have a ground wire to the Arduino along with your other I2C connections.

The screw terminals work fine with bare wire or pins. I don't know of any plugs designed specifically for use in these.

adafruit_support_bill
 
Posts: 71779
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Wed May 30, 2012 11:59 am

Just to be clear, would this be the right schematic:

16_Channel_Hookup.jpg
16_Channel_Hookup.jpg (48.79 KiB) Viewed 4963 times
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit_support_bill on Wed May 30, 2012 12:32 pm

You will also need a connection from VCC to +5v. The V+ connection is for the servo power only.

adafruit_support_bill
 
Posts: 71779
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Wed May 30, 2012 5:44 pm

So, you mean you put that note, "Use V+ for servo supply" on the back of the PCB for a reason. Sorry I missed that the first time around.

Okay, so the correct schematic would be something like this:

Servo Control Hook-up_bb.jpg
Servo Control Hook-up_bb.jpg (53.58 KiB) Viewed 4950 times
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit_support_bill on Wed May 30, 2012 6:28 pm

That should do it!

adafruit_support_bill
 
Posts: 71779
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Sun Jun 03, 2012 10:29 am

If I want to make up a wire harness with a female connector to plug into the male connections on this board what is the best approach?
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit_support_bill on Sun Jun 03, 2012 10:50 am

For connecting to the Arduino, I'd start with one of these http://www.adafruit.com/products/206. Cut one end off, then strip & tin the wires. If you solder pins on the ends, they will hold up better to repeated insertions.
Image

adafruit_support_bill
 
Posts: 71779
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Sun Jun 03, 2012 2:24 pm

Thanks! I just hacked together an ugly wiring solution using some old servo jumper cables and I modified the example sketch to simply turn one servo back and forth. Later today I'll modify the code to turn the servo based on a pot input.

I'm taking baby steps but I'm getting there and having fun!
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Sun Jun 03, 2012 3:24 pm

How would I scale the input from a potentiometer (0 - 1023) to the output for the pwm.setPWM command's pulse length (1ms to 2ms). In other words, I guess I'm not understanding how to tell it how long each pulse should be.
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit_support_bill on Sun Jun 03, 2012 4:53 pm

I would use the "map" function. http://arduino.cc/en/Reference/map

Code: Select all | TOGGLE FULL SIZE
pulse = map(x, 0, 1024, SERVOMIN, SERVOMAX);
pwm.setPWM(n, 0, pulse);

adafruit_support_bill
 
Posts: 71779
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by wrecks135 on Sun Jun 03, 2012 6:23 pm

You guys rock. I can't believe you are helping me out on Sunday afternoon. Awesome customer service!

Thanks - my draft sketch uses the map function like you suggested and like is provided in the Ardunio sample Knob sketch. That said, how does the SERVOMIN of 150 and the SERVOMAX of 600 in the example sketch correspond to 1ms and 2ms pulse widths? I can't for the life of me figure that one out.

Also, Futaba says their servos are looking for a pulse every 19 to 22ms - or about 50 pulses per second - wouldn't that be 50 Hz? If so, why does the example sketch set the pulselength variable and the PWMFreq at 60 Hz (60 times per second)?

I'm thinking this all has something to do with the "12 bits of resolution" which I don't understand.
wrecks135
 
Posts: 18
Joined: Wed May 09, 2012 9:48 am

Re: Adafruit 16-Channel 12-bit PWM/Servo Driver

by adafruit on Sun Jun 03, 2012 10:24 pm

some are 50 or 60 hz, it doesnt matter for low cost analog servos - you can change the sketch if you wish

adafruit
 
Posts: 12149
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.