Temperature sensors

  • Active since 1995, Hearth.com is THE place on the internet for free information and advice about wood stoves, pellet stoves and other energy saving equipment.

    We strive to provide opinions, articles, discussions and history related to Hearth Products and in a more general sense, energy issues.

    We promote the EFFICIENT, RESPONSIBLE, CLEAN and SAFE use of all fuels, whether renewable or fossil.
  • Super Cedar firestarters 30% discount Use code Hearth2024 Click here
Status
Not open for further replies.

free75degrees

New Member
Hearth Supporter
Apr 6, 2008
430
Boston Area
I am thinking about buying some digital temperature sensors that I will use as aquastats and thermostats for my heating system. The devices I am interested in getting are available at DigiKey (Dallas Semiconductor DS18S20+-ND). They have 0.5*C accuracy and are simple 3 pin devices that output a 9 bit temperature reading serially out of one of the pins. One nice feature is that they each have a 64 bit id which allows a bunch of them to be put on a single bus which means you can connect them all to the same input on a controller board and use the controller to scan through the temp sensors using the ids.

They cost $5.04 each in quantities up to 25, $3.80 in quantities from 25 to 50, and $2.28 from 50 to 100. I want to get about 15 of them for myself, and I was wondering if there are any electronics/computer geeks out there who might want to split an order with me so that we can get the $2.28 price.
 
How long are the leads ? Or do you make them up ? Any accuracy issues with increased length ? I guess you can tell I am definitely not a E geek.
Will
 
The leads are short and you can solder the leads to thermostat wire, seal cover the connection with shrink wrap, and run them a long distance. I am not sure how long, but I assume it is quite long since the signal is digital. I would be suprised if you could not go as long as you want in a typical domestic setting. I am planning on using some of them in a dry setting (possibly even replacing my current zone thermostats with them) and some in my storage tank and water lines. For the ones in the tank I will probably put the sensor into a short segment of narrow copper tube with the soldered wire hanging out of one end, then seal both ends with some epoxy or silicone sealer.

Using these will take quite a bit of work on the controller end. I am going to need to write some code to communicate with the sensor using their bus protocol. These will only work if you are planning on doing a very custom controller setup and you are able to either program the interface or use the code that i plan to write.
 
Is this the only way to check out temperature's at different places ?
 
Willman said:
Is this the only way to check out temperature's at different places ?
There are other methods, but probably nor for as cheap. I was inspired by nofossil having a lot of logged temp readings so I want to get a bunch of sensors. Let's say I want to do 1 for each zone to replace the thermostats, a few in the tank, a couple embedded in the insulation around the tank, a few in the water lines, and then a handful more in case I get inspired to put one somewhere else. That gives me about 20. This solution is $5 at most for each one so that comes to $100. If I use a solution that costs $10 each the cost goes up to $200.

Does anybody know of any other way to check the temps in a way that I can interface with a controller?
 
I just discovered that I can order these from the mfg for $2.57 per sensor, plus I ordered 2 samples for free, so I'll try those out first.
 
How do people (maybe just nofo) take automated measurements of boiler output temps? Specifically, how do you get the sensor into the water, or ensure a good enough heat exchange between the water and the sensor that you can be sure the sensor is accurate, and not reflecting some intermediate temp between the water and the surrounding atmosphere?
 
nofossil said:
I place the sensor on the pipe at the desired location, then cover it and the surrounding area with foam insulation held tightly with a velcro band.
good idea, thx. I'll do something like that.

I just got my 2 samples of the ds18s20 sensors and my ts7800 in the mail, so I'll be working on getting them to interface this weekend. I hope you don't mind if I cheat and look at some of you C code.

I also bought some 1/4" od copper coil that I will use to make the sensors water submersible. I can just barely fit the sensors into this tube, which is perfect because it means good heat transfer from the outside to the sensor. My idea is to solder the sensor to some wiring, shrink wrap any exposed metal, then squeeze the sensor and connections into a segment of about 2 inches of copper tube. Then I'll use some plumbing epoxy on both ends to seal the tube.
 
free75degrees said:
nofossil said:
I place the sensor on the pipe at the desired location, then cover it and the surrounding area with foam insulation held tightly with a velcro band.
good idea, thx. I'll do something like that.

I just got my 2 samples of the ds18s20 sensors and my ts7800 in the mail, so I'll be working on getting them to interface this weekend. I hope you don't mind if I cheat and look at some of you C code.

I also bought some 1/4" od copper coil that I will use to make the sensors water submersible. I can just barely fit the sensors into this tube, which is perfect because it means good heat transfer from the outside to the sensor. My idea is to solder the sensor to some wiring, shrink wrap any exposed metal, then squeeze the sensor and connections into a segment of about 2 inches of copper tube. Then I'll use some plumbing epoxy on both ends to seal the tube.

My C code may be a bit impenetrable, because I'm doing linear interpolation from a lookup table in RAM to compensate for the drastic nonlinearity of the thermistors. You won't need to do that, so it'll be easier for you.

