Temp/Humidity/Water sensor network

Find out how to setup your programmer's software and how to solve many common problems.

Moderator: phalanx

Post Reply
Posts: 6
Joined: Mon Dec 08, 2008 12:06 pm

Temp/Humidity/Water sensor network

Post by shawnd » Thu Jan 28, 2016 1:02 pm

Hello there,

I am planning on purchasing a home soon and excited about all the DIY projects! During home inspection, they found water in the crawlspace of this new construction. Though the builder has arranged to fix it, I am interested in putting in place a few sensors scattered around the crawlspace to monitor temperature, humidity and presence of water on the surface and alert if necessary. I could go to the local Home Depot and buy these but building your own is way more fun.

I am an experienced software engineer but a newb when it comes to microcontrollers. I am planning on ordering a few books to get me started but given all the options, I am looking for some initial guidance to get me started on the right foot.

The goals:

1. Have ~4 nodes scattered around the crawlspace monitoring temperature, humidity levels and a water sensor to detect pooling water
2. All 4 "sensor nodes" will report to a "collector node" which will be within range of the sensor units as well as the home Wifi.
3. The "collector node" should be able to either push sensor data to a remote server on the wifi network, or store it locally on media and provide some endpoint so a service can collect it from the "collector node". Not sure what the best practices here are, though pushing to a different server seems easier than storage and retrieval.

Initial research:
- For testing the presence of water, I am planning on using BC547: https://www.sparkfun.com/products/8928
- For temperature and humidity: https://www.sparkfun.com/products/10167
- For the collector: if going the "serve the data" route: https://www.olimex.com/Products/PIC/Dev ... t/PIC-WEB/

- For the sensors pushing data to the collector, I was initially thinking of using RF but given potential obstacles in the crawlspace (concrete pillars here and there and wrap around of building) I was wondering if Bluetooth might be a better way to go? Or are there better options? Trying to avoid putting in wires all across the crawlspace.
- And for all the above - would be a PIC24 or PIC32 be better?

Attached an image to give some idea about the crawlspace. The collector unit will be located close to the crawlspace entry in hopes of getting the best wifi signal. The entry is obstructed by walls on both sides. Other than that, its mostly wooden posts on concrete grade beams to support the floor joists. Crawl space is about 42'x28'. S1-4 are potential sensor placement locations.

Any suggestions appreciated.


User avatar
Non-SFE Guru
Posts: 1983
Joined: Sun Nov 30, 2003 8:57 am
Location: Candia, NH

Re: Temp/Humidity/Water sensor network

Post by phalanx » Fri Feb 05, 2016 6:55 am

Hi shawnd,

Sorry for the delay in getting you a response. I've been on a business trip and haven't had time to answer questions.

While I fully appreciate the desire to make everything wireless, consider the fact that your 4 nodes will require power and if they're battery powered, you will still have to go down into your crawlspace to change them periodically. If you run wire for each node, you will have much less maintenance in the future and the communications between the modules can be simplified and made much more reliable. Consider running CAT-5 cable to each node and use RS485 as your means of communication between the nodes and your controller. RS485 requires 1 pair of wires for data transmission and 1 extra wire for signal ground (for a total of 3). Sometimes you can forgo the signal ground if you reference everything to your power supply ground but you need to understand how common mode voltages work and the tolerances of your 485 transceivers dealing with common mode voltages. It's always a good design practice to use a separate signal ground. This leaves you with 5 unused wires which can be used to bring power to your nodes. Since RS485 is a bus, you can daisy chain all your nodes together to simplify your wiring.

On the sensor front, what you linked for a water sensor is nothing more than a transistor. By itself, it is not a water detector but it can be used as a component within a detection circuit. Do a google search on water detection circuits and you will see what I mean. You can also buy prepackaged water detection sensors for relatively little money ($10-$20) that will make your life much easier.

For temperature and humidity, the sensor you linked to will work fine and is very easy to use.

For the collector, you have lots of options. If you want to learn the Microchip TCP/IP stack, the PIC-WEB will suit you fine. There are also lots of Arduino options that can reduce the time to get things up and running so long as you understand the limitations of the various types. A Raspberry Pi, Beaglebone, or an equivalent platform could act as a much more powerful controller as part of a larger home automation network. You really do have tons of possibilities. It all depends on how much you want to tackle.

As to your questions; with a centrally mounted controller, Bluetooth would be able to reach all the nodes with no issues. Xbee modules and simpler RF devices that require modulation in your firmware will also do fine at that range. I would still recommend going the wired route to keep maintenance low and improve the overall reliability of the system. On the microcontroller front, you don't need much in terms of processing power. The PIC-WEB you posted above uses an 8-bit PIC18 and can host simple web pages without any trouble. For your individual sensor nodes, any microcontroller with enough pins to cover your I/O needs will be suitable since there are no large processing demands. I tend to use PIC24F parts for all but the most demanding projects due their ease of use and flexibility of mapping I/O pins. An Arduino would also be well suited to this task.

I hope this gets you moving in the right direction!


Posts: 6
Joined: Mon Dec 08, 2008 12:06 pm

Re: Temp/Humidity/Water sensor network

Post by shawnd » Sat Feb 06, 2016 1:06 pm

Hi there Bill, thanks for the detailed response!

Since I am trying to detect if water is pooling in the crawlspace, the simple BC547 should do the trick. I found out about it from this tutorial: http://circuitdigest.com/electronic-cir ... rm-circuit. I like this approach as I can extend the probe wires down from where the sensor is mounted to the footing of the foundation (~3-5 feet) and if contact is established with water - record and transmit the info. The length of the probe wires lets me control where I think the water level should not reach. I am hoping the length of the probes should not be a problem.

For the temp/humidity sensor - I decided to switch to BME280. Starting off with the breakout kit for now, but will switch to raw component when ready for PCB. The RHT03 is not very PCB friendly. The added benefit of going with the BME280 is that I can also record pressure readings. This way I can ensure there's always a negative pressure in the crawlspace compared to the exterior / rest of the house.

As for the big question about wired or wireless, I am going to have to wait to move in to the house before exploring the possibilities. I like your wired approach and makes a lot of sense. The only con I can think of is that it restricts the ease of relocating the sensors if the need arises. But I will wait and see - may not be an issue. PS, my crawlspace isn't that tiny and has a very convenient access point so I don't mind going down there. Probably a good idea to double check every other month or so :)

I started off with the 28 pin PIC24F series as well (PIC24FV32KA302 for 5v and PIC24F32KA302 for 3.3v). Having tons of fun getting it hooked up and programming. And getting the deep sleep mode understood, working and tested has been a blast. Plus its a major bonus for battery operations.

Thanks again!

Posts: 2
Joined: Mon Nov 14, 2016 2:03 pm

Re: Temp/Humidity/Water sensor network

Post by R.G. » Mon Nov 14, 2016 4:23 pm

An interesting water sensor I stumbled onto can be had very cheaply. At farm and ranch supply places, you can buy "ribbon" for electric fences. This is a very open weave of polypropylene plastic with lengthwise wires made of stainless steel. If you cut out a suitable length, and then pick apart every other stainless strand, you can hook them to any conductance-type water sensor. The strands do not cross-connect down the length of the ribbon.

The ribbon is sold in spools of 1/4 to one MILE in length for something in the $30-60 range, so finding a small length might be tough. But commercial water sensor cable is far, far more expensive.

At this price, you could buy a spool, run it all over your attic, your ACs, your laundry room, etc.

Post Reply