2 coil latching relay with an arduino

Discussion in 'The Projects Forum' started by Emma Ponting, Feb 21, 2018.

  1. Emma Ponting

    Thread Starter New Member

    Feb 21, 2018
    5
    0
    Hi,

    We are working on a project where accelerometor data from an arduino is used to turn off the power of a motorised wheelchair when the acceleration goes over a certain threshold.

    The wheelchair runs off of two 12v batteries so we have a latching relay (https://uk.rs-online.com/web/p/latching-relays/6996020/) for use in power applications. We need it to work so that when the accelerometer data is above the threshold the relay switches turning the power off and stays latched in that position until a push button is pressed by the user to switch the relay again so the power will be connected again.

    The arduino is an arduino 101.

    Any help/circuit designs would be greatly appreciated.
     
  2. ericgibbs

    Moderator

    Jan 29, 2010
    8,561
    1,729
    hi Emma,
    Welcome to AAC.
    Have you considered using a 'regular' type relay, that is controlled by the Arduino program.?
    Rather than a latching type relay.
    E
     
  3. crutschow

    Expert

    Mar 14, 2008
    23,130
    6,860
    That relay has two coils.
    You momentarily power one coil to latch the relay, and the other coil to reset the relay.
    What else do you need to know about doing that?
     
  4. Emma Ponting

    Thread Starter New Member

    Feb 21, 2018
    5
    0

    Hi Eric,

    we were advised that a latching relay would be the appropriate one so that is what we have bought, however it is within our budget to buy a regular type relay if that would be the better option?

    thanks
     
  5. Emma Ponting

    Thread Starter New Member

    Feb 21, 2018
    5
    0
    It may seem really simple however we are not electronics experts haha. I understand how a latching relay works, the question was more about what other components may be needed in the circuit in order for it to function and deal with the large power coming from the wheelchairs batteries. I've seen similarish projects on AAC and they have used transistors, optocouplers etc.

    Any help would be amazing.
     
  6. Raymond Genovese

    Well-Known Member

    Mar 5, 2016
    1,643
    990
    Hi @Emma Ponting and welcome to the Forum.

    What you want to do is not terribly complicated and there are different ways to do it. I am taking as a given that you have settled on the relay. So, a couple of things to give you a better idea of how you can implement the solution.

    The 101 is, basically a 3V board. The GPIO (the ports that you will be turning on and off in software to turn on and off the two relay coils) are 5V tolerant, but they are 3V output high.

    The 101 ports can source (or sink I believe) ~ 7mA.

    The relay coils(s) that you are using are 5V and require 40mA to operate.

    So you need to have the 3V output of the 101 I/O pin turn on the 5V relay coil and the relay will switch the 12v (@ whatever current) of the WC battery operated motor.

    One way (and I stress that it is only one way) is to have the 101 I/O port bit drive the LED of a 6N139 optoisolator. You would need a resistor attached to limit the current to about 2-4 mA.

    Edited a third time: removed my misunderstanding about power dissipation with an optoisolator because it would have confused the OP even more :). You can uses one in this case - see https://forum.allaboutcircuits.com/threads/how-to-calculate-output-collector-power-dissipation-optoisolator.145853/
    for that discussion.

    That is one very simple and no-frills way of doing this, it is NOT the only way.

    I assume that you choose the 101 because of the on board IMU. I really like that board and have used it in several BLE projects. If you don't know, however, they have been discontinued by Intel. I'm sure that there are plenty around - if you are near a Microcenter, they have been selling them for $19.19 (I missed out on that, or I would have picked up another one).

    Edited again:
    I have used the circuit below with a motor, although not with a relay - it should also work, (but needs to be tested) if you don't want to bother with the optoisolator. Note, I am showing only one relay coil being driven.

    relay driver.jpg
     
    Last edited: Feb 22, 2018
  7. crutschow

    Expert

    Mar 14, 2008
    23,130
    6,860
    That 200mW is dissipated in the relay, not the opto.
    The opto is just acting as a switch with little dissipation when on (assuming it can switch 40mA).
     
    be80be likes this.
  8. Raymond Genovese

    Well-Known Member

    Mar 5, 2016
    1,643
    990
    Well, here is what my thinking is behind my comment....

    The relay coil wants 40 mA @ 5v

    I'm looking at 2 specs for the 6n139 https://www.mouser.com/ds/2/239/6N138S-TA1-1149909.pdf

    High Output Current - 60 mA and also Average Output Current = 50 mA (Max) - so, yes the NPN can switch the 40 mA relay coil.

    BUT
    Output Collector Power Dissipation = 100 mA (MAX)

    40 mA @ 5V = 200 mW - right? That exceeds the max Po.

    Where is my understanding running amiss?
     
  9. ebeowulf17

    AAC Fanatic!

    Aug 12, 2014
    2,934
    641
    The dissipation of the opto is the current through the opto times the voltage DROPPED by the opto. Presumably the opto presents fairly low resistance when operated properly, so most of the voltage is dropped across the relay and only a little voltage is dropped across the opto.

    If, for example, the opto was dropping 0.5V, that would leave 4.5V across the relay. You would then have 20mW opto dissipation and 180mW relay dissipation.

    I have no idea what a real figure for the opto drop would be. Don't have time to get into the datasheet right now. It should appear as either a voltage (like transistor Vce specs) or a resistance (like MOSFET Rds-on specs.)
     
    be80be likes this.
  10. Raymond Genovese

    Well-Known Member

    Mar 5, 2016
    1,643
    990
    @ebeowulf17 Thanks for responding. I'm asking about this as a seperate thread because I would like to understand a little better.
     
    ebeowulf17 likes this.
  11. Emma Ponting

    Thread Starter New Member

    Feb 21, 2018
    5
    0

    Thank you so much for taking the time to do this! Will have a go with that circuit.
     
  12. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,080
    2,287
    Two questions:

    1. What is the peak *current* drawn by the wheelchair motor? I think your relay might be underrated for this application.

    2. What is the max. output current an arduino can source or sink?

    ak
     
  13. Raymond Genovese

    Well-Known Member

    Mar 5, 2016
    1,643
    990
    You are most welcome and I hope it is helpful. Also, check out the thread here https://forum.allaboutcircuits.com/...lector-power-dissipation-optoisolator.145853/ where there is another circuit that might be relevant to what you want to do as well as discussion by folks here with much greater expertise in these matters.
     
  14. ebeowulf17

    AAC Fanatic!

    Aug 12, 2014
    2,934
    641
    Obviously we'll need the thread starter to answer question 1, but I've got question 2.

    According to the Arduino website, the Arduino101 can source/sink up to 20mA per pin. They don't mention the package total on the main page - I'm guessing it's similar to others where you can do 20mA on any given pin, but only 40 or 50mA at a time through all pins combined. That would need to be confirmed if other pins are also carrying significant loads at the same time.
     
  15. Raymond Genovese

    Well-Known Member

    Mar 5, 2016
    1,643
    990
    I have programmed these boards many times. The drive characteristics of the GPIO have never been completely clear to me. Yes, I have also seen the 20 mA figure, as you stated. I can also see other places where a much lower figure has been given which is why I said 7mA in my first post in the thread. See, here for example https://gzhls.at/blob/ldb/f/0/7/2/3ef38526b507439e9012e5b2988f989c2785.pdf

    Between the Curie datasheet here https://www.intel.com/content/dam/s...ndkits/curie/intel-curie-module-datasheet.pdf and the schematic here https://www.arduino.cc/en/uploads/Main/Arduino101-REV4Schematic.pdf I suppose it could be clearly understood. But, the drive circuit using a MOSFET that I posted in this thread as well as the optoisolator circuit posted here https://forum.allaboutcircuits.com/...lector-power-dissipation-optoisolator.145853/ will both operate the relay directly from the GPIO on the 101.

    I certainly would not try to attempt to turn on the relay directly from the I/O in any event. In addition to not being able to source or sink 40mA, the I/O is 3.3v and the relay coil is 5v.
     
  16. ebeowulf17

    AAC Fanatic!

    Aug 12, 2014
    2,934
    641
    Wow! The GPIO specs in the Intel Curie datasheet are baffling to me. I may have to start a separate thread on that to get some help understanding:
    https://www.intel.com/content/dam/s...ndkits/curie/intel-curie-module-datasheet.pdf

    Regardless, it looks like the Arduino101 uses level translator chips on all GPIO, so it's not the current capacity of the Curie pins that matters anyway - it's the capabilities of the LSF0108:
    http://www.ti.com/lit/ds/sdls966g/sdls966g.pdf

    That datasheet also isn't as clear as I'd hoped in terms of current limits, but it includes lines like "128mA continuous channel current" which makes me think the 20mA per pin claim is probably reasonable, as long as you don't do it on every pin at once!

    More to the point thought, of course you're right. We wouldn't want to run the relay directly from the 101 regardless, and the 101 will have no trouble at all delivering enough current for the input of most go-betweens (BJT, MOSFET, opto...) so probably nothing to worry about there.
     
Loading...