Author Topic: Optocouplers, what am I doing wrong  (Read 6440 times)

0 Members and 1 Guest are viewing this topic.

Offline LapTop006Topic starter

  • Supporter
  • ****
  • Posts: 467
  • Country: au
Optocouplers, what am I doing wrong
« on: April 04, 2013, 09:55:49 am »
I have a circuit using an LTC4151 that needs isolated I2C, and I'm using almost exactly the circuit from the LTC4151 datasheet (see fig9, but not having any luck with the opto's.

Driver is an Arduino.

Scope trace attached (sorry for the photo, don't have a usable USB key to hand)

I'm not quite sure what's happening here.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9941
  • Country: nz
Re: Optocouplers, what am I doing wrong
« Reply #1 on: April 04, 2013, 10:20:02 am »
What optocoupler IC are you using exactly.
They're not all created equal.

From the pic it looks like your opto transistor isn't turning off fast enough.
If your opto has an output pin for the transistor base you could try a resistor to ground, maybe 20k.

However, it isn't turning on very fast either so there's probably something more serious going on.
« Last Edit: April 04, 2013, 10:29:49 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline LapTop006Topic starter

  • Supporter
  • ****
  • Posts: 467
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #2 on: April 04, 2013, 12:04:16 pm »
That was my obvious thought, I'm using the Fairchild MOCD207M's suggested in the datasheet.

... and now that I re-read the LTC4151 datasheet more closely it says 1.5kHz max rate due to slew rate limits of those optos.

I've lowered the I2C rate to the AVR's minimum and the signal now looks perfect coming out of the optos, now just need to figure out why it isn't responding.
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 2028
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #3 on: April 04, 2013, 12:27:40 pm »
What are some good optos for I2C and SPI?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9941
  • Country: nz
Re: Optocouplers, what am I doing wrong
« Reply #4 on: April 04, 2013, 12:35:38 pm »
Maybe have a look at digital isolators.
They're designed for highspeed digital signals.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline antoniopetito

  • Contributor
  • Posts: 10
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #5 on: April 04, 2013, 12:57:56 pm »
What are some good optos for I2C and SPI?

I have used Fairchild HCPL2630 logic gate optocouplers for the CNC break out board I'm currently using. Apparently they are good for 10MBit/s but maybe overkill.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: Optocouplers, what am I doing wrong
« Reply #6 on: April 04, 2013, 01:29:10 pm »
Maybe have a look at digital isolators.
They're designed for highspeed digital signals.

I was just going to say this. I just used Si8421 to isolate a high speed UART link in a one-off board. It's a "digital isolator" (RF coupler) with a full logic-in, logic-out interface (no need to know anything about how to drive it, that's all internal). For the cost of a $1 chip and a couple decoupling caps you get a fully isolated, 150 Mbps link with no design work whatsoever.

Si8421 isn't directly suitable for a bus - no open collector outputs or anything - but it's relatively easily converted for SPI with a small amount of external "logic" (discrete diodes or transistors should do). Alternately there's a separate SPI version, but I don't think it's worth the money. I2C is harder, but for that there's the Si860x series, specifically designed for I2C.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline duinoeeb

  • Newbie
  • Posts: 1
Re: Optocouplers, what am I doing wrong
« Reply #7 on: April 04, 2013, 07:01:50 pm »
I have a circuit using an LTC4151 that needs isolated I2C, and I'm using almost exactly the circuit from the LTC4151 datasheet (see fig9, but not having any luck with the opto's.

Driver is an Arduino.

I'm a complete hardware gal trying to do this exact same project (LTC4151 with Arduino Mega+Ethernet Shield)....would you mind sharing your code?

That was my obvious thought, I'm using the Fairchild MOCD207M's suggested in the datasheet.

... and now that I re-read the LTC4151 datasheet more closely it says 1.5kHz max rate due to slew rate limits of those optos.

I've lowered the I2C rate to the AVR's minimum and the signal now looks perfect coming out of the optos, now just need to figure out why it isn't responding.


I used the same optoisolator, so I'm curious if you plan to continue to debug, or switch to one of the other ICs suggested?

BTW - please be gentle - this is my first forum, first post... :-[
 

Offline LapTop006Topic starter

  • Supporter
  • ****
  • Posts: 467
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #8 on: April 05, 2013, 04:02:51 am »
Once I get some working code I'll share it.

To set the I2C to minimum rate, once you've done Wire.begin:

  // Prescaler:
  _SFR_BYTE(TWSR) |= _BV(TWPS0);
  _SFR_BYTE(TWSR) |= _BV(TWPS1);
  // Rate:
  TWBR = 255;


Currently I need to work on what I'm actually sending to the bus as it doesn't seem to match what (apparently) working code for that chip sends.
 

Offline LapTop006Topic starter

  • Supporter
  • ****
  • Posts: 467
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #9 on: April 09, 2013, 01:42:44 pm »
The general consensus seems to be to give the Wire library a miss, especially for SMbus parts (Which the LTC4151 is), I've migrated to a version simply title TWI_hack which has the parts needed (notably a way to read with NAK, and waiting for ACK's on writes).

I think I'm closer, but still not getting anything useful from the chip, I tried knocking one up without optos, but I only have LTC4151-2's, which have the split output with SDAO inverted, so I can't just tie it with SDAI and have a working bus.

Next step is to go back to the isolated one and see if I can't get something out SDAO, even if I can't sustain full communications. I've also ordered some Wii nunchuck sockets so I can play with a component more well known.
 

Offline LapTop006Topic starter

  • Supporter
  • ****
  • Posts: 467
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #10 on: April 12, 2013, 09:12:32 am »
Also in the "stupid mistakes" bucket, it helps to order the right versions of the chip, sure enough I should be using -1's for phototransistors, -2 is for higher speed optocouplers that invert their inputs.

On the plus side another project worked first try tonight.
 

Offline LapTop006Topic starter

  • Supporter
  • ****
  • Posts: 467
  • Country: au
Re: Optocouplers, what am I doing wrong
« Reply #11 on: April 16, 2013, 05:41:50 am »
Also in the "stupid mistakes" bucket, it helps to order the right versions of the chip, sure enough I should be using -1's for phototransistors, -2 is for higher speed optocouplers that invert their inputs.

Nope. I am using -1's, which have the inverting output, -2's are simply the larger package version of the normal LTC4151. My circuit seems correct, possibly need external pull-ups not the AVR's internal ones, but that shouldn't be that big of a difference.

Back to investigating with the scope.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf