Page 1 of 1

Re: 1 Wire Sensors for home heating control

Posted: Mon Jan 09, 2012 4:16 pm
by MansfieldMatt
I'm so excited about Raspi. I can't wait to get my hands on them.

I've been pondering building my own system for monitoring and controlling my home heating for a while now but always put it off for one reason or another. Raspi however offers what appears to be the perfect platform on which to build this as it offers an easy bridge from sensors to web server (I want this to be controlled by a web front end).

I have no issue with the web side of things but writing the code to talk to sensors in Linux is virgin territory for me. I would like to use 1-wire sensors as these can be placed at quite a distance from the Raspi and are also very cheap.

e.g. http://www.suntekstore.co.uk/product-14 ... nsor+.html

http://www.suntekstore.co.uk/p.....ensor.html

This would allow be to have a sensor in each room with the eventual ability to control more than just boiler on/boiler off. I intend to add a heat recovery ventilation system to my property as well as additional venting to move hot air to cool rooms. My property is a long bungalow and we have a big wood burning stove at one end so it would be good to automatically shift the warm air it kicks out right to the other end of the bungalow.

So, I know Raspi offers an I2C connector but I2C temperature sensors all seem expensive compared to 1-wire. I know I could use one of the general IO pins to drive this but I don't really have the time to go off learning how to do this. Could anyone help with this?

I''m happy to share my web code once I start on it if anyone would like to help on the hardware side of this.

The eventual vision is to have a control system that is very intelligent (e.g. takes outside temperatures and building heat loss into account), able to control multiple heating/cooling items of equipment but is visually pleasing and easy to use for the end user via devices like iPads.

Re: 1 Wire Sensors for home heating control

