Shop OBEX P1 Docs P2 Docs Learn Events
Tri-state current loop circuit.... Need some feedback.. — Parallax Forums

Tri-state current loop circuit.... Need some feedback..

markaericmarkaeric Posts: 282
edited 2011-06-09 22:13 in General Discussion
Hey guys (and gals),

I've been toying with a few solutions to control a remote circuit (<60ft) using minimal cabling and microcontroller pins. What I'm leaning towards now is a 3 state current loop transmission and detection circuit using a single twisted pair and uC pin (see image). The driver is just an OP amp with an additional inverted output (fully differential), and the receiver consists of two opto couplers but wired opposite of each other in relation to the twisted pair (the blue lines.. I know, they don't look twisted to me either).

R1 and R2 form a voltage divider, and their values are the same as R3 and R4 respectively. When the attached microcontroller (in this case a Propeller) is in it's Hi-Z state, the voltage seen at both of the OP amps inputs are the same, so there is no output, thus the optocouplers are neither forward nor reverse biased and it's state can be considered 0. However, when the uC is active high or low, it brings the voltage of the non-inverted input either above or below the voltage seen at the inverted input, allowing the relative voltage on the twisted pairs to switch polarity. The end result is that one of the optocouplers will be in a state of forward conduction, while the other is reverse biased, and this is where the two other states derive from. Well, at least that's my theory, so I hope I'm not making some critical mistake.

Should I have any worries about the effects of one of the opto couplers being reverse biased (as long as I don't exceed it reverse voltage rating) on the transmission line, or will it be practically invisible to the circuit? Any thoughts, or harsh realities is appreciated.

-Mark
800 x 550 - 55K

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-07 09:47
    Wire your opto LEDs in parallel, anode-to-cathode, and use a single current-limiting resistor in series. That way the reverse voltage seen by one will never exceed the forward voltage of the other. Also, be sure to pick an op amp that's characterized for driving a capacitive load (e.g. a long cable). Not all of them can. I'd be more inclined to use an RS485 driver for this than an op amp. It would require another pin from the micro, though: one for current direction and one for drive vs. tri-state.

    -Phil
  • markaericmarkaeric Posts: 282
    edited 2011-06-07 11:42
    I ended up using a single resistor in series with the LEDs in the circuit I slapped together which I thought about after I drew up the schematic. However, I am driving the load from two separate OP amps since I don't have a fully differential device.

    I'm not familiar with rs485 drivers, but I'll certainly take a look at them now. thanks for the suggestions!

    -Mark
  • kwinnkwinn Posts: 8,697
    edited 2011-06-07 17:08
    20mA current loop has been used to send data over distances much greater than 60 feet ( I have seen 800' at 19,200 baud) without resorting to a bidirectional current flow. A single optoisolator was used and the current was either on (20mA) or off (0mA).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-07 17:23
    kwinn,

    He needs both directions, since each direction performs a different function. By using a single pair of wires, he can get A, B, or none. At least, that's my interpretation of the requirements.

    -Phil
  • markaericmarkaeric Posts: 282
    edited 2011-06-07 18:38
    kwinn, Phil is correct. This enables me to have three separate control states for a simple receiving circuit. In my case, the receiving end consists of a SIPO shift register, with one of the control states tied to SCLK and RCLK, and the other control state is tied to both clocks and the serial in. This might not seem that useful, but in my case each output from the SIPO will control a servo, similar to Cannibal Robot's 74HC595 Servo Drive object. Since the servos will be controlled in a sequential order, it's actually desirable to have a control bit shift to each output in succession anyways. I'm hoping to achieve ~1uS pulse width resolution, so I need to make sure I can achieve 1Mbit rate for the current loop circuit.
  • kwinnkwinn Posts: 8,697
    edited 2011-06-07 19:35
    Ah, that makes sense. You may have a bit of a search to find opto isolators that fast. The common variety need pulse widths closer to 50uSec to operate reliably. Good luck with your project.
  • markaericmarkaeric Posts: 282
    edited 2011-06-08 01:57
    kwinn, I don't have any experience with optocouplers, so I might be misunderstanding something, but it looks as though devices with 10Mbit bandwidth are not uncommon. Driving them may be the harder part.
  • kwinnkwinn Posts: 8,697
    edited 2011-06-08 09:21
    markaeric wrote: »
    kwinn, I don't have any experience with optocouplers, so I might be misunderstanding something, but it looks as though devices with 10Mbit bandwidth are not uncommon. Driving them may be the harder part.

    Yes, there are high speed optocouplers available now that will handle your application. I was just warning you that garden variety optos like 4N26-35-36-37-38 will not work at anywhere near those speeds.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-08 09:28
    The higher-speed units typically use photodiodes with a logic output, rather than phototransistors. There are ways to speed the response of phototransistor optos (e.g. cascode connection), but that won't get you into the megabaud region.

    -Phil
  • markaericmarkaeric Posts: 282
    edited 2011-06-08 15:50
    Ah yes, my schematic shows a phototransistor.. It's not the actual part I intend to use, it's just that I didn't want to draw the schematic by hand, and the part was one of the few optocouplers in KiCad's library (no photodiode units).
  • markaericmarkaeric Posts: 282
    edited 2011-06-09 18:05
    D'oh! I always over complicate everything at first. I'm thinking it'll be a lot simpler to use a bjt h-bridge for the driver. And instead of putting the limiting resistors on the receiving end, I'm thinking I could put then on the source and drain of each leg.. Once of the reasons is because of something I read stating that when changing states, many times both transistors on one of the legs are active, causing a temporary short for a fraction of a second. The other reason is that it might reduce the current flowing through the driver in the event of a cable short. I'm wondering if there would be an issue due to cable capacitance and the lack of a current limiting resistor near the optocoupler.

    Phil, I've been thinking a bit about what you said regarding "....the reverse voltage seen by one (opto led) will never exceed the forward voltage of the other. ", but couldn't really understand why. Is it because of a diode's small resistance when it's in forward conduction, or that only it's voltage drop is "visible" at each terminal?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-09 19:09
    When a diode is forward biased, it's voltage is pretty much constant, a characteristic of the diode's PN junction. By putting two diodes in reverse parallel, the reverse voltage seen by one will never exceed the forward voltage seen by the other.

    BTW, a transistor H-bridge only complicates things unnecessarily. As I stated before, an RS485 driver (which is a sort of H-bridge in its own right) is probably the simplest approach. Here's a schematic to guide you:

    attachment.php?attachmentid=82006&d=1307671669

    -Phil
    662 x 308 - 4K
  • markaericmarkaeric Posts: 282
    edited 2011-06-09 22:13
    Thanks for the suggestions and all your help, Phil. I found a few rs485 transceivers that I'm thinking could work nicely.

    -Mark
Sign In or Register to comment.