Chaining up multiple 16-Channel 12-bit PWM/Servo Shields

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MaD_YeTTi
 
Posts: 4
Joined: Sat Aug 23, 2014 10:14 am

Chaining up multiple 16-Channel 12-bit PWM/Servo Shields

Post by MaD_YeTTi »

Hello!
I need to control many LEDs via PWM, so i've bought for 16-Channel 12-bit PWM/Servo Shields.
At the moment i've chained 2 shields together, as shown here on manual:
https://learn.adafruit.com/16-channel-p ... ng-drivers
On the first one there in no jumpers soldered so it has 0x40, on second i've soldered so to have 0x41.
I can control only one board. Either 0x40 or 0x41, but not two same time

Basically i need similar to basic PWM test(from library) but using multiple boards, how can i do that?
Thanks!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by adafruit_support_rick »

Please post clear, detailed pictures of both boards and of the wiring between them.

User avatar
MaD_YeTTi
 
Posts: 4
Joined: Sat Aug 23, 2014 10:14 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by MaD_YeTTi »

Please pay no attention to LEDs.
It's just powered off at the moment.
Attachments
20140823_183714 copy.jpg
20140823_183714 copy.jpg (167.37 KiB) Viewed 324 times
20140823_183655 copy.jpg
20140823_183655 copy.jpg (188.17 KiB) Viewed 324 times

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by adafruit_support_rick »

It looks as if you haven't soldered any of those jumper wires between the two boards. Are they soldered? The LEDs don't look soldered, either.

User avatar
MaD_YeTTi
 
Posts: 4
Joined: Sat Aug 23, 2014 10:14 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by MaD_YeTTi »

Yes, all the wires between the PWM board are soldered, LEDs are not, they are there just for test purposes(and they are working properly), later i'll solder there wires till LEDs.
I can use first board if i use in sketch 0x40 or second one using address or 0x41.
Just like here, in tutorial:

Code: Select all

/*************************************************** 

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

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40);
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

void setup() {
  Serial.begin(9600);
  Serial.println("16 channel PWM test!");

  pwm.begin();
  pwm.setPWMFreq(1600);  // This is the maximum PWM frequency
    
  // save I2C bitrate
  uint8_t twbrbackup = TWBR;
  // must be changed after calling Wire.begin() (inside pwm.begin())
  TWBR = 12; // upgrade to 400KHz!
    
}

void loop() {
  // Drive each PWM in a 'wave'
  for (uint16_t i=0; i<4096; i += 8) {
    for (uint8_t pwmnum=0; pwmnum < 16; pwmnum++) {
      pwm.setPWM(pwmnum, 0, (i + (4096/16)*pwmnum) % 4096 );
    }
  }
}
But i'd like to use more boards(more than one) to controll more leds.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by adafruit_support_rick »

Ah. I see. The problem is that you have to address each board individually. So you need two instances of the pwm object, one for each board:

Code: Select all

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

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x41);

void setup() {
  Serial.begin(9600);
  Serial.println("16 channel PWM test!");

  pwm1.begin();
  pwm1.setPWMFreq(1600);  // This is the maximum PWM frequency

  pwm2.begin();
  pwm2.setPWMFreq(1600);  // This is the maximum PWM frequency

. . . etc . . .


User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by Franklin97355 »

You would write your code to start more than one instance of pwm

Code: Select all

Adafruit_PWMServoDriver pwm0 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x41);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x42);

User avatar
MaD_YeTTi
 
Posts: 4
Joined: Sat Aug 23, 2014 10:14 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by MaD_YeTTi »

adafruit_support_rick wrote:Ah. I see. The problem is that you have to address each board individually. So you need two instances of the pwm object, one for each board:

Code: Select all

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

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x41);

void setup() {
  Serial.begin(9600);
  Serial.println("16 channel PWM test!");

  pwm1.begin();
  pwm1.setPWMFreq(1600);  // This is the maximum PWM frequency

  pwm2.begin();
  pwm2.setPWMFreq(1600);  // This is the maximum PWM frequency

. . . etc . . .

Thanks very much!!! Now everything is working perfect!!!
IMHO it's a good idea to put that into FAQ.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Chaining up multiple 16-Channel 12-bit PWM/Servo Shield

Post by adafruit_support_rick »

MaD_YeTTi wrote:IMHO it's a good idea to put that into FAQ.
Yup. I put it right on the Chaining Drivers page.

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

Return to “Arduino Shields from Adafruit”