2-bit I2C LED dimmer,PCA9530DP

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
Harry Tuttle
Posts: 27
Joined: Sat Aug 01, 2009 3:15 pm
Has thanked: 2 times
Been thanked: 10 times
Contact:

2-bit I2C LED dimmer,PCA9530DP

Post by Harry Tuttle »

2-bit I2C LED dimmer,PCA9530DP

I don’t know if this is of any interest to anyone.

The PCA9530DP can be used as an input or output. I am only using outputs in this example. The two outputs can be a simple on/off or pulse width modulation. The device has six registers

0 Input - the state of the two I/Os
1 Frequency prescaler 0
2 PWM register 0
3 Frequency prescaler 1
4 PWM register 1
5 LED selector

See Data sheet for details
http://docs-europe.origin.electrocompon ... b4cb65.pdf


Connection

Use two elements of a common anode tri-colour LED with two resistors or two separate LEDs again with current limiting resistors. I suppose with transistors connected motor loads could be driven.

The PCA9530DP I purchased was in a surface mount TSSOP package which I soldered to a DIL8 adapter ( a bit fiddly but possible ) and plugged into to a breadboard.

Use 1800 ohm pull up resistors on the two I2C lines.

Flowcode

The code is intended for a 16f877a.

Output 0 On
Output 0 and 1 On
Output 1 On
All Off
Fade Out put 1 from Off to On
Fade Output 0 from Off to On and Out put 1 from On to Off
Fade Output 1 from Off to On and Out put 0 from On to Off
Fade Out put 1 from On to Off
2-bit_I2C_LEDdimmer_PCA9530DP.fcf
(13.19 KiB) Downloaded 579 times

darkmagic35
Posts: 5
Joined: Sun Sep 26, 2010 11:12 am
Has thanked: 2 times
Contact:

Re: 2-bit I2C LED dimmer,PCA9530DP

Post by darkmagic35 »

Hello,

I'm interested in the LED driver PCA9685 (something like PCA9530DP, PCA9685 is 16-channel, 12-bit PWM driver, datasheet). As a master I2C device I want to you some PIC18F, too. Can you show me the circuit of 2-bit dimmer?
I´m not sure about pull-up rezistors on I2C lines - can you help me witch the schematic? I never use I2C..

Thank you very much :)
Attachments
PCA9685.jpg
PCA9685.jpg (55.69 KiB) Viewed 5517 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 2-bit I2C LED dimmer,PCA9530DP

Post by Benj »

Hello,

The SDA and SCL lines will each need their own resistor between the line and the positive supply which will be 5V or 3.3V depending on your system microcontroller voltage. The resistors should be around 4.7K though as high as 10K or even 100K should also be fine. If in doubt then the manufacturers datasheet for your I2C device should give some example values for the pull up resistors. I have also seen some I2C devices that have internal pullup resistors however when this is the case you can normally only have one of these devices on the bus as you should only have one set of pull ups per bus.

Post Reply