Epoxy may not be good enough. What I did is to install a feed-through in the tank wall and attach 1/4" soft copper to the inside with a compression fitting. The bottom end of the copper is hammered over and soldered. That way, I have a well that I can slide the sensors into. BTW, I use a small diameter piece of stiff wire along with the sensor harness to ensure that the sensors slide in to the intended depths.
 
I won't have to do the lookups, but I will have to get the timings right to make the 1 wire bus work. Should be a challenge.

I would really like to get the epoxy to work. My tank is half underground so the side entry tubes won't work at the botton. Plus I like the idea of being able to move them around easily. Why do you have doubts about epoxy?
 
free75degrees said:
I won't have to do the lookups, but I will have to get the timings right to make the 1 wire bus work. Should be a challenge.

I would really like to get the epoxy to work. My tank is half underground so the side entry tubes won't work at the botton. Plus I like the idea of being able to move them around easily. Why do you have doubts about epoxy?

For thermistors at least, I had catastrophic failures with epoxy encapsulated sensors. I think the cable insulation and the epoxy both are a little bit permeable over time. More experiments are good, but leave yourself options in case the sensors fail.

I've lost a bunch of sensors that were encapsulated and exposed to moisture, and none that weren't exposed to moisture.
 
OK, the ds18s20 sensors are finally working with my ts7800 controller board! They are telling me it is 68*F in here. I can't wait to get that boiler hooked up so that I can crank it to 75! As a confirmation, I can hold one between my fingers and the temp goes to 77.
 
free75degrees said:
OK, the ds18s20 sensors are finally working with my ts7800 controller board! They are telling me it is 68*F in here. I can't wait to get that boiler hooked up so that I can crank it to 75! As a confirmation, I can hold one between my fingers and the temp goes to 77.

Awesome! Could you post your code?
 
free75degrees said:
OK, the ds18s20 sensors are finally working with my ts7800 controller board! They are telling me it is 68*F in here. I can't wait to get that boiler hooked up so that I can crank it to 75! As a confirmation, I can hold one between my fingers and the temp goes to 77.

Congratulations on your success! I am interested on how you accomplished the required signaling between the ts7800 and the ds18s20. Sure would like to see the code on this!

Don
 
When I get home tonight I'll clean up the code a bit, add some comments, then post it. Where should I post it? I'd rather not post it in this thread where it will get lost. Maybe i'll start a wiki page.
 
free75degrees said:
When I get home tonight I'll clean up the code a bit, add some comments, then post it. Where should I post it? I'd rather not post it in this thread where it will get lost. Maybe i'll start a wiki page.

If you have somewhere permanent, put it there and post a link to it. If it helps, I'll be glad to host it on the nofossil site - a variant is going to end up there anyway (properly attributed, of course).
 
Ok, I have posted the code to a wiki page I just made:
https://www.hearth.com/econtent/index.php/wiki/free75degrees_gasification_project/

This is just a test program to make sure everything works. I am thinking about learning how to write a linux kernel driver based on this. A friend tells me that if I write a kernel driver I can make it so that each device looks like a file where you can just read the contents to get the temperature. Sounds pretty slick so I might have to try it out...
 
I just added the following code to set the process to use FIFO scheduling policy. I have never used this before, but from what I have read this should prevent the process from getting preempted.

const struct sched_param *param;
sched_setscheduler(0, SCHED_FIFO, param);
 
That should do it as long as this task doen't take too much time and thereby defer all the following tasks. I need to figure out two things:

1) How much time this task would take to read all the sensors at a reasonable frequency (all sensors every 20 seconds would be good for me)

2) How much time all the other tasks are consuming

There must be some profiling tools that could get me some of that data. In my case, I have several tasks that run at different frequencies:

- data collection and simple logic - every second
- data logging - every 30 seconds
- control logic - every 35 seconds

It's pretty important that these don't get preempted. I'll have to study the 1wire spec and see how much time it takes to read a couple dozen sensors. Maybe I could read them in small groups, a few every second in round-robin fashion.
 
My code may not be totally efficient on time - I was more concerned with making it work and tried to set the timings to the center of the spec timings so it might be possible to squeeze some more time out. There are also some other efficiencies to be had. For example, the convert T command can be sent to all devices at once. By far the longest part of getting a temperature is the delay that the sensor needs to convert the temperature to a digital value and store it in its on board register. This takes on the order of 1/2s. Not doing them together would probably take a huge chunk of your 20 s interval.

Another possibility is to put each device on a separate I/O. This way you wouldn't have to send the ROM code to get the temperatures. The ROM codes are 64 bits, so this would cut the time significantly.
 
free75degrees said:
My code may not be totally efficient on time - I was more concerned with making it work and tried to set the timings to the center of the spec timings so it might be possible to squeeze some more time out. There are also some other efficiencies to be had. For example, the convert T command can be sent to all devices at once. By far the longest part of getting a temperature is the delay that the sensor needs to convert the temperature to a digital value and store it in its on board register. This takes on the order of 1/2s. Not doing them together would probably take a huge chunk of your 20 s interval.

Another possibility is to put each device on a separate I/O. This way you wouldn't have to send the ROM code to get the temperatures. The ROM codes are 64 bits, so this would cut the time significantly.

Thanks for your work on this, though it means I can't slack off too much longer.
 
Status
Not open for further replies.