Best approach for Imp wakeup and sleep, water level sensing

I need to trigger an imp 001 to wake from deep sleep on the event that a liquid level sensor is exposed to water and send an alert to a user. 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 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. Has anyone here developed a workaround for this kind of use case?

I think it could only be done if the level sensor was a dry contact switch, such as a rubber float with a mercury switch in it. They use those for levels in water tanks.

The water will go low and the ball hangs. When the water is filled to where the ball floats, it closes the switch. That would be the wake-up transition.

Any other method would require external circuitry, which draws battery power, or the imp waking up periodically on its own to test the level, which wakes it up even when there is no change, thus drawing battery power.

https://www.google.com/search?q=weighted+ball+float+switch&safe=off&sa=G&tbm=isch&tbo=u&source=univ&ved=0ahUKEwisgIHXtITKAhXBPT4KHS9sAJYQsAQIQw&biw=1608&bih=868&dpr=0.9

If a ball was totally waterproof, the imp could be put right inside the ball, with a mercury switch (or “tip switch”) of some kind. That would be interesting.

This type, using stainless floats, has 2 levels.

Extend the tubing and put the imp on top of it inside a plastic box. Because there are 2 switches (NO and NC contacts), the bottom switch going from low to high wakes the imp. The top switch (when the water gets to it), goes low and puts the imp back to sleep.

I currently have the imp waking every hour to log sensor data. This will include water level. I’m trying to solve this problem so that a user will be able to get immediate feedback in the form of a phone notification that their tank is full, which is why it just needs to wake up on transition from no water to water and then go back to it’s normal sleep schedule.

I can’t think of a mechanical switch that would accomplish this. The water is feeding plants so it will be dropping very gradually. Maybe there is another way to have the imp consume very little power for the 6 or 7 hours it takes the water level to drop (disconnecting, low power modes, etc?) without putting it to sleep per se.

Is there any way to force the Imp to sleep after it’s been woken up?

Also, how long does the interrupt pulse have to be to wake the imp?

Is there a way to use a solar cell to charge batteries during the day?

The pulse to actually wake the imp doesn’t have to be long (can’t remember, but I think it might have been 100us or so) but for the imp to know explicitly that it was woken by a pin change and not an RTC interrupt which just happened to happen at the exact same time you likely want it to be 20ms+.

To generate a short wake pulse on a state change, see the XOR circuit here https://discourse.electricimp.com/discussion/comment/20268/#Comment_20268 - essentially, the XOR gate will generate a high output whilst the inputs are different. You connect one input direct to the sensor and the other input to an R-C filtered version of the sensor which means it’ll lag a little behind and hence you’ll get a fixed length wakeup pulse on any transition, high or low. You’d also hook the sensor to another imp pin so you could tell what state it was in, as the pin1 wake signal won’t be useful for this.

An XOR wired like this will take maybe 1uA, so essentially no power. You’ll burn more in the pull-up for the switch.