User avatar
howroyd
Posts: 39
Joined: Thu Aug 02, 2012 1:41 pm
Location: Loughborough
Contact: Website

I2C PWM Expander DIP

Mon Oct 10, 2016 3:49 pm

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

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 4:27 pm

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).
Doug.
Building Management Systems Engineer.

User avatar
joan
Posts: 14876
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 4:46 pm

You could always provide the PWM from the Pi GPIO (if you have 8 spare).

User avatar
howroyd
Posts: 39
Joined: Thu Aug 02, 2012 1:41 pm
Location: Loughborough
Contact: Website

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 7:11 pm

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

User avatar
joan
Posts: 14876
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 7:22 pm

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?

User avatar
howroyd
Posts: 39
Joined: Thu Aug 02, 2012 1:41 pm
Location: Loughborough
Contact: Website

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 8:02 pm

Software. I was under the impression that the pi only has one hardware pwm pin?

User avatar
rpdom
Posts: 16964
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 8:10 pm

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.

User avatar
howroyd
Posts: 39
Joined: Thu Aug 02, 2012 1:41 pm
Location: Loughborough
Contact: Website

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 8:11 pm

Cool, thanks. I need 8 :(

User avatar
joan
Posts: 14876
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 8:32 pm

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).

User avatar
howroyd
Posts: 39
Joined: Thu Aug 02, 2012 1:41 pm
Location: Loughborough
Contact: Website

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 8:39 pm

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

User avatar
joan
Posts: 14876
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C PWM Expander DIP

Mon Oct 10, 2016 8:56 pm

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).

Return to “Interfacing (DSI, CSI, I2C, etc.)”