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

Thread: Teensy 4.1 driving opto relay directly?

  1. #1

    Teensy 4.1 driving opto relay directly?

    I need to drive a dozen 4A opto relays using the Teensy 4.1. I am trying to figure out if I can drive them directly with the Teensy or if I need a transistor in-between.

    The opto relay I am considering is the 4A Omron G3VM-31AR (link below). The spec for this relay says the LED needs a minimum of 1.5v and max of 1.8v. If I use a 200 ohm resistor in line I am at 1.55v and I measure a draw of 7ma on the gpio pin. So, this seems like I am in range, but if I have a dozen of these on at once will I be pulling too much power?

    As a test of science, I also hooked the relay up directly without the current limiting resistor -- at 3.3v that relay draws 58ma, overpowering both the Teensy and the relay.

    Any thoughts on using this relay in bulk would be appreciated. Also, is there a better opto relay that you would recommend with lower resistance that can still serve up 4A on the output side? I'd prefer not to use a FET, as I need the extra isolation.

    Thanks!

    OMRON G3VM-31AR: https://www.mouser.com/ProductDetail...rrencycode=USD

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,042
    The datasheet mentions 5mA a lot in the specs, which is a tad high for T4, but ought to work at that level. I wouldn't try to push it harder
    per pin. Never connect an LED without limiting resistor to delicate CMOS outputs like this, you risk frying the pad driver on the chip - you
    don't need to "test science" like that!

    What are you trying to switch?

  3. #3
    I am switching some 24V 2A solenoid valves, but handling volatile gases/fluids, so I would like isolation and prefer not to run hot positive wires back to grounded switched MOSFETs, hence the opto relay.

    I have samples of the relays. When I hook them up with a 200 ohm resistor (drop forward voltage to near minimum) I am drawing 7ma from the GPIO pin. Is that too hot for the T4?

    Thanks!

  4. #4
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,042
    T4 GPIO pins programmable output drive is from 1mA to 4mA... That's why I said 5mA is a tad high.
    I'm fairly sure it can handle 5mA with some voltage droop, but I wouldn't want to risk heavily overloading
    the pin drivers - remember self-heating in a FET driver goes with current-squared. Since the datasheet
    for the opto device shows 5mA all over the place, that suggests that using 4--5mA drive level is going to
    work fine.

  5. #5
    Quote Originally Posted by MarkT View Post
    T4 GPIO pins programmable output drive is from 1mA to 4mA... That's why I said 5mA is a tad high.
    I'm fairly sure it can handle 5mA with some voltage droop, but I wouldn't want to risk heavily overloading
    the pin drivers - remember self-heating in a FET driver goes with current-squared. Since the datasheet
    for the opto device shows 5mA all over the place, that suggests that using 4--5mA drive level is going to
    work fine.
    Thanks Mark. Given that I have a dozen of these and the duty cycle could be high, I will plan on using something in-between the T4 and the Opto to be safe. I could use a simple NPN transistor, but I am considering a Darlington array to provide the extra switching power for a dozen gpios. This application doesn't need much additional power. Anyone have a better "go to" switch for low voltage/amperage components connected to gpios?

  6. #6
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    249
    If speed is not paramount you could consider a PCF8574 I2C 8 bit expansion chip. The current per pin is 25ma with a total of 100ma for the package.
    There are also 16bit versions viz MCP23017. This latter chip being newer is faster (100kHz, 400kHz and 1.7mHz).
    They are quite cheap as well.
    My reading of the datasheet indicates that there are 19 clock pulses per byte o/p. So it would take 50us (rounded 19 up to 20) to output one byte (or to change 1 bit as a complete byte has to be output) at 400kHz. The PCF8574 is limited to 100kHz, although there may be a newer faster 8 bit device.

  7. #7
    Senior Member
    Join Date
    Dec 2016
    Location
    Wales
    Posts
    106
    BriCom'sp suggestion of a buffer chip would work just fine, or the simplest thing would be to use a MOSFET. Assuming you're using this for some kind of slow switching rather than signalling.
    Referring to the pins as noted in the datasheet, connect pin 1 to 3v3, then a resistor in series with a MOSFET between pin 2 and ground.

    Depends on your setup and what you're going to find easier!

  8. #8
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    249
    ...or you could use something like a TSX080E, like this.
    Plenty of current to drive the opto-isolators and relatively cheap.

  9. #9
    Thanks BriComp. I hadn't actually thought about this as a logic level issue, but that could also work. I know a MOSFET or even an npn transistor will work, I was just looking for something more creative. I just tested a darlington array and that looks like it also might be a good solution to switch the low side (like an npn or mosfet), but in a more compact package.

  10. #10
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    249
    Quote Originally Posted by TeensyDigital View Post
    Thanks BriComp. I hadn't actually thought about this as a logic level issue, but that could also work. I know a MOSFET or even an npn transistor will work, I was just looking for something more creative. I just tested a darlington array and that looks like it also might be a good solution to switch the low side (like an npn or mosfet), but in a more compact package.
    Yes, 18 pins for 8 lanes instead of 20 pins, but also cheaper.

Posting Permissions

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