Shop OBEX P1 Docs P2 Docs Learn Events
Opto and grounds — Parallax Forums

Opto and grounds

JavalinJavalin Posts: 892
edited 2007-12-03 19:20 in General Discussion
Hello All,

If I have an analog signal (0-5v) comming into a propeller and I want to opto-isolate to not have a ground connection.

How does the propeller see the voltage's?· I.e.· If my incomming signal is 3v (for example) and the grounds are different between the propeller batt and the car battery - wouldn't the propeller see 2.5v for example if there was a 0.5v difference in the grounds?

I was looking at the 6N138's.· As used in http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv122.pdf

??

Thanks

James

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2007-12-03 14:41
    HI Javalin,

    I've attached a pic of how I use a 4N35 for a stamp.
    I'm using it in the opposite direction from your intention, but basically, the sensor that's sending the signal has to be able to power the LED.

    Check the forward biasing current for the LED in the opto you want to use. Then take the signal voltage and divide by the forward current. This will be the rough size of the resistor you'll need in series with the LED pin so as not to blow the LED when you first hook it up.

    From the Prop side (or stamp), you pull the collector side of the opto-transistor to Vcc (3.5V I think on a Prop) through a resistor that will not pull too much current through the Prop pin (in the BS2-world, the pins can handle 20mA sinking and 35mA sourcing so I used a 1k resistor which worked out to 5mA), then tie the emitter to ground. Connect your PRop pin to between the resistor and the collector and you'll look for lows on this pin.

    BAsically, when there's signal coming down the pipe, the LED will light, which will case the transistor to conduct. So 5V will go through the resistor to ground. Your Prop-Pin will, in effect, be connected to ground as well (there will be some voltage, but should be below logic threshold) so it should see a 0 or low on that pin.
    When there is now signal 'lighting' the LED, your prop-pin is basically connected to Vcc and should see a 1 or high on that pin.

    Hope that helps!
    Cheers

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
    1024 x 820 - 77K
  • JavalinJavalin Posts: 892
    edited 2007-12-03 17:00
    >Your Prop-Pin will, in effect, be connected to ground as well (there will be some voltage, but should be below logic threshold) so it should see a 0 or low on that pin.
    When there is now signal 'lighting' the LED, your prop-pin is basically connected to Vcc and should see a 1 or high on that pin.

    So is an opto-coupler primarily designed for digital signals then? A analog voltage into an ADC wouldn't work then?

    James
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-12-03 18:08
    Phototransistors are notoriously temperature sensitive, which will affect an isolator's "current transfer ratio" and, hence, the accuracy of any attempt to use it for analog signal transmission. A better approach would be to do the ADC conversion on the analog side of the isolation barrier and transmit the results across the barrier in digital form.

    -Phil
  • steve_bsteve_b Posts: 1,563
    edited 2007-12-03 18:12
    "So is an opto-coupler primarily designed for digital signals then? A analog voltage into an ADC wouldn't work then?"

    That's right. Once you have enough current to light the LED enough to cause the phototransistor to conduct...well, it conducts! It can't half conduct....I'm sure there's an argument there! [noparse];)[/noparse]

    Phil is right....if you want an analog conversion, go with an AtoD converter.

    A photocell, like the one parallax sells from CDS, changes it's resistance with light levels. There are some neat setups using a 12V lamp on a battery as a voltage indicator (the CDS photocell is put in a box with the lamp and it's resistance is measured with RCTime - although passing a voltage through it could work with an AtoD).

    Cheers

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • JavalinJavalin Posts: 892
    edited 2007-12-03 18:22
    ok - thanks for the information!

    J
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-12-03 19:04
    Javalin,

    Despite the pessimism voiced in my earlier post, if you're hell-bent on providing an isolated analog voltage, there is one thing you could try. Here's a schematic:

    attachment.php?attachmentid=50751

    Both optoisolators should be in the same package. (If this causes a problem on the phototransistor side, due to pin spacing requirements, you could use two singles, perhaps, as long as they were from the same lot and were mounted very close together. The other option would be to use a triple and cut the pins off the middle isolator.)

    The idea behind the circuit is that the current transfer ratios (CTRs) of the two isolators will be nearly identical, since they're from the same lot and subject to the same temperature. Therefore, since the current through both LEDs is the same, the current through R2 will equal the current through R3. Now, the voltage on R3 will equal the input voltage, since the op amp keeps it that way. So, if R2 = R3, the voltage across R2 will also equal the input voltage. (If you wanted the voltage range on R2 to be different from — but proportional to — the input voltage, you could make R2 and R3 unequal.)

    Okay, here are the caveats:
    • Because of slight, but inevitable, process differences between the two isolators, their CTRs may differ slightly, leading to an output voltage that's a little different from the input voltage. You might be able to adjust this by putting a trimming resistor on R3.
    • The op amp needs to have enough output current to drive the LEDs. Otherwise, you could always use a transistor follower to boost the current.
    • The analog output impedance will depend on R2. If it's driving a load, your precision will be compromised, unless you buffer it with an op amp.
    If you try this scheme, let us know how it works out!

    -Phil
    593 x 380 - 4K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-03 19:11
  • JavalinJavalin Posts: 892
    edited 2007-12-03 19:20
    Thanks!

    Phil - thanks for the effort to post that - interesting.

    Based on the feedback here - I think i'll pass on the use of opto in the circuit. I was keen to avoid picking up (a dirty'ish) ground from the car battery - but looks like i'll stick to having too.

    J
Sign In or Register to comment.