picaxe and PCA9685 (16 PWM output)

xtech007

Senior Member
Morning all!
In efforts to control many RGB leds CC, ran into what seems a familiar issue. PWM outputs. I have used max7219 in the past to control 8x8 led matrix. Used picaxe 28x1 and 28x2 successfully! But just monochrome red or green.

Adafruit has a 16 pwm driver here is the link:
https://learn.adafruit.com/16-channel-pwm-servo-driver/overview

It can control each 16 outputs Pwm's independently, also be chained up upto 62 of them. Thats 992 outputs.

It uses I2C. 2 wires for communication.
Each chip has its own address asignated by user!

Here are my questions;
Have anyone used these in the past with picaxe?

Do anyone have a code snippet we can take a look at?

A guide?

Circuit diagram on how to attach to picaxe and outputs?

I will start to read the data sheet soon and find spare time to keep posting findings!

Thanks forum!
 

westaust55

Moderator
Looking at the Datasheet for that chip:
http://www.nxp.com/documents/data_sheet/PCA9685.pdf
There are 6 address lines so you can have tentatively up to 64 chips
But each is addressed discretely with its own i2c slave address.
They cannot be daisy chained together.

EDIT:
The “Chaining” mentioned by ADA Fruit is just the continuation of the i2c and OE and supply lines.
Hence each chip is in effect a “drop” from the i2c bus and separately addressed – not an extended chain of shift registers akin to daisy chaining several 74HC595 chips together.
 
Last edited:

Buzby

Senior Member
I've not checked the datasheet, but seem to remember that an NXP LED driver chip was the subject of a forum discussion in the past.

If I remember correctly, the chip required an I2C General call to setup the user address. General Call is address 0000 0000, and a PICAXE can't send that address.

Unless someone has definite proof of one of these working with a PICAXE, it might be a good idea to study the datasheet in great detail, and maybe have a look at the code in the Arduino libraries to see how they do it.
 

westaust55

Moderator
Fromt the datasheet:
Device addresses
Following a START condition, the bus master must output the address of the slave it is accessing.
There are a maximum of 64 possible programmable addresses using the 6 hardware address pins.
Two of these addresses, Software Reset and LED All Call, cannot be used because their default power-up state is ON, leaving a maximum of 62 addresses.
Using other reserved addresses, as well as any other subcall address, will reduce the total number of possible addresses even further.
The Slave address format for the PCA9685 chips is:
1 A5 A4 A3 A2 A1 A0 R/W​

At a quick glance at the datasheet there are around 75 valid values (0-69 and 250 - 255) control registers.
four control register values are used as pointers for setting the parameters for each of the 16 LED channels


I suggest that the PICAXE chips can control the PCA9685 16-channel PWM controler chip but as menrioned by Buzby it will take time to read the datasheet and understand and the parameters and values for each control register for aspects such as modes, prescalers, freqeuency as well as the four registers for each LED channel.

Ther have been at least 2 other past threads where the PCA9685 has been mentioned but no indication of working code.
 
Last edited:

xtech007

Senior Member
Great!!

Westaust55, & Buzby thanks for the replies!

To be honest I have read the datasheet few times and its like I get more confused as I go further along.

To see another controller like adruino be able to perform the task challanges me to beleive picaxe can do it too!

I will place an order for the Adafruit hosting the PCA9685 tonight!
All your help would be appreciated!!

Hopefully we can start a snippet library so others can use in the future using this module!

Picaxe I have available are 28x1 and 28x2.

Lets do this!
 
Top