Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#354380 - 23/08/2012 10:04 RaspPi and I2C and port expander - LED strip controller
LittleBlueThing
addict

Registered: 11/01/2002
Posts: 612
Loc: Reading, UK
So I have a RaspPi and it has an I2C exposed.

I would like to do some PWM on 8 sets of LED strips each is 0.5-2A @ 12V

I bought a bunch of MOSFETs rated 30W and some optoisolators (since the LEDs are on a different PSU to the RaspPi)

optoisolator: http://uk.farnell.com/jsp/search/productdetail.jsp?CMP=i-ddd7-00001003&sku=1045424

Now what I need is 8 i/o pins .. hence
http://www.farnell.com/datasheets/12170.pdf

I was planning to connect the pins directly from the io expander to the optoisolator. And on the remote side use the optoisolator to connect the MOSFET to +ve (see lower diagram here: http://letsmakerobots.com/files/userpics/u1533/BJT_vs_FET.jpg )

Now the question is: do I need any supplementary circuitry or do I just join the dots?


Edited by LittleBlueThing (23/08/2012 10:04)
_________________________
LittleBlueThing Running twin 30's

Top
#354386 - 23/08/2012 12:21 Re: RaspPi and I2C and port expander - LED strip controller [Re: LittleBlueThing]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
That's the wrong part, why don't you pick an IO expander than natively supports PWM?

We use that very part for IO expansion on some products and I wouldn't really want to be trying to do PWM over i2c.

Adrian

Top
#354388 - 23/08/2012 12:52 Re: RaspPi and I2C and port expander - LED strip controller [Re: sn00p]
LittleBlueThing
addict

Registered: 11/01/2002
Posts: 612
Loc: Reading, UK
Originally Posted By: sn00p
That's the wrong part, why don't you pick an IO expander than natively supports PWM?


Because I'm clueless - this is the first time I've even glanced at i2c or anything like it smile

The basic schematic is

RPI ==(i2c)==> board with pwm ==(20m_10core_cable)==> psu+board_with_MOSFET ==> 8x LED strips

What part would you suggest?
_________________________
LittleBlueThing Running twin 30's

Top
#354390 - 23/08/2012 13:02 Re: RaspPi and I2C and port expander - LED strip controller [Re: LittleBlueThing]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Originally Posted By: LittleBlueThing
Originally Posted By: sn00p
That's the wrong part, why don't you pick an IO expander than natively supports PWM?


Because I'm clueless - this is the first time I've even glanced at i2c or anything like it smile

The basic schematic is

RPI ==(i2c)==> board with pwm ==(20m_10core_cable)==> psu+board_with_MOSFET ==> 8x LED strips

What part would you suggest?


Ahh!

Something like this:

http://www.onsemi.com/pub_link/Collateral/CAT9532-D.PDF

It's available from farnell and it does the PWM for you, you just set the duty cycle registers and it does the rest.

Adrian

Top
#354391 - 23/08/2012 13:07 Re: RaspPi and I2C and port expander - LED strip controller [Re: sn00p]
LittleBlueThing
addict

Registered: 11/01/2002
Posts: 612
Loc: Reading, UK
excellent - thankyou.

Half the battle is knowing what's possible/available smile
_________________________
LittleBlueThing Running twin 30's

Top
#354392 - 23/08/2012 13:32 Re: RaspPi and I2C and port expander - LED strip controller [Re: LittleBlueThing]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Actually, that's probably not quite the part you want, all your leds would be dimmed to the same value....let me find another part.

Adrian

Edit:

This is the beast, infact, I think we use this too!

http://www.nxp.com/documents/data_sheet/PCA9685.pdf


Edited by sn00p (23/08/2012 13:33)

Top
#354395 - 23/08/2012 16:03 Re: RaspPi and I2C and port expander - LED strip controller [Re: sn00p]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
I checked, we use the PCA 9635 and beside the datasheet being wrong about the open drain state of the pins, these chips are pretty darned good.

You also don't need opto-isolators, just common the grounds between the 2 power supplies.

Adrian

Top
#354402 - 23/08/2012 20:43 Re: RaspPi and I2C and port expander - LED strip controller [Re: sn00p]
LittleBlueThing
addict

Registered: 11/01/2002
Posts: 612
Loc: Reading, UK
OK, thanks for that Adrian - I also found an adaptor
http://uk.farnell.com/jsp/search/productdetail.jsp?sku=1426185
so I can connect it to my stripoard (yes, stripboard smile )

Didn't realise about the isolators - the external psu is a 12v one and the internal board looks like it's purely going to run from the RasPi 5V so I thought they were needed.
_________________________
LittleBlueThing Running twin 30's

Top
#354414 - 24/08/2012 04:34 Re: RaspPi and I2C and port expander - LED strip controller [Re: LittleBlueThing]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Originally Posted By: LittleBlueThing

Didn't realise about the isolators - the external psu is a 12v one and the internal board looks like it's purely going to run from the RasPi 5V so I thought they were needed.


We would normally just glue the chip upside down onto the stripboard and then solder wires from the legs to the board - although now we have no need as we'd just get a protototype PCB made and use our "virtual" stencil printer and pick and place machine to do the hard work!

It sounds obvious, but you only need opto-isolators when you absolutely need isolation. wink

For example, on some boards we use then on external facing connectors (both inputs and outputs) where we can't guarantee that the end user is going to do something silly, like instead of connecting a switch they hookup live and neutral of 400V AC! In that case, it would be bad.

We also have a system which requires 2 separate 5V rails specifically to prevent current flow from one to the other, so we have to use a DC-DC convertor to create a second 5V supply and then use opto-isolators to get signals from one side the other. If we were to short the grounds in this case, then we create a common path from either of the supply rails, which in our case means that the circuit won't work.

Btw, our led driver board is here (L1):

http://www.kestrelradarsensors.com/products.php

Adrian

Top