Posted: Mon Jan 09, 2012 7:29 pm
by spennig
w1retap (linux 1 wire software) already builds on ARM (I'm just waiting for the release of the production boards to move my 1 wire weather station from an Atom miniITX box5 to Raspi. Using a DS9490R USB adaptor for 1 wire means no additional hardware is required. w1retap is just one of a number of 1 wire applications available for Linux (and running on ARM, oww is another example).

-jh

Re: 1 Wire Sensors for home heating control

Posted: Mon Jan 09, 2012 8:36 pm
by Ianw
Thanks for the Info spennig! I am in the process of planning a migration from Arduino Home Control to Raspberry Pi - searched high and low for the Onewire solution!

Re: 1 Wire Sensors for home heating control

Posted: Mon Jan 09, 2012 9:43 pm
by pepedog
Someone is running owfs on archlinuxarm
http://archlinuxarm.org/forum/.....hilit=Wire

Re: 1 Wire Sensors for home heating control

Posted: Mon Jan 09, 2012 9:53 pm
by error404
There is a GPIO-based 1-wire driver in the kernel. You shouldn't need any special hardware. It will require a custom kernel and some modification of the board definition file, but that should be all.

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 12:37 pm
by MansfieldMatt
error404 said:


There is a GPIO-based 1-wire driver in the kernel. You shouldn't need any special hardware. It will require a custom kernel and some modification of the board definition file, but that should be all.


Would the GPIO port provide sufficient voltage and current to run a 1-wire run? Wouldn't I need something optoisolated from the board with a bit more power?

Any chance of a bit more guidance on the custom kernel and modification of the board definition file as I'm at a loss with both?

Thanks spennig for the w1retap link. Looks a good option but the DS9490R USB doesn't appear to be available anymore. Any ideas where I could get one? I've also seen the DS2483 that appears to be an I2C to 1-Wire bridge but once again I would be lost on the driver front.

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 1:37 pm
by TonyD
Probably not. I don't think the RPi GPIO would have enough current. There is an Maxim app note which shows how to build such an interface. From memory it was a few transistors used to level shift the data and provide power to the 1-wire. If I find it again, I'll post a URl for it

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 5:11 pm
by MansfieldMatt
Thanks TonyD. Is this the article? http://www.maxim-ic.com/app-notes/index.mvp/id/214

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 6:03 pm
by Allan
TonyD said:


Probably not. I don"t think the RPi GPIO would have enough current.



I don't see why not. The 'standard' 1W bus has a 4k7 pullup resistor so the GPIO only needs to sink some 700nA.

If you want to do it the USB way I believe the  DS9490R is still available in the UK from Homechip: http://www.homechip.com/catalo...../index.php

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 6:53 pm
by spennig
The LinkUSB device should also work (tested with w1retap some time ago). Also from Home Chip.

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 9:34 pm
by error404
MansfieldMatt said:


Would the GPIO port provide sufficient voltage and current to run a 1-wire run? Wouldn't I need something optoisolated from the board with a bit more power?


1-wire can be run at either 3.3V or 5V, so if you run a 3.3V bus it will be compatible with the Pi's GPIO. You will need to add a pull-up resistor as mentioned, but little current drive is required and it should be fine. It's a very low-speed bus so cable length isn't a huge issue as long as it's reasonable. You don't need optoisolation unless you are concerned about 'accidents' or have different parts of the circuit connected to different grounds (which, if you power everything from the 'master' side and don't use individual power sources for each sensor, you won't).


Any chance of a bit more guidance on the custom kernel and modification of the board definition file as I'm at a loss with both?


The way Linux deals with different hardware configurations in embedded systems, which tend to be much more varied and have lots of hardware that needs to be configured and wired up to the correct driver is to use a board definition file. It lives in the kernel tree and initializes the hardware and sets up the I/O properly and whatnot. You'd have to modify it to instantiate the w1-gpio driver on the GPIO you want to use. This would just be a couple of lines of code.

However, someone wrote a driver for OpenWRT called w1-gpio-custom so that you can create the w1-gpio instance at module load-time, so you don't need to modify the board file. It's not in the kernel tree, but the source looks like it should work fine. Adding this to the tree is probably more work than modifying the board definition, but it would be more useful to others.

So you've got two options there – add that module to the tree and then configure it at runtime, or modify the board definition to instantiate it then. Either will be pretty easy, but both will require at least some kernel compilation by someone (as will using the USB bridges, probably).


Thanks spennig for the w1retap link. Looks a good option but the DS9490R USB doesn't appear to be available anymore. Any ideas where I could get one? I've also seen the DS2483 that appears to be an I2C to 1-Wire bridge but once again I would be lost on the driver front.


If you want to use OWFS to access 1-wire devices, which is pretty slick IMO, you could also use one of the I2C bridges attached to the Pi's I2C interface. Assuming we get a Linux I2C driver, this should 'just work' if you wire it up properly.

Re: 1 Wire Sensors for home heating control

Posted: Tue Jan 10, 2012 10:39 pm
by Allan


Allan said:

The "standard" 1W bus has a 4k7 pullup resistor so the GPIO only needs to sink some 700nA.


700nA? Did I really say 700nA? it"s 700uA – silly boy Allan!

Re: 1 Wire Sensors for home heating control

Posted: Wed Jan 11, 2012 10:24 am
by nr
I'm currently logging temperatures [1] on arm ARM powered Sheevaplug using a DS2490 and a pair of DS18B20s. The logging side of things is pretty straightforward using digitemp [2] which I've tinkered with a little bit. So the logging side of things *should* be pretty straightforward. I guess I'll find out, as the aged Sheevaplug is destined to be replaced by a Raspi when I can.

I've also enabled logging to Twitter with Net::Twitter::Lite so I can let the world know when I have a cup of tea on the go. Yes, this is basically a rip-off of the Trojan Room coffee pot idea, but I'm not aware of anyone else having a twitter-enabled drinks coaster.

I probably need to get out more.

[1] http://www.ronketti.org.uk/temp.html

[2] http://packages.debian.org/sid/digitemp

Re: 1 Wire Sensors for home heating control

Posted: Wed Jan 11, 2012 11:59 am
by MansfieldMatt
Thanks everyone for all your help. I just need a Raspi now so I can start playing!

Re: 1 Wire Sensors for home heating control

Posted: Wed Jan 11, 2012 5:38 pm
by spennig
A couple of points on the gpio / i2c / usb discussion. It really depends on whether you want an application or you want to tinker with bits. The advantage of the USB devices is that (a) they use libusb, thus no kernel recompilation is involved and (b) they are supported by the Dallas public domain 1w interface library. The Dallas library also supports more devices than the kernel 1 wire drivers (or at least was the case when w1retap development  commenced). The Dallas library is the basis for the device code in w1retap and oww.

Re: 1 Wire Sensors for home heating control

Posted: Thu Jan 19, 2012 4:33 pm
by pegi
I have tried the kernel gpio approach on a Sheevaplug.

This works great but I've found one thing to take into consideration when using 1 wire kernel driver.

To read a DS18B20 you first send a start conversion command and wait for almost a second and the read the result.

The kernel driver does this for every sensor you want to read so to read 10 sensors will take appx. 10 secs whilst other userspace programs will broadcast the start conversion command to all sensors at once and then read them all in one run.

This is probably no problem if you are just logging values.

But if you're controlling things like hot tapwater at the same time then this will be a problem.

Re: 1 Wire Sensors for home heating control

Posted: Thu Feb 21, 2013 1:56 pm
by dgmartin
There seems to be little activity here for a while ... perhaps we can restart some ... ?

I have just got OWFS working on RPi with a DS9490R USB adapter - and was pleasantly surprised how easily it went.

Now I need to think about data logging and 'digitemp' seems a possibility, but it is not on the RPi wheezy repository. Does anyone know or could someone easily port it?

Alternatively recommendations for other OWFS data logging?

Thanks

Re: 1 Wire Sensors for home heating control

Posted: Fri Feb 22, 2013 4:59 pm
by d_older
Hi dgmartin,

One common tool that people, including myself, use is rrdtool which is in the Raspbian repository.

see http://oss.oetiker.ch/rrdtool/

This can generate graphs like this (3 temp sensors and one counter for the gas all over 1-wire/DS2482-100)

You could also look in the "Automation, sensing and robotics" thread for other ideas.

Dave

Re: 1 Wire Sensors for home heating control

Posted: Sat Feb 23, 2013 5:19 pm
by Eusa
d_older wrote:
This can generate graphs like this (3 temp sensors and one counter for the gas all over 1-wire/DS2482-100)
What 1-wire device are you using for the counter on the gas?

Eusa

Re: 1 Wire Sensors for home heating control

Posted: Sat Feb 23, 2013 7:39 pm
by d_older
Hi Eusa,

I'm using a DS2423 mounted on a simple breakout board and then onto a stripboard circuit. I had to get them from http://www.hobby-boards.com in the US as I could not find any over here in the UK. ( I believe that hobby-baords bought in a large quantity once Maxim announced they were stopping production)

Dave

Re: 1 Wire Sensors for home heating control

Posted: Mon Feb 25, 2013 9:03 pm
by Eusa
d_older wrote: I'm using a DS2423 mounted on a simple breakout board and then onto a stripboard circuit. I had to get them from http://www.hobby-boards.com in the US as I could not find any over here in the UK. ( I believe that hobby-baords bought in a large quantity once Maxim announced they were stopping production)
Cheers for the quick reply (that I then didn't notice!).
And there was me hoping there was an existing single 1-wire sensor module that could count the meter led pulses. I'm probably better (easier!) just getting a Current Cost unit I feel.

Re: 1 Wire Sensors for home heating control

Posted: Tue Feb 26, 2013 12:20 am
by d_older
Hi Eusa,

I've had good results detecting LEDs even with an IR photo diode into the counter, although you do need a 5Vdc supply near the meter and I've never tried on a domestic energy meter (+ the counters only being available from the States). Mine's a conventional gas meter with a reflective patch behind the right most dial and the "0" is actually a window. Getting the right location for the IR TX/RX module was a real pain, but seems to give good results ( 4 extra counts in 2.5 months /50,000 pulses).

Dave