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.

  • 1
    \$\begingroup\$ You do realize that there have long been commercial products that do just this? The company I work for uses them in Senior care residences for residents with dementia and incontinence. Google 'Incontinence Sensor' and you'll get a number or sources. \$\endgroup\$ Jul 17, 2012 at 4:44
  • \$\begingroup\$ Thanks @mickeyf. Was not aware of the commercially available "incontinence sensor". This clearly means that building something similar is not only possible, but proven. \$\endgroup\$
    – bdutta74
    Jul 18, 2012 at 6:47

5 Answers 5


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.


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.

  • \$\begingroup\$ Thanks Olin. While I've seen some articles talking about what might be a save voltage when human touch is involved, I'd assume most of them to be for adults. Is there any study which shows that 3V is okay for infants, even if momentarily ? \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 2:49
  • \$\begingroup\$ As for the circuit, due to my limited electronics knowledge, I am struggling to understand the approach. Here's a schematic. Is what you are suggesting anything similar ? \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 4:02
  • \$\begingroup\$ @icarus74 I think that 3V are not even felt by anyone (you will surely have touched an AA battery with both fingers at the ends, and two times that is not so different). Plus, it's applied over a sheet, and with very distant wires. It should be reasonably safe. \$\endgroup\$
    – clabacchio
    Mar 22, 2012 at 7:27
  • \$\begingroup\$ @icarus: I can't point to any definative study, but really, 3V applied for a few milliseconds every second with at least 1 kOhms in series isn't going to be felt, let alone cause any problems. \$\endgroup\$ Mar 22, 2012 at 12:05
  • \$\begingroup\$ Could you go into a bit more detail on the four tests? Test #1 is 1 strongly high, 4 strongly low, and 2 and 3 weakly pulled down, then read B? Test #2 would be the same except read A? Test #3 would be 1/4 weakly down, 2 low, 3 high, read B? #4 would be the same but read A? \$\endgroup\$
    – Mark
    Jul 16, 2012 at 13:43

I'll add a big one to your list of requirements: no direct electrical contact with the, um, liquid. That liquid is corrosive, foul, and a host of other things. For safety you'd prefer to not have direct contact, but for "sensor lifespan" you also don't want it. Further, you want cleanup to be super easy.

Here's what I would do...

I would use a capacitive touch sensor. Something based on the Cypress PSoC "CapTouch" stuff, or similar. This would allow you to sense the liquid in a non-contact way. The captouch sensors are etched onto a standard PCB and covered with soldermask and other stuff. Slip this under a 1/4 to 1/2 inch thick cotton pad, and under the sheets. When it gets wet, the captouch sensor will register something.

I did a quick test of this here in my office. No, I didn't wet the bed. We have a touch panel based on this technology. I took a wet paper towel and pressed some buttons and it worked fine. I then took a "liquid substance inside of a sealed plastic bag" and repeated the test with success.

The cotton pad is to separate the person from the sensor to avoid false triggers. It also helps to contain the mess, should it happen. Throw the pad into the washing machine as needed.

I think this meets all of your needs:

  1. Reliability: Based on 2 minutes of testing, it seems to be reliable! :)
  2. Ease of use: Just set it down and go for it.
  3. Safety: No direct electrical contact. Should be safe. Can be battery powered for an extra level of protection.
  4. Clean-up: A washing machine and some wipes are all you need.
  • \$\begingroup\$ I would also conformal coat the PCB, just for added protection of it. \$\endgroup\$ Mar 21, 2012 at 22:24
  • \$\begingroup\$ Thanks David. This approach seems very promising. My 2 worries with this approach are-- #1) Often times when children wet-bed, only a small area gets wet, say about a random 25% of the bed, but with this approach I might need an array of touch panels, for covering most parts of the bed, right ? So it'd make this a rather expensive solution. Or can you think of a lower-cost alternative to that ? \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 2:30
  • \$\begingroup\$ worry #2) Is that in a quick test with my tablet and phone, both with Capacitive touch-screen, the wet-towel didn't detect anything. I tried pressing it down using a thick plastic pad (to avoid my skin coming into play), but still nothing. \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 2:33
  • \$\begingroup\$ @icarus74 I reran the test with a Samsung Galaxy S2 and an iPhone 4 and both worked. I took a paper towel and rolled it into a roughly finger shape, got it wet, and touched the tip to the display. If your towel was too "wide" it could cause problems with the phone software (not a problem for you). Total sensor area could be a problem with cap-touch. The biggest you could make a sensor is about 2x2 inches and then you'd put maybe 10 or 20 per PCB. A 2 layer PCB is good, 1 layer might work. \$\endgroup\$
    – user3624
    Mar 22, 2012 at 5:13

I like @DavidKessner's solution, but a PCB on the mattress seems ... uncomfortable to me. I would sew in conductive thread (google for other suppliers) into several bedtime underwear, creating several lines across the area that gets wet. Connect every other line together so you now have a pair of sensor lines. Visualize it this way:

+----------------------------------- A
+  -----------------------+
+-----------------------  +
+  -----------------------+
+-----------------------  +
   -----------------------+--------- B

When the underwear gets wet, the resistance between A and B will go down dramatically. You could connect A and B to any kind of small snap connector (I'm thinking of a 9V battery connector) which then leads away to the actual circuit which could be tiny and zippered/buttoned to a convenient location on the leg/front/back of the pyjama. You could power this off a couple of coin cells, and there are NUMEROUS "water detector" circuits online which could be made VERY small and light.

Washing is as simple as unsnapping the underwear from the circuit and tossing in the wash.

  • \$\begingroup\$ Thanks for taking time to answer my query. Actually this was one of the first approaches (roughly speaking) that came to my mind, but I was really worried about anything more than 3V being applied to detect conductivity. 9V applied to sensitive areas of human skin causes discomfort, and this was my #1 concern when used on something to do with a baby. \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 2:06
  • \$\begingroup\$ BTW, I do really like the conductive thread approach. That married to Olin's approach seems like one option. Based on my understanding of DavidKessner's approach, the PCB shouldn't be quite easy to feel through the bed, as it is beneath at-least 1 layer of cotton padding. \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 2:12
  • \$\begingroup\$ a low power version of a 555 or any tiny MCU should be able to work very well off of 3V (or less, if you want to put a step-up regulator in front of it). I wasn't suggesting 9V for an actual 9V battery but rather the "snap" style of connector; it's flat, it's a tight fit (so it won't come loose) and it washes relatively well. \$\endgroup\$
    – akohlsmith
    Mar 22, 2012 at 2:15
  • \$\begingroup\$ Ah, thanks for clarifying. I missed the "connector" bit, sorry! Many people in the Arduino world seem to use the metal snap-buttons like these. \$\endgroup\$
    – bdutta74
    Mar 22, 2012 at 2:27

You can measure conductivity completely contactless (i.e. using completely insulated probe wires) with eddy current testing (see my answer to this this question).

Having completely insulated probe (=coil) wires makes it safe against corrosion and electric shock.

  • \$\begingroup\$ I think it's not going to work with a sheet. \$\endgroup\$
    – clabacchio
    Mar 22, 2012 at 10:11

You could use a relative humidity sensor, this kind of thing.

  • \$\begingroup\$ Uhmm where would you put that? I mean, do you think that one of these somewhere in the mattress would be enough? \$\endgroup\$
    – clabacchio
    Mar 22, 2012 at 10:20
  • \$\begingroup\$ It would need some testing. But, I believe that the e-diaper/ZigBee nappy use something similar. \$\endgroup\$ Mar 22, 2012 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.