Optocouplers, what am I doing wrong - Page 1
Forum section: electronics / beginners

author: LapTop006
author_rank: Unknown
timestamp: April 04, 2013, 09:55:49 am
content: I have a circuit using an LTC4151 that needs isolated I2C, and I'm using almost exactly the circuit from theLTC4151 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.

author: Psi
author_rank: Super Contributor
timestamp: April 04, 2013, 10:20:02 am
content: 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.

author: LapTop006
author_rank: Unknown
timestamp: April 04, 2013, 12:04:16 pm
content: 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.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: April 04, 2013, 12:27:40 pm
content: What are some good optos for I2C and SPI?

author: Psi
author_rank: Super Contributor
timestamp: April 04, 2013, 12:35:38 pm
content: Maybe have a look at digital isolators.They're designed for highspeed digital signals.

author: antoniopetito
author_rank: Contributor
timestamp: April 04, 2013, 12:57:56 pm
content: Quote from: HackedFridgeMagnet on April 04, 2013, 12:27:40 pmI 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.

author: c4757p
author_rank: Super Contributor
timestamp: April 04, 2013, 01:29:10 pm
content: Quote from: Psi on April 04, 2013, 12:35:38 pmI 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.

author: duinoeeb
author_rank: Newbie
timestamp: April 04, 2013, 07:01:50 pm
content: Quote from: LapTop006 on April 04, 2013, 09:55:49 amI'm a complete hardware gal trying to do this exact same project (LTC4151 with Arduino Mega+Ethernet Shield)....would you mind sharing your code?Quote from: LapTop006 on April 04, 2013, 12:04:16 pmI 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...

author: LapTop006
author_rank: Unknown
timestamp: April 05, 2013, 04:02:51 am
content: 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.

author: LapTop006
author_rank: Unknown
timestamp: April 09, 2013, 01:42:44 pm
content: 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.

author: LapTop006
author_rank: Unknown
timestamp: April 12, 2013, 09:12:32 am
content: 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.

author: LapTop006
author_rank: Unknown
timestamp: April 16, 2013, 05:41:50 am
content: Quote from: LapTop006 on April 12, 2013, 09:12:32 amNope. 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.