JonathanS
Posts: 33
Joined: Mon Dec 17, 2012 4:14 am

Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 1:06 am

I want to monitor the water temperature inside a copper pipe (to prevent freezing of pipes).

I've seen some "clip on" temperature monitors that seems like a good idea.
http://www.digikey.com/product-detail/e ... ND/1783443

Can I use one of these with the rpi? Would it work similar to this product? :http://www.adafruit.com/products/642#Description

Thank you!

brs
Posts: 70
Joined: Fri Aug 17, 2012 9:27 pm
Location: Zurich

Re: Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 1:25 am

Or make your own fitting for the DS18B20 sensor. The DS18B20 has the advantage that it's trivial to interface with a Raspberry Pi. Analog sensors would probably need an A/D converter of some sorts.

E.g. here is a very improvised pipe attachment for a DS18B20 with tin-foil:
pipe.jpg
pipe.jpg (38.09 KiB) Viewed 22784 times
For some more on the whole setup: http://blog.kugelfish.com/2014/01/raspb ... order.html

JonathanS
Posts: 33
Joined: Mon Dec 17, 2012 4:14 am

Re: Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 2:59 am

Very good idea!

I was thinking of a more accurate and more permanent set up.

Your setup gave me the idea of using that sensor with thermal paste, insulated with aluminum foil, and held together with a zip tie or even something more fancy like this: http://www.amazon.com/Locking-4-6mmx300 ... +Pipe+Ties

Thank you for the ideas!

-Jonathan

achrn
Posts: 448
Joined: Wed Feb 13, 2013 1:22 pm

Re: Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 7:46 am

I don't understand what the silver foil is supposed to achieve.

Personally, I just cable-tie a DS18B20 sensor tight to the pipe, then put a bit of pipe lagging (insulation) around that location if the pipe isn't already insulated. Thermal compound might help fractionally, but not much. The sensor temperature will then be massively dominated by the surface temperature of the pipe, which is not too dissimilar to the water temperature.

Putting a thermowell in teh stream would give better answer, but assuming we're talking about domestic systems not practical / sensible.

brs
Posts: 70
Joined: Fri Aug 17, 2012 9:27 pm
Location: Zurich

Re: Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 9:07 am

