Page 1 of 1

I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 3:49 pm
by howroyd
Hi all

I've spent hours looking for a DIP chip I can use on a custom circuit (breadboard) to give me 8 (or more) PWM channels for driving some MOSFETs hooked up to LED strings and fans.

Needs to have each channel controllable over I2C, resolution isn't overly important, min of 4bit.
3V3 logic level preferably to save the need for a LLC.
DIP or similar rather than surface mount for breadboard prototyping as a single chip rather than a full board like the adafruit one. https://www.adafruit.com/product/815

Thanks in advance

Simon

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 4:27 pm
by BMS Doug
I had a good google and couldn't find much out there, how about an ATMEGA328 (basis of arduino) programmed as an i2c slave?

Alternatively you could attach a PCA9635 (the brains of adafruits pwm board) onto a smd to dip converter (which still requires smd soldering, which is the bit i think you are trying to avoid).

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 4:46 pm
by joan
You could always provide the PWM from the Pi GPIO (if you have 8 spare).

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 7:11 pm
by howroyd
The Pi GPIO PWM isn't fast enough (tried it) so you get a really irritating shimmer on the LEDs.

I'm not avoiding SMD soldering, I can do that fine but if I am going to do that I may as well design and etch a proper PCB which I am trying to avoid. Id like to use a breadboard HAT ultimately to keep things cheap & simple. (there will always be the odd thing wrong with a custom PCB from experience!)

An SMD to DIP sounds like the only option, or use a DIP chip with SPI (which is rubbish compared to I2C).

I'll keep hunting and if I find anything I'll post here.

Cheers

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 7:22 pm
by joan
howroyd wrote:The Pi GPIO PWM isn't fast enough (tried it) so you get a really irritating shimmer on the LEDs.
...
Were you using software or hardware timed PWM?

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 8:02 pm
by howroyd
Software. I was under the impression that the pi only has one hardware pwm pin?

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 8:10 pm
by rpdom
howroyd wrote:Software. I was under the impression that the pi only has one hardware pwm pin?
Only two hardware PWM pins on all the Pis with 40 pin GPIO connectors. There was only one available on the early models with the 26 pin connectors.

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 8:11 pm
by howroyd
Cool, thanks. I need 8 :(

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 8:32 pm
by joan
howroyd wrote:Cool, thanks. I need 8 :(
What frequency?

There are several modules which provide hardware timed PWM on all user accessible GPIO.

E.g. my pigpio provides Arduino like PWM on all GPIO (default 250 steps between off and fully on, 800Hz).

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 8:39 pm
by howroyd
Really? Which module were you using? I only managed to get about 200Hz which was shimmery but every time the I2C fired or the network got heavy it dropped noticeably to the eye, so seemingly a variable frequency.

Arduino is somewhere near 500Hz ish I think which I did on a Nano and it worked well, and was stable even under load.

Using the Nano as a slave is my current setup but it isn't the cheapest or simplest option so looking to clean it up a bit. I guess I could just get an atmega328 and flash it with AtmelStudio

Re: I2C PWM Expander DIP

Posted: Mon Oct 10, 2016 8:56 pm
by joan
C http://abyz.co.uk/rpi/pigpio/cif.html#gpioPWM

Python http://abyz.co.uk/rpi/pigpio/python.htm ... _dutycycle

Command line http://abyz.co.uk/rpi/pigpio/pigs.html#P/PWM

Python and command line need the pigpio daemon to be running (sudo pigpiod).