1-wire temperature logging


22 posts
by treecreeper » Wed Jul 18, 2012 12:37 pm
I have got my first worth while project up and running. It uses Maxim 1-wire temperature sensors and logs graphs using rrdtool.

I have written it up here http://neilbaldwin.net/blog/weather/raspberry-pi-data-logger/
and you can see the results here http://neilbaldwin.net/blog/weather/combined-temperatures/

Enjoy. Any question please post them to the thread and I will do my best to answer.
Posts: 5
Joined: Thu Jan 12, 2012 7:57 pm
Location: Aylesbury UK
by rowan » Thu Jul 19, 2012 3:04 am
I am looking at designing a system to log temperatures of a brewing kit. I am scratching my head on the cheapest way to get from a temp sensor to usb. Your solution seems cheap enough except I really do not want to introduce any metals into the kit except stainless steel. My question is how well does the one wire system scale to multiple sensors? will the sensors swap /dev places on boot?
Posts: 1
Joined: Thu Jul 19, 2012 2:08 am
by treecreeper » Thu Jul 19, 2012 6:45 am
You can reduce the cost by not using the USB adaptor, and using the GPIO I came across a website with instructions, unfortunately after I had invested in the USB adaptor. Try searching for raspberry Pi and one wire.

The sensors all have a unique I'd so can always be found at the same place in the one wire filesystem owfs.

I came across other people using the one wire system for brewing and there are ways to protect/seal away the sensors, in fact I would not be surprised if stainless steel sensors are available.
Posts: 5
Joined: Thu Jan 12, 2012 7:57 pm
Location: Aylesbury UK
by davidmam » Thu Jul 19, 2012 7:39 am
As has been said, you can do this with the Pi and a single resistor as well as the DS18S20. Each one wire device has a unique ID so no worries about them swapping /dev location. Look for the one wire kernel thread in interfacing for details.

It works just fine with multiple sensors (I've run five over quite a long wire)
Posts: 98
Joined: Tue Dec 06, 2011 4:13 pm
by AndreMiller » Thu Jul 19, 2012 7:41 am
treecreeper wrote:in fact I would not be surprised if stainless steel sensors are available.


I've bought quite a waterproof sensors from eBay to measure the temperature in my aquarium, and they claim to be stainless steel. So far they've working great, and they're about the same price as what a naked DS18B20 chip would cost me where I stay.

Try out this search on eBay: http://global.ebay.com/search/?Query=ds18b20+waterproof
User avatar
Posts: 8
Joined: Mon Jul 16, 2012 1:42 pm
Location: South Africa
by snotling » Sun Jul 22, 2012 4:40 pm
treecreeper - Thank you for posting what you did, it will come in handy as I work my way through my project.

I am looking to do something close to what you and rowan are doing, except I want to add it to my grill/smoker and collect the temperature of the smoke chamber and the meat.

When I first started to take on this project, I was looking at the food grade probes ( example : http://www.amazon.com/Maverick-Genuine- ... ment+probe )

But they have the mini jack. Has anyone looked into these or hooked them up to the pi?

The 1-wire system looks really nice and straight forward.
Posts: 2
Joined: Sun Jul 22, 2012 4:28 pm
by kelly_s » Thu Jul 26, 2012 9:24 pm
snotling wrote:treecreeper - Thank you for posting what you did, it will come in handy as I work my way through my project.

I am looking to do something close to what you and rowan are doing, except I want to add it to my grill/smoker and collect the temperature of the smoke chamber and the meat.

When I first started to take on this project, I was looking at the food grade probes ( example : http://www.amazon.com/Maverick-Genuine- ... ment+probe )

But they have the mini jack. Has anyone looked into these or hooked them up to the pi?

The 1-wire system looks really nice and straight forward.


I'm curious too if anyone has worked with one of these probes, or the newer version:
http://maverickhousewares.bigcartel.com ... oker-probe

I am looking to do a similar type of project on my smoker as well. I can't find any specifics on this probe, but the type of plug on the mini jack leads me to believe it is a 1-wire sensor. It is about the only probe I can find out there that has the temp range (on the sensor AND the wiring) needed for such an environment.
Posts: 2
Joined: Thu Jul 26, 2012 9:19 pm
by snotling » Thu Jul 26, 2012 11:37 pm
Yes, that smoking probe is the other one that I am looking at using.

I have not heard anything, but I am thinking it is a 1-wire as well. Once my Pi comes in, I was going to head to radio shack and pick up a socket and see what happens with one of my probes.

If you beat me to it, let me know what happens.
Posts: 2
Joined: Sun Jul 22, 2012 4:28 pm
by IanH » Fri Jul 27, 2012 7:16 am
It's unlikely the probe uses a DS18B20, as the latter only works up to 125 C, and smoking it at ~200 C will kill it. High temperature sensors tend to be thermocouples (which generate a _very_ small DC voltage) or resistance types (whose resistance either increases or decreases with temperature, depending on the sort), and you'll therefore need some sort of analogue input. It will also need calibrating.

If you have a multimeter, you could try measuring the resistance across the jack pins at a variety of temperatures and see whether it changes in a useful way. (If it's always a low resistance, it's probably a thermocouple and - to be honest - it's easier to choose a resistance-type probe than build a thermocouple amplifier).

Out of interest, I'm currently playing with a DLP IO8 module (it's about £20 from the FTDI online shop, at http://apple.clickandbuild.com/cnb/shop ... =DLP-IO8-G), which can do both analogue input and read attached 1-wire temperature sensors.
Posts: 49
Joined: Mon Dec 19, 2011 5:53 pm
by kelly_s » Fri Jul 27, 2012 10:24 pm
Ian - It looks like your guess about it being a resistor type is correct. After looking around, it looks like the probe is a thermistor. That being the case, it looks like you can use the formula found here:
http://en.wikipedia.org/wiki/Thermistor ... t_equation
to calculate the temp based on the voltage drop. I found the A, B, and C values for the ET-73
A = 2.3067434E-4 B = 2.3696596E-4 C = 1.2636414E-7

I like your idea about using the DLP-IO8-G to interface with the sensors, if I can figure the coding part out. I just ordered my rPi so I have plenty of time before it gets here, but I'll need every bit of that time to get back into this stuff since I haven't done anything this low-level since my comp-sci days over 15 years ago.
Posts: 2
Joined: Thu Jul 26, 2012 9:19 pm
by YodaTheCoder » Tue Jul 31, 2012 3:49 pm
kelly_s wrote:Ian - It looks like your guess about it being a resistor type is correct. After looking around, it looks like the probe is a thermistor. That being the case, it looks like you can use the formula found here:
http://en.wikipedia.org/wiki/Thermistor ... t_equation
to calculate the temp based on the voltage drop. I found the A, B, and C values for the ET-73
A = 2.3067434E-4 B = 2.3696596E-4 C = 1.2636414E-7.


I've used that formula in an Arduino project with a thermistor. Code is here if you're interested. It's just a case of plugging in the values from your component datasheet.

One gotcha I experienced, the output reading is based on the input voltage to the thermistor, which changed when I switched from powering the Arduino via USB to an external power supply. It's useful if whatever device is reading the thermistor can also measure it's input voltage.
Posts: 14
Joined: Fri Jul 27, 2012 5:02 pm
by thisisprata » Tue Aug 21, 2012 11:53 am
I want to do something similar, but in an espresso machine to make a PID controller. However, I don't think an ordinary stainless steel one-wire thermometer will work. Logistically I just don't think I can put it into the pressurised boiler without drilling some sort of hole in it.
Posts: 1
Joined: Tue Aug 21, 2012 11:48 am
by anthonyUK » Wed Aug 22, 2012 8:21 am
@Rowan
Depending on how many sensors you need, a cost effective method for 1-2 sensors is to use a temper or temper2 USB sensor which are approx. £5 and £10 each.
The temper is a single sensor and the temper2 a dual.
I'm using a temper2 in my fermentation fridge - RRD output HERE
Posts: 27
Joined: Tue May 29, 2012 8:18 am
by ale36 » Tue Oct 30, 2012 2:18 pm
hello I'm attempting this as my first raspberry pi Project
I have revived my 2 free samples of DS18B20 from maxim integrated.
I have everything i need to start this project however after having done a bit of reading on-line I have found my self confused and unsure on how to wire the sensors, i have seen two different was of wiring the sensor to the raspberry Pi.
1 methos i saw was this:

Image

The other method is by taking Pin 1 + 3 to ground and Pin 2 to GPIO4 with a 4K7 resistor goin to 3V3

can some one tell me which is the best method?
Thanks
Posts: 7
Joined: Tue Oct 30, 2012 11:28 am
by repton » Tue Oct 30, 2012 8:24 pm
ale36 wrote:can some one tell me which is the best method?


The method in the image, i.e. power to 3V3, data to GPIO4, ground to ground, and a 4K7 resistor between GPIO4 and 3V3.

Paul
UK Supplier of 1-Wire components, kits and modules:
http://www.sheepwalkelectronics.co.uk/
Posts: 89
Joined: Sat Mar 17, 2012 6:06 pm
Location: North Yorkshire, UK.
by markyb » Tue Oct 30, 2012 10:09 pm
Hi all,

Just tried connecting a second DS18B20 to my current working one but ended up not being able to see any devices at all. I connected the first as in the diagram above which worked fine and I connected the second pin to pin to the first, still with just one 4k7 resistor. Is this correct?

Many thanks,

Mark
Posts: 2
Joined: Tue Oct 30, 2012 9:59 pm
by treecreeper » Wed Oct 31, 2012 7:25 am
Hi mark, on my setup pins 1 and 3 are connected (soldered together), then just two wires connect back to the 1-wire USB adaptor.
Posts: 5
Joined: Thu Jan 12, 2012 7:57 pm
Location: Aylesbury UK
by repton » Wed Oct 31, 2012 7:09 pm
markyb wrote:Just tried connecting a second DS18B20 to my current working one but ended up not being able to see any devices at all. I connected the first as in the diagram above which worked fine and I connected the second pin to pin to the first, still with just one 4k7 resistor. Is this correct?


It should be fine, I would double check your wiring as I've had 5 daisy chained using the kernel driver and it worked fine.

Paul
UK Supplier of 1-Wire components, kits and modules:
http://www.sheepwalkelectronics.co.uk/
Posts: 89
Joined: Sat Mar 17, 2012 6:06 pm
Location: North Yorkshire, UK.
by repton » Wed Oct 31, 2012 7:11 pm
treecreeper wrote:Hi mark, on my setup pins 1 and 3 are connected (soldered together), then just two wires connect back to the 1-wire USB adaptor.


That is different though as you're using a USB host adapter and the poster was asking about using the kernel based 1-wire adapter connected to the GPIO connector.

The majority of people using a DS9490R or similar host adapter will use parasitic power as you are but with the kernel driver you're much better off powering it from the 3V3 line.

Paul
UK Supplier of 1-Wire components, kits and modules:
http://www.sheepwalkelectronics.co.uk/
Posts: 89
Joined: Sat Mar 17, 2012 6:06 pm
Location: North Yorkshire, UK.
by ale36 » Thu Nov 01, 2012 10:22 am
repton wrote:
The majority of people using a DS9490R or similar host adapter will use parasitic power as you are but with the kernel driver you're much better off powering it from the 3V3 line.

Paul


Thanks for that, that explains a lot!
Posts: 7
Joined: Tue Oct 30, 2012 11:28 am
by JohnInCackalackey » Thu Jan 24, 2013 10:35 pm
anthonyUK wrote:@Rowan
Depending on how many sensors you need, a cost effective method for 1-2 sensors is to use a temper or temper2 USB sensor which are approx. £5 and £10 each.
The temper is a single sensor and the temper2 a dual.
I'm using a temper2 in my fermentation fridge - RRD output HERE


Hi Anthony,
Can you explain how you pulled this together, step-wise? BTW, I'm a totally newbie to programming and R-Pi's. Been using PCs and Macs for 30 years though, so I can probably fumble my way through. My challenge is temp and humidity logging (using TEMPerHUM USB devices) in a greenhouse. I volunteered to help a friend who grows organic tomatoes. We're building a baseline database to model his energy consumption, so we can install some energy saving gear.
Thanks in advance!
John
Posts: 1
Joined: Thu Jan 24, 2013 10:21 pm
by akryx » Mon Apr 22, 2013 1:58 pm
anthonyUK wrote:@Rowan
Depending on how many sensors you need, a cost effective method for 1-2 sensors is to use a temper or temper2 USB sensor which are approx. £5 and £10 each.
The temper is a single sensor and the temper2 a dual.
I'm using a temper2 in my fermentation fridge - RRD output HERE


Hello,
I have temper2 but Im not able found right way to measure both sensors.
I found many how to, but unsuccessful.

Could you help me with step by step?

Thank You

Code: Select all
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 042: ID 0c45:7401 Microdia
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 025: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 027: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
pi@raspberrypi ~ $


Code: Select all
[3017555.721291] usb 1-1.2.4.3: new low-speed USB device number 42 using dwc_otg
[3017555.827614] usb 1-1.2.4.3: New USB device found, idVendor=0c45, idProduct=7401
[3017555.827664] usb 1-1.2.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[3017555.827683] usb 1-1.2.4.3: Product: TEMPer2V1.3
[3017555.827697] usb 1-1.2.4.3: Manufacturer: RDing
[3017555.839598] input: RDing TEMPer2V1.3 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.3/1-1.2.4.3:1.0/input/input7
[3017555.844497] hid-generic 0003:0C45:7401.000F: input,hidraw0: USB HID v1.10 Keyboard [RDing TEMPer2V1.3] on usb-bcm2708_usb-1.2.4.3/input0
[3017555.855634] hid-generic 0003:0C45:7401.0010: hiddev0,hidraw1: USB HID v1.10 Device [RDing TEMPer2V1.3] on usb-bcm2708_usb-1.2.4.3/input1
Posts: 1
Joined: Mon Feb 18, 2013 1:37 am