Monday, 9 June 2014

sensor - What are viable approaches to a circuit to detect wet/moist cloth (bed-wetting)?


Trying to design a circuit that can reliably detect a situation where a child wets their bed. The 3 key requirements are --




  1. Reliability of the approach

  2. Ease of use, i.e. a no-fuss approach

  3. Child's safety (from harm) due to electronics


Can the soil moisture detection technique be used ? How can I make this easy-to-use given s.t. while changing bed line ? This shouldn't require messing with the device, rewiring etc.



Answer



Conductivity is probably the easiest method. However, this is a case where you have to be extra extra careful about safety. This would be a good thing to power off of two AA cells. The output could be a opto, which can then go to anything else powered other ways. The lines going to the bed would ONLY connect to the battery powered circuit, with a good 5 mm or more gap to anything else.


Detecting water is not that hard, and urine is going to be more conductive than clean water. Two lines go to the bed. Each can be driven strongly high or low, or with a weak pullup or pulldown (weakly driven high or low). Each also goes into a A/D converter.


Most of the time nothing is going on and both lines can be weakly pulled to ground. The micro periodically wakes up to run a test. There are 4 separate tests, but the micro only needs to run one of them each time it wakes up. It should cycle thru all of them in sequence to avoid any net DC flow. It drives one line solidly high or low, puts the weak pullup/pulldown on the other line in the opposite direction, waits a while, then takes a A/D reading of the second line. The four cases are which line is driven, and whether it is driven high or low.


After a complete suite of A/D readings you should know whether there is enough conduction between the two lines to declare the bed wetted. You probably want to see this asserted several times in a row to to be sure. A few seconds delay isn't going to matter, and that's a very long time for a microcontroller.



Added:


Here is more detail on the circuit I was talking about:



To take one of the four readings, for example, the micro would set digital output 1 high, output 4 low, wait a while (a few ms), then read A/D input 2. With no connection between the electrodes, the A/D will read 0. With a direct connect, it would read nearly full scale because the the 1K driving resistor R1 is 100 times lower than the pulldown R4.


In practise you can double up the A/D input and the first digital output for each line to use only two microcontroller pins per electrode. I showed the three separate to make the functions more clear.


The four different combinations come from the two choices of which electrode is driven and which is the sense wire (A was driven an B the sense in the above example), and whether the driven electrode is high or low (high in the above example). The reason for these measurements is to cancel out bias caused by any battery effects, diode effects, and to avoid net DC to keep the electrode symmetric due to electrolysis.


You should use electrodes that aren't corroded by urine, so in theory there shouldn't be diode or battery effects, but stuff happens, and doing the logic is trivial anyway.


I was envisioning parallel wires loosely stitched to the top of the mattress below any of the sheets, held maybe a inch or so apart. One pair running accross the expected wet area side to side should be enough, but you could use two or three wires for each electrode alternating to cover more area.


I don't know what a good choice of wire is, but certainly not copper. Nichrome might be good, but you have to check yourself. I don't know which metals won't be corroded by urine that you can find wires of that don't cost a fortune. For example gold would work great chemically and electrically, but would break easily, and of course cost a lot even if you could find it. Platinum wire exists and might be suitable other then very expensive. Check out nichrome first.


Added 2:



There is apparently still confusion about the test sequence I am talking about. Here are the 4 tests:



Num Drive A Drive B Read
--- ----------- ----------- ----
1 strong high weak low B
2 weak low strong high A
3 strong low weak high B
4 weak high strong low A

The final result is then (#1 + #2) - (#3 + #4). #1 and #2 should be high readings and #3 and #4 low readings. By doing all four and adding up the result as I show, you cancel out both common mode noise and any fixed differential signal, like could be caused by battery effect due to assymetric corrosion.



If you don't believe this, work thru a example or two.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...