High to Low or Low to High Detection with Reset.

Discussion in 'Analog & Mixed-Signal Design' started by JonKon, Oct 31, 2017.

  1. JonKon

    Thread Starter New Member

    Oct 31, 2017
    3
    0
    Hello everyone.

    I am a Mechanical engineer trying to figure out this electricity thing!

    Anyways the characteristics of the circuit I am trying to design are as follows.

    12v
    I have a magnetic field switch as an input.
    I have a momentary push button.
    And I am trying to turn on a light.

    The kicker is I want the light to turn on and stay on whenever the mag switch goes from low to high or high to low. Then I would like to have the push button turn the light off no matter what state the mag switch is in. I would like the light to stay off until the mag switch changes state again.

    I have attached a copy of a relay diagram that should do what I am trying to do but I would like to simplify it with logic gates and have been racking my brain to hard on how to get it done.

    For now this a a pet project but eventually I may get some PCBs made for this.

    Any help would be appreciated.
     
  2. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,079
    2,285
    Digital-logic-wise, it goes like this:
    Leading edge detector
    Trailing edge detector
    OR the two detector outputs
    Use the combined signal to SET a flipflop
    The ff output drives the light
    Pushbutton switch drives the ff RESET input

    All of this can be done in one logic gate package, like a quad NAND gate or a hex inverterI designed two versions of this circuit for another thread.

    Assuming the light runs on the same 12 V as the logic, what is it? Type, current, etc.

    What is the output from the magnetic field switch? Manufacturer and part number, datasheet, etc.

    To clarify a possible logic bomb, lets assume the switch just went from low to high and turned on the light. If the field goes from high to low before the reset is pushed, does the light stay on or turn off?

    ak
     
  3. crutschow

    Expert

    Mar 14, 2008
    23,093
    6,850
    Here's the LTspice simulation of a circuit using an XOR gate to generate a pulse on both the leading and trailing edges of the input signal (this assumes a 0-12V signal from the magnetic sensor), and using another gate in the package to latch from the output pulse (there are four XOR gates in one package).
    The latch output stays high until reset by the PB switch.

    The latch output will likely need a driver transistor and possibly a relay, depending upon what lamp load you have.

    upload_2017-11-1_16-36-31.png
     
    Last edited: Nov 1, 2017
    JonKon and Alec_t like this.
  4. JonKon

    Thread Starter New Member

    Oct 31, 2017
    3
    0
    The Mag switch will be something like this, 2 leads NO switch. I could go with a 3 lead NO and NC switch (just more cost/work). It will run off the same 12v as the light.

    If i need to use a relay to turn on the light, so be it, but if not that would be best.

    When the switch changes state the light should stay on until the reset button is pushed.
    61X99aqKfAL._SL1001_.jpg

    JK
     
  5. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,079
    2,285
    Outstanding minimalist design. But ...

    If you change D1 to a 10K resistor and R2 to a 0.1uF capacitor, two things:

    1. You won't overstress the U2 output when resetting a high state to a low state.

    2. The circuit will not set itself if you release the reset button during a (admittedly brief) U1 output pulse.

    ak
     
    Last edited: Nov 1, 2017
  6. crutschow

    Expert

    Mar 14, 2008
    23,093
    6,850
    I don't think a microsecond of output short is likely to damage the gate.
    They are designed to tolerate momentary output shorts.
    I don't see that as a problem.
    And, with capacitor coupling, the simulation shows it being reset by the trailing edge of pulse.
     
  7. JonKon

    Thread Starter New Member

    Oct 31, 2017
    3
    0

    Roughly 27 Watts for this bulb. Do you think it would still need a relay or could that just be wired to the + on the bulb?

    I am a little confused on what is drawn for the mag switch? And why does the PB switch have 4 wires going to it?

    Thanks, Beginner
     
  8. philba

    Active Member

    Aug 17, 2017
    959
    303
    If the lamp is 12V then you will either need a relay or a Mosfet.

    That switch is how you do switches in ltspice. In a real circuit, it would just be a standard spst switch.

    Note that you will have to set up your mag switch with either a pull up or pull down resistor.
     
  9. crutschow

    Expert

    Mar 14, 2008
    23,093
    6,850
    It will need a transistor or relay.
    That's just to represent the mag switch signal.
    In reality you would connect the mag switch to ground with a 1kΩ resistor in series to +12V or,
    connect the switch to +12V with a 1kΩ resistor in series to ground.
    In either case the signal is taken from the junction of the switch and resistor.
    That represents the operation of the PB switch.
    V2 and the wires to the left of the switch are just for the simulation.
    The real switch has two (top and bottom) wires,
     
    Last edited: Nov 1, 2017
  10. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,079
    2,285
    Any n-channel power MOSFET rated for at least 30 V and 10 A will work. The higher the current rating, the cooler the part will run. The spec to watch is Rdson, resistance from drain to source when on (fully enhanced, the lowest resistance condition). At 12 V the lamp current is 2.25 A, so Rdson x 2.25 = the device power dissipation in watts.

    ak
     
  11. crutschow

    Expert

    Mar 14, 2008
    23,093
    6,850
    I believe you meant Rdson x 2.25². ;)

    To keep the dissipation ≤1W (so no heatsink required) the MOSFET Rdson resistance should be ≤0.2Ω.
     
    Last edited: Nov 1, 2017
  12. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,079
    2,285
    Oops.
     
Loading...