Adafruit 16-Channel 12-bit PWM/Servo Driver
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
So still less than 2v with a minimal load. I think something is wrong with your BBB 3.3v supply.
- jofegibo
- Posts: 8
- Joined: Tue Jul 09, 2013 10:39 pm
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
problem solved, a lot of documentation says that vcc must ve connected to pins 1 and 2 of the port P8
Looking deeper, The manual of beaglebone.org says the same but in port P9.
It' worked perfect
thank you for your help
Looking deeper, The manual of beaglebone.org says the same but in port P9.
It' worked perfect
thank you for your help
- foxfirex
- Posts: 9
- Joined: Sat Dec 15, 2012 11:51 pm
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
Any chance someone could make a power recommendation for me? I'm going to have several of these set up to run LEDs, probably either 9 or 10 boards. (Nine would be using pretty much every output, ten would allow some empties.) The LEDs are rated to 3.3V, so that'll be my target input voltage. If it's possible to run that many boards/LEDs (plus a basic Arduino for control) off a battery, that'd be my preference, but I'm really not well-versed in the power calculations. Any suggestions?
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
What is the current rating? Are these standard 3mm or 5mm plastic packages? Or are you looking at driving higher-power leds?The LEDs are rated to 3.3V,
- foxfirex
- Posts: 9
- Joined: Sat Dec 15, 2012 11:51 pm
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
These are 5mm LEDs. Honestly, got them in bulk from eBay, so the specs aren't the clearest, but they all include 20mA in the listing. (One says 20mA "or more", but that's not comforting.) Also just noticed they actually say 3.2 V, so bad memory on my part.adafruit_support_bill wrote:What is the current rating? Are these standard 3mm or 5mm plastic packages? Or are you looking at driving higher-power leds?
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
20mA is pretty typical for that class of led. Based on your first post I am assuming you have about 9 x 16 or 144 leds. The calculation from there is pretty straightforward: 144 x 20 mA is 2880 mA or 2.8 Amps. We just got these 5v-4A supplies in the store. That would be enough to drive the lot, plus a little to spare. http://www.adafruit.com/products/1466
You might want to consider this driver board as well. It will do 24 channels of led control for the same price. You could get by with 6 boards with individual led control of 144 leds. http://www.adafruit.com/products/1429
You might want to consider this driver board as well. It will do 24 channels of led control for the same price. You could get by with 6 boards with individual led control of 144 leds. http://www.adafruit.com/products/1429
- foxfirex
- Posts: 9
- Joined: Sat Dec 15, 2012 11:51 pm
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
So based on that, I guess you're recommending against trying to go with any sort of battery power? Ideally I'd rather not have to have this plugged in, but if that's the safest approach, so be it.
And I would have considered that driver board if I hadn't already bought and assembled the other ones. Unless you'd like to arrange a trade.
Edit: Also, I notice that's a 5V transformer. What will I need to do to drop that to 3.2 for the LEDs?
And I would have considered that driver board if I hadn't already bought and assembled the other ones. Unless you'd like to arrange a trade.
Edit: Also, I notice that's a 5V transformer. What will I need to do to drop that to 3.2 for the LEDs?
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
Sorry, I missed that you were looking for battery power. These are designed for 5v operation. 4x NiMH rechargeable cells will give you 4.8 which is close enough. I'd recommend C-cells to supply that kind of current. These cells are usually rated in the 5000mAh range. Worst case (all leds on) should give you at about 1.5 hours run time.
Another option is to use one of these with any pack between 6 and 23v. http://www.adafruit.com/index.php?main_ ... rch&q=ubec
There are some other battery power options here: http://learn.adafruit.com/battery-power ... rips/diode
Another option is to use one of these with any pack between 6 and 23v. http://www.adafruit.com/index.php?main_ ... rch&q=ubec
There are some other battery power options here: http://learn.adafruit.com/battery-power ... rips/diode
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
Even with a battery, you would need a current-limiting resistor for each LED. The resistor will also match the supply voltage (5V)to the forward voltage of the LED (3.2V). The formula for a single LED, with a forward current of 0.020A (20mA) is:FoxFireX wrote:Edit: Also, I notice that's a 5V transformer. What will I need to do to drop that to 3.2 for the LEDs?
So, you need a 90 ohm resistor in series with each LED, between 5V and GND.Resistance = (Supply Voltage - Forward Voltage) / Forward Current
Resistance = (5 - 3.2)/ 0.020
Resistance = 90 Ohm
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
The PWM/Servo driver already has 220 ohm series resistors on board. This will limit the current a bit more, reducing your battery drain considerably.Even with a battery, you would need a current-limiting resistor for each LED.
- foxfirex
- Posts: 9
- Joined: Sat Dec 15, 2012 11:51 pm
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
So, getting mixed messages here; do I need to add additional resistors, or is the onboard one going to be sufficient?adafruit_support_bill wrote:The PWM/Servo driver already has 220 ohm series resistors on board. This will limit the current a bit more, reducing your battery drain considerably.Even with a battery, you would need a current-limiting resistor for each LED.
Would there be any benefit with going for a LiPo style battery instead of the C cells? What I'd really like to end up with is something where I could plug in to a hidden port between uses, but wouldn't need to open it up to replace the actual cells. I could make it work lots of ways obviously, but I'm trying to get the cleanest solution.
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
You do not need additional resistors. You can drive your leds directly from the board.
A single cell LiPo is about 3.7v. This is enough to power the PCA9865 chip, but with the resistors already in place, you would only get about 2mA through the leds, so they would not be very bright. You could go with a 2-cell 7.4v LiPo battery (available from many hobby shops and on-line suppliers) But you would need to use the UBEC linked above to regulate that to 5v.Would there be any benefit with going for a LiPo style battery instead of the C cells?
- kpi
- Posts: 2
- Joined: Wed Sep 11, 2013 12:27 pm
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
Hello, I'm new to the forum and Adafruit. I'm looking for a (human?) explaination of the data I need to send in order to interface the PWM/Servo controller from a BS2px.
I'm interfacing one standard hobby servo on ch0, no jumpers (Ox40)
Looking at the data sheet, I am a bit unclear of the actual order and data required to configure and use the pca9685. Here's my first take:
Power up board.
I2c to device Ox40 to sleep. (bit 4 of mode1)
Set prescale to 50hz (looks like 121 goes into OxFE somehow)
bit4 of mode1 to 0 (wake up)
write 12 bits to define on time, 12 bits of off time, total is 4095. (Startup servo position)
write to servo driver as required to change pwm durations (move servo as req'd by application)
Am I in the ballpark?
I'm interfacing one standard hobby servo on ch0, no jumpers (Ox40)
Looking at the data sheet, I am a bit unclear of the actual order and data required to configure and use the pca9685. Here's my first take:
Power up board.
I2c to device Ox40 to sleep. (bit 4 of mode1)
Set prescale to 50hz (looks like 121 goes into OxFE somehow)
bit4 of mode1 to 0 (wake up)
write 12 bits to define on time, 12 bits of off time, total is 4095. (Startup servo position)
write to servo driver as required to change pwm durations (move servo as req'd by application)
Am I in the ballpark?
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit 16-Channel 12-bit PWM/Servo Driver
Looks like you are on the right track. Our library is a good reference. It is only a handful of functions. If your processor has i2c support, it should be a straightforward port. https://github.com/adafruit/Adafruit-PW ... er-Library
- kpi
- Posts: 2
- Joined: Wed Sep 11, 2013 12:27 pm
Re: Basic Stamp and Adafruit 16-Channel 12-bit PWM/Servo Driver
Would this attached code be getting warm? It doesn't work yet, but it may be something to do with my I2c data output. Is the order of what I'm doing correct/incorrect/horrible/great? : )
FYI debug to pc works fine, so it isn't getting hung up anywhere, just no action from the servo yet.
My O-scope is showing signal going in, SDA and SCL are fine, power on the servo lines...
I think it's my logic that isn't quite right yet???
Thanks!
' {$STAMP BS2px}
' {$PBASIC 2.5}
'test I2c via BS2px24 with Adafruit 16ch pwm controller
PAUSE 500
I2COUT 0,$40,$00, [$10] 'set mode to sleep for prescale set
DEBUG CLS, "sleeping"
PAUSE 1000
I2COUT 0,$40,$FE, [$79] 'set prescale to 50 hz
DEBUG CLS, "prescaling"
PAUSE 1000
I2COUT 0,$40,$00, [$A1] 'mode 1 awake
DEBUG CLS, "awake"
PAUSE 1000
pulses:
'pwm commands following:
DEBUG CLS, "center"
I2COUT 0,$40,$06, [$00] 'set pwm to center 1/15th pwm duty cycle LED0_ON_Lowbyte
I2COUT 0,$40,$07, [$00] ' 273/4096 should be 1.5ms LED0_ON_Highbyte
I2COUT 0,$40,$08, [$11] ' LED0_OFF_Lowbyte
I2COUT 0,$40,$09, [$01] ' LED0_OFF_Highbyte
PAUSE 500
GOTO pulses
FYI debug to pc works fine, so it isn't getting hung up anywhere, just no action from the servo yet.
My O-scope is showing signal going in, SDA and SCL are fine, power on the servo lines...
I think it's my logic that isn't quite right yet???
Thanks!
' {$STAMP BS2px}
' {$PBASIC 2.5}
'test I2c via BS2px24 with Adafruit 16ch pwm controller
PAUSE 500
I2COUT 0,$40,$00, [$10] 'set mode to sleep for prescale set
DEBUG CLS, "sleeping"
PAUSE 1000
I2COUT 0,$40,$FE, [$79] 'set prescale to 50 hz
DEBUG CLS, "prescaling"
PAUSE 1000
I2COUT 0,$40,$00, [$A1] 'mode 1 awake
DEBUG CLS, "awake"
PAUSE 1000
pulses:
'pwm commands following:
DEBUG CLS, "center"
I2COUT 0,$40,$06, [$00] 'set pwm to center 1/15th pwm duty cycle LED0_ON_Lowbyte
I2COUT 0,$40,$07, [$00] ' 273/4096 should be 1.5ms LED0_ON_Highbyte
I2COUT 0,$40,$08, [$11] ' LED0_OFF_Lowbyte
I2COUT 0,$40,$09, [$01] ' LED0_OFF_Highbyte
PAUSE 500
GOTO pulses
Please be positive and constructive with your questions and comments.