Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Opto Isolated Serial

  1. #1

    Opto Isolated Serial

    Hi all,

    I'm planning to interface a Teensy 3.5 system to a RAMPS 3D printer type motion driver. The motion system uses a 5V Arduino with a 5 Volt Serial TX/RX communication port.

    As the two systems are going to use different wall plugs, different power supplies and long cables, I would like to use an opto-isolated interface with separate GNDs for de level shift (3V -> 5V, 3V <- 5V)

    Is there a ‘bidirectional’ breakout board ready to use, with two channels one in each direction?

    Or can someone recommend me a simple schematic preferably with thru hole components?

    Speed is not critical, a baud rate of 9600 bps would be enough.

    And another question: When a Serial port is idle between transmissions, is the inactive TX pin HIGH or LOW?

    Many thanks

  2. #2
    Junior Member
    Join Date
    May 2018
    Posts
    2
    Hi,

    have you looked at Midi? It uses the serial protocol, runs at 31250 baud and is opto isolated.
    There is a schematic on this page: https://www.pjrc.com/teensy/td_libs_MIDI.html, but there are also boards available.
    This should have all the hardware you need.

  3. #3
    Yes, I was studying those schematics but there are several problems.

    They are unidirectional, they only isolate the Midi input. We must assume that the Midi device at the other end has its own opto-insulated input.

    I do not have 5V in the Teensy system, which seems to be needed to power the 6N138 thing.

    I'm not sure those opto-insolation circuits are non-inverting (I think that Serial communication will stop working if the 1 and 0 are interchanged.)

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,658
    Maybe a HCPL-263L or two HCPL-260L could meet your needs?

    https://www.mouser.com/ProductDetail...nn5S6rIw%3D%3D

    https://www.digikey.com/product-deta...796-ND/1236270

    Most of the older parts are specified for only 5V power, but this one supports 3.3V.

    Of course if you want full duplux bidirectional communication you'll need 2 optocouplers.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,658
    The answer to your last question depends on the signal type.

    Quote Originally Posted by FAlameda View Post
    And another question: When a Serial port is idle between transmissions, is the inactive TX pin HIGH or LOW?
    The signals at Teensy's pins are called called "TTL level" serial. The signal is high when idle.

    RS232 signal levels, commonly used on 9 pin D-sub serial port connectors have higher voltage and the opposite polarity. Typically those are -5V to -12V when idle.

  6. #6
    Senior Member
    Join Date
    Apr 2017
    Posts
    115
    Quote Originally Posted by FAlameda View Post
    Yes, I was studying those schematics but there are several problems.

    They are unidirectional, they only isolate the Midi input. We must assume that the Midi device at the other end has its own opto-insulated input.

    I do not have 5V in the Teensy system, which seems to be needed to power the 6N138 thing.

    I'm not sure those opto-insolation circuits are non-inverting (I think that Serial communication will stop working if the 1 and 0 are interchanged.)
    As part of the MIDI spec every input of a device has an opto-isolator, every communication line only needs one opto-isolator so the output line does not have it’s own because when it’s plugged into the input of another device the opto-isolator for that line is thus satisfied. That being said, there is nothing stopping you from having another opto-isolator on the output in conjunction with the input it’s just not strictly necessary.

    As far as I know opto-isolators can be made to invert depending on how you connect the led side of it, but in the case of standard MIDI it is not inverted. Some MIDI circuits may recommend you place a buffer after the opto-isolator and in which case there are inverting and noninverting buffers, so you would either use two inverting or one noninverting buffer for that and again not strictly necessary.

    If you are powering a Teensy from a standard usb then you do have 5v that you can use to power the 6N138, obviously usb is inherently always at or close to 5v so you can solder a pin or wire to VUSB or if you haven’t cut the trace separating them you could use VIN as well.

  7. #7
    Many thanks.

    I will study and try these ideas.

    I thought that this would be a more widespread problem and that someone would have developed a ready-to-use Tindie breakout board.

  8. #8
    I have used these from sparkfun with success; https://www.sparkfun.com/products/9118

    They're pretty self explanatory and I used them with a 3v3 mico and 24v motor driver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •