Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Designing an interrupt switch or circuit

  1. Dec 30, 2015 #1
    I need to trigger an electric imp to wake from deep sleep on the event that a liquid level sensor is exposed to water and send an alert to a user. This device periodically wakes up out of a deep sleep state and connects to a server to log sensor data (temp, humidity, light, water level in the tank) via wifi.

    I then would like the device to go back to deep sleep even though the water will still be present. This behavior will have to repeat every time the water level sensor goes from low to high (every time the user fills the tank). I am aware that the interrupt can only be triggered when the interrupt pin state transitions from low to high, and that the device can only go to sleep when the pin goes low again, hence the challenge. This is a battery powered application so power consumption is at a premium.

    Can anyone suggest a solution?
     
  2. jcsd
  3. Dec 30, 2015 #2
  4. Dec 30, 2015 #3

    meBigGuy

    User Avatar
    Gold Member

    I'm not sure what level your requirements are at.
    Are we defining the device, or the interface to an existing device? (I'm thinking the former)

    A stand-alone wifi connected uP attached to a sensor? A raspberry Pi seems like a logical choice, but I don't know about sleep currents.
    There are Arduino based solutions you can search for.

    Powering down the wifi will be an issue also. I think you are talking a pretty complex multistage system if power is really an issue.

    Here are some commercial solutions:
    http://www.monnit.com/ProductManagement/FilterResult/?productCategoryID=1
    https://www.amazon.com/Wifi-Water-Detector-Email-Alerts/dp/B00FG9Y2MC

    Here is a high level treatment of the issue
    http://www.digikey.com/en/articles/...wireless-water-leak-alarm-system-for-home-use

    Here is a project that uses an arduino interfaced to a raspberry Pi
    http://www.instructables.com/id/ESP8266-WiFI-water-leak-sensor/

    You need to look over all the above, do your own searches, and finalize your system definition.
     
  5. Dec 30, 2015 #4

    CWatters

    User Avatar
    Science Advisor
    Homework Helper

    Add a edge triggered monostable between level sensor and interrupt? Might be able to do it with just a resistor, capacitor and diode. Depends how long the interrupt pin must be high for.
     
  6. Dec 30, 2015 #5

    Hesch

    User Avatar
    Gold Member

    You should sketch a logical state machine like the attached:

    There are 4 states, and change of state will take place when

    LOL = LOw Level of water
    or
    INTACK = Interrupt acknowledeged

    change locical value.
    The state machine will change the value of

    INT = Interrupt.

    The problem is: How short may this interrupt pulse be? When has it been detected/acknowledged?
    A "work around" is to make a "handshake" between the device and the server with signals: Interrupt and interrupt acknowledged. When the server signals, that it has detected/acknowledged the interrupt, the interrupt signal can be removed, ready for another cycle.

    Having sketched the state machine, you can design an asynchronous logic network, consisting of about 8 nand-gates. Are you familiar with Karnaugh maps?

    Using MOS-technology, the current consumption will be a few μA, if not nA.

    PS: The two binary digits in the circles are the binary "address" of the state.
     

    Attached Files:

    Last edited: Dec 30, 2015
  7. Dec 30, 2015 #6
    I'm using an electric imp right now which is both the MCU and the wifi chip. My question is more about an external circuit that will satisfy the electric imp's requirements for waking from deep sleep by an interrupt pin (transition from low to high wakes it, transition from high to low puts it to sleep). The problem is that the water will still be present when I want it to go to sleep, but it must be able to do the same thing over again the next time the water goes from low to high.
     
  8. Dec 30, 2015 #7

    meBigGuy

    User Avatar
    Gold Member

    Electric IMP is a cool device. Nice choice.

    I think you described the WAKE pin a bit incorrectly. The WAKE pin must be low for the SW to go to sleep. The high-to-low transition does not put it to sleep. It just cannot go to sleep unless the pin is low.

    Look at what CWatters suggested, an edge triggered one-shot that generates a wake pulse whenever the sensor goes from low to high, or a capacitively coupled detector (differentiator) that implements that function.
    Here is an example using a 555, but the differentiator input circuit to the 555 may be all you really need.
    http://www.electroschematics.com/11032/edge-triggered-555-monostable-multivibrator/
     
  9. Dec 31, 2015 #8

    Svein

    User Avatar
    Science Advisor

    Define a state machine first, and then look for ways to implement it. It seems to me that you have something like the following state chain:

    (water low, IMP asleep)→(water high, IMP asleep)→(water high, IMP awake)→(water high, IMP asleep)→(water low, IMP asleep)

    Since you have two states that looks the same, you must introduce an extra state variable somewhere (possibly set when the IMP is awake and reset when the water is low).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Designing an interrupt switch or circuit
Loading...