Agreed that the tin-foil is more of a placebo, making it easier to hold the sensor in place while improving the thermal coupling between the pipe and the sensor. What would be more important for accuracy is to wrap the whole section with some thermal isolation (e.g. pipe insulation like this:http://www.plastictechnologyinc.net/pipe-insulation/)

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 7:03 pm

Hi,

If you make your own wiring for the 1-wire sensor, remember to use twisted pair wire - cat5 ethernet cable is a good choice.
Use one twisted pair such as blue/blue-white for data and ground and one wire from another pair for 3.3volts
Leave all unused wires disconnected - don't ground them.

Before soldering the sensor to the cable, put short (1/2 inch or so) pieces of wire insulation over the cat5 wires, and after soldering, slide them up to provide insulation on the bare wire legs of the sensor.

I use thermal paste for my sensors on copper pipe and as suggested, pipe insulation over the top.

The only other thing you need for a basic temperature measuring system on the Pi is a 4.7K resistor between data and 3.3v
Only 1 resistor required even if multiple sensors are used.

If you are going to use several sensors, try to put them on a single cable, rather than in a star formation. One long daisy-chained cable is better than several short ones.

Regards

anita2R

josar
Posts: 44
Joined: Sun Jan 19, 2014 1:29 am

Re: Monitoring water temperature in copper pipe.

Tue Jan 21, 2014 10:14 pm

I'm using DS18B20, placed with the flat side directly to the pipe. Wrap around 2-3 times with duct tape, cover with pipe insulation and you are good to go. Thermal paste does not bring any extra precision. I have my sensors wired up this way for 2 years and no problem so far.

brs
Posts: 70
Joined: Fri Aug 17, 2012 9:27 pm
Location: Zurich

Re: Monitoring water temperature in copper pipe.

Sat Jan 25, 2014 12:16 am

Out of curiosity, what are you doing with the data collected from there sensors and how to you process and store it?

For now, I am collecting the data in an RRDTool time-series database (see http://blog.kugelfish.com/2014/01/raspb ... er_24.html for details). I have been getting quite a few read errors over the last few days, which might be due to my somewhat improvised hardware setup or might just be normal? I guess retry mostly takes care of this, but I had quite a few missing samples in the RRD database, which might more have had to do with the timing of the sampling process being too tight/inaccurate via cron. Since I sped up the collection rate a bit, things seem to be better.

josar
Posts: 44
Joined: Sun Jan 19, 2014 1:29 am

Re: Monitoring water temperature in copper pipe.

Sun Jan 26, 2014 12:36 am

Originally I have used a simple logging program on an old laptop which I placed in the basement but now I'm using RPi with the REX Control System, which collects the data via Arduino. See http://www.rexcontrols.com/articles/rex ... ts-arduino
I'm measuring the room temperature and the water going in and out of the gas boiler in my house and I'm controlling it. Replaced the original thermostat with a relay board. Works great.

brs
Posts: 70
Joined: Fri Aug 17, 2012 9:27 pm
Location: Zurich

Re: Monitoring water temperature in copper pipe.

Mon Jan 27, 2014 12:15 am

And here are some graphs, dynamically generated from a web.py python web-app with the RRDTool native graph function: http://blog.kugelfish.com/2014/01/raspb ... er_26.html.

It seems that most of the gaps in the graph, happening sever times per day are caused by this kind of error:

Code: Select all

Jan 26 22:48:03 my-pi kernel: [353132.010203] w1_slave_driver 28-000005303678: 18S20 doesn't respond to CONVERT_TEMP.
Jan 26 22:52:03 my-pi kernel: [353372.023125] w1_slave_driver 28-000005303678: 18S20 doesn't respond to CONVERT_TEMP.
Jan 26 23:00:03 my-pi kernel: [353852.117049] w1_slave_driver 28-000005303678: 18S20 doesn't respond to CONVERT_TEMP.
Jan 27 00:40:03 my-pi kernel: [359852.402337] w1_slave_driver 28-000005303678: 18S20 doesn't respond to CONVERT_TEMP.
which causes the reading process to hang.

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Monitoring water temperature in copper pipe.

Mon Jan 27, 2014 9:47 pm

josar wrote:I'm using DS18B20, placed with the flat side directly to the pipe. Wrap around 2-3 times with duct tape, cover with pipe insulation and you are good to go. Thermal paste does not bring any extra precision. I have my sensors wired up this way for 2 years and no problem so far.
As a test I have just connected two sensors to the same pipe - a horizontal stretch of 3/4 inch copper pipe from the main hot water tank.
Both sensors are on the underside of the pipe, about 2 inches apart, and both are connected to the same twisted-pair cable, plus a 3.3volt supply.
One sensor has thermal paste and the other is dry.
Both are attached by cable ties and covered in pipe insulation.

The Pi measures the temperatures every minute.

When no water is flowing in the pipe for several hours the two sensors read the same (to within about 0.8C)
I didn't check both sensors held together - perhaps I'll do that later.

However what is very clear is that when hot water is drawn through the pipe, the sensor using thermal paste shows a higher temperature by almost 5C.
Then over the next two hours the temperature measured by both sensors falls, but even after two hours, the sensor using thermal paste is still reading higher. It takes 3 hours or so for the 'dry' connected sensor to read the same as the thermally connected one.

The data was charted using gnuplot.

This chart shows the long time required for the sensors to read the same
HW_comparison12hrs_to_27-01-2014_0901.png
HW_comparison12hrs_to_27-01-2014_0901.png (42.22 KiB) Viewed 22271 times
This chart shows the difference when there is a change in temperature in the pipe
HW_comparison_8hrs_to_27-01-2014_1535.png
HW_comparison_8hrs_to_27-01-2014_1535.png (41.14 KiB) Viewed 22271 times
At 09:30 the temperature from a permanent sensor at the top of the hot water tank was reading 46C, so the 'dry' sensor appears to have read 5C lower than actual.

Regards

anita2R

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Monitoring water temperature in copper pipe.

Wed Jan 29, 2014 6:59 pm

anita2r wrote: When no water is flowing in the pipe for several hours the two sensors read the same (to within about 0.8C)
I didn't check both sensors held together - perhaps I'll do that later.
I did get round to comparing the two sensors.

Room air temperature was measured with the sensors attached face to face and held together with electrical tape.

The results showed an average difference of 0.181 C, (60 readings) with the 'dry sensor' reading higher than the one that had been attached to the pipe with thermal paste.

Correcting for this difference in the sensors, it shows that even after the 3 hours as seen in the chart in the previous post, the dry sensor was reading lower than the thermally attached sensor by approximately 1 degree C.

I had said 'the same' to within 0.8 degrees, but now I see that there was a real difference.

The following chart shows the comparison of the two sensors.
HW_comparison_1hr_to_29-01-2014_1308.png
HW_comparison_1hr_to_29-01-2014_1308.png (19.74 KiB) Viewed 22134 times
As a result of these tests I would suggest that a thermal paste is used when attaching sensors to pipes.

Regards

anita2R

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm
Contact: Website

Re: Monitoring water temperature in copper pipe.

Thu Jan 30, 2014 5:29 pm

Have you considered using a JavaScript library to render the charts? I did a write up on how to chart RRD-Tool data using the HighCharts library.
Last edited by Tafkas on Thu Apr 10, 2014 8:36 pm, edited 1 time in total.

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Monitoring water temperature in copper pipe.

Thu Jan 30, 2014 6:54 pm

Hi Tafkas,
Tafkas wrote:Have you considered using a JavaScript library to render the charts? I did a write up on how to chart RRD-Tool data using the HighCharts library.
Thanks - I read your write up. However I want to keep the chart production on my Pi, so I need a lightweight solution and I note that you suggest that a problem with pre-generated graphics 'is that the creating process takes lots of cpu power'.

I have found that gnuplot is fairly light on computing power - it takes less than 3 seconds to create a 3-series chart with 288 data points per series. The output is a completed graphic (I chose png), on one of my Pi web servers. I don't know how other charting software such as HighCharts compares to this. When I set this up I didn't do an extensive search, but as always, there are options with Linux.

Thanks for your response.

Regards

anita2R

brs
Posts: 70
Joined: Fri Aug 17, 2012 9:27 pm
Location: Zurich

Re: Monitoring water temperature in copper pipe.

Fri Jan 31, 2014 7:46 am

The native graph function of RRDTools isn't that CPU intensive either, I get the following CPU usage for the 3 line graph with about 1k samples:

Code: Select all

time ./graph.sh 
real	0m1.217s
user	0m1.150s
sys	0m0.030s
Since I am looking at the charts quite rarely, I don't pre-generate the PNG, but run the generator as a GCI command, whenever the image is requested. (using python & web.py: http://blog.kugelfish.com/2014/01/raspb ... er_26.html)

I actually don't mind the old-fashioned "scientific" look of the default RRDTools or GNUplot charts, even though admittedly RRDTools graph is a bit cryptic and obscure to use, if you want anything but the default look. The advantage of JavaScript charting packages, besides looking a bit more contemporary out of the box, is that they can be interactive - e.g. the dynamic range slider and zoom on the timeline for stock chart widgets.

josar
Posts: 44
Joined: Sun Jan 19, 2014 1:29 am

Re: Monitoring water temperature in copper pipe.

Fri Jan 31, 2014 9:55 am

anita2r wrote:
As a result of these tests I would suggest that a thermal paste is used when attaching sensors to pipes.

anita2R
[/quote]

Great job anita2R, thank you. Since JonathanS wants to prevent freezing the pipes, I suppose the cold will come from the outside. Quite the opposite to your example where the heat changes inside the pipe and comes out. So in the case of changes in the air temperature outside the pipe, the dry sensor will tend to show lower values. I'll conduct my own testing and get back.

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Monitoring water temperature in copper pipe.

Fri Jan 31, 2014 1:13 pm

brs wrote:The native graph function of RRDTools isn't that CPU intensive either, I get the following CPU usage for the 3 line graph with about 1k samples:

Since I am looking at the charts quite rarely, I don't pre-generate the PNG, but run the generator as a GCI command, whenever the image is requested. (using python & web.py)

...The advantage of JavaScript charting packages, besides looking a bit more contemporary out of the box, is that they can be interactive - e.g. the dynamic range slider and zoom on the timeline for stock chart widgets.
Thanks brs ... The native RRDTools looks as though it's similar to gnuplot, with limited customization. I generate a set of charts/graphs every day that present the previous 24 hours of data. As I don't need to alter the view or zoom in on the data gnuplot on its own is OK. I could try RRDTools, but as I have already invested quite a bit of time in gnuplot, I will stick with it.

The interactive element with JavaScript looks interesting and for example would be great if offering data to other users on a website.

Regards

anita2R

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm
Contact: Website

Re: Monitoring water temperature in copper pipe.

Mon Feb 03, 2014 7:59 pm

anita2r wrote:I have found that gnuplot is fairly light on computing power - it takes less than 3 seconds to create a 3-series chart with 288 data points per series. The output is a completed graphic (I chose png), on one of my Pi web servers. I don't know how other charting software such as HighCharts compares to this.
That is the best part about it. I just spit out xml files every five minutes. The whole rendering process is shifted to the client side. That is, if you visit my website the script grabs the xml-file and your browser renders the chart. I also put the JavaScript-files on a CDN which further decreases the footprint on my Pi. That way I can serve literally hundreds of concurrent visitors.

josar
Posts: 44
Joined: Sun Jan 19, 2014 1:29 am

Re: Monitoring water temperature in copper pipe.

Fri Feb 07, 2014 12:52 am

anita2r wrote: As a result of these tests I would suggest that a thermal paste is used when attaching sensors to pipes.

Regards

anita2R
I did my own experiment with DS18B20 sensors. I attached one dry sensor and another one with the thermal paste to a copper pipe in my heat pump. Both sensors are FIRMLY attached to the pipe with duct tape, about 2 inches from each other, the flat side of the sensor is facing the pipe, both sensors are covered with pipe insulation. The temperatures are read each 8 seconds. The dry sensor (green line) is a bit sluggish when abrupt changes in temperature occur (a drop of 50°C in just 2 minutes). But in the usual situations when the temperature is changing slowly, the difference between the two temperature readings is not that big as anita2R displayed (approx 1°C in my case).

So yes, the thermal paste brings additional precision, but if the sensor is mounted with care and covered with insulation, one can go without the thermal paste.
Attachments
thermal_paste.png
1 hour comparison, DS18B20, dry vs. thermal paste
thermal_paste.png (35.1 KiB) Viewed 21699 times

Return to “Automation, sensing and robotics”