Author Topic: Home Temperature/Humidity monitoring  (Read 4183 times)

Home Temperature/Humidity monitoring
« on: 07 January, 2019, 04:23:20 pm »
On my long list of things to get around to (which I'm going to try and be better at tackling from now on) is some temperature and humidity monitoring in my flat.

This is a bit of a brain dump as I'm still in the thinking/planning stage.

We have no tumble dryer so we dry clothes inside[1] (usually the spare room which doubles as my office). We need a dehumidifier anyway as the airflow in the flat isn't great (it's a 4 storey house chopped up into flats so any original concepts of airflow are long gone, no air-bricks above the ground floor, etc). This got me thinking about monitoring temperature and humidity.

Anyway, my ideal solution would have (in preference/implementation order):-
* office / spare bedroom (temp, humidity, radiator temp by ziptie-ing a sensor to the copper inlet pipe to allow me to tell how often the heating is on)
* lounge (temperature/humidity)
* main bedroom (temp)
* hall (temp)
* bathroom (temp, humidity)
* kitchen (temp, humidity)
* MiniGB's bedroom (temp)

I have a soldering iron, dangerously minimal knowledge of DS18B20 Dallas 1-wire stuff (and associated 1-wire humidity sensors), raspberry pis and good linux/scripting/DB/web knowledge to hack something together to do this.

Ideally I'd have one/two/three separate 1-wire networks with minimal spurs, but the wiring plan is the main problem.

The office/spare bedroom and lounge are easy as both have computers in, so an extra bit of RPi stuff behind the scenes won't be a problem, but getting stuff to other parts of the house is tricky as I don't want to be drilling through walls or laying my own ugly cabling anywhere (I suppose I could hide some thin cabling along the edge of carpet/skirting board but this would be a considerable faff.

On a run earlier I remembered that there's a load of wiring already in place in the form of an alarm system with passive IR sensors. We've never used the alarm (mainly because we've got good security anyway, and we're a first floor flat so way less likely to be burgled than a ground floor, and for insurance reasons[2]). I've been meaning to get rid of the alarm system for ages (I put it into maintenance mode long ago and so the control panel by the front door has been blinking a spanner at me for years). The siren has been disconnected but the main alarm box is still wired into the mains (with it's own fuse in a white socket-sized box so hopefully easy to isolate). I was hoping to unhook it from the mains and then use the existing wiring (to the passive IR sensors and the outside alarm box) for the 1-wire stuff. I could then minimise the number of RPis I'd need to deploy around the flat.

The office/spare-bedroom and lounge would still be done by the existing computers (or Pi zeros).
The main bedroom has a panic button wired to the alarm that I could hopefully borrow the cable from.
The hall has the main alarm box in a cupboard so that's an easy location for the central RPi.

The bathroom, kitchen and daughter's bedroom would require some cabling as there's nothing going that way (although the kitchen has a phone extension that doesn't seem to work, it's probably connected to the phone socket in the spare bedroom that also doesn't work (I'm pretty sure the previous occupants had a second line put in at some point). I could hopefully borrow the cabling from that phone extension to connect the kitchen to the spare bedroom.

The other useful thing about using the alarm wiring is that I'd be able to stick a temperature sensor and humidity sensor outside in the existing alarm box (where it will be nicely sheltered from the rain) since there will be a cable from the main alarm box inside to the branded alarm box on the wall outside. (And it'd be nice to have outside temperature and humidity, ideally air pressure too.)

I was also thinking of using the wires between the main alarm box and the keypad by the front door to run USB power there to run a Raspberry Pi that shows the local bus times (https://yacf.co.uk/forum/index.php?topic=71021.msg2077623#msg2077623) as that project has sat doing nothing for two years (and would still be useful).

Eventually I'd like to run an ethernet cable down to where my bike is kept so I can put a RPi/camera/arduino in there and also capture the blinky light on the electricity meter to monitor our usage. Should check again but last time I did it I couldn't get wifi working reliably, too many walls, otherwise this RPi could also get the outside temp/humidity for me.

I'd really like to keep the number of RPis to a minimum (the above plan calls for 4 or even 5 depending on how I do things) and each extra USB wall wart just adds to the fire risk.

[ If/when I ever get the flat rewired I'd get them to put in some proper 3-core cabling everywhere (along with cat 6 networking and aerial coax) so I could do this all properly. ]

Anyway, initial brain dump done, will come back and add to this when I've thought about it some more, would be interesting to hear of anyone else's solutions to this kind of thing.

1. Except for the two weeks in the summer it's nice enough to do this outside, although our patch of garden is a bit of a schlep. In the summer it's just easier to dry clothes inside with the windows open.

2. Home insurance company said declaring the alarm would only take £10 or so off the bill and we'd have to remember to set it every time we went out.
"Yes please" said Squirrel "biscuits are our favourite things."

Kim

  • Timelord
    • Fediverse
Re: Home Temperature/Humidity monitoring
« Reply #1 on: 07 January, 2019, 04:47:32 pm »
Think about how you're positioning the sensors:  By way of illustration, when I got home an hour ago, I turned my lamp on (which has a homebrew current-dimming LED driver, because barakta needs zero-flicker lighting).  Because I like to overengineer things it has several DS18B20s to detect overheats, but at this point it had all spent over 24 hours at ambient temperature...

The temperature sensor on the board, which is in an enclosure at knee height, on top of a tower PC that wasn't switched on read 17.94C
The temperature sensor in the lamp on my desk read 19.50C
The temperature sensor in the lamp on the shelf behind me (maybe 0.75m below ceiling height) read 21.31C

So if you want to be able to meaningfully compare temperatures between rooms, they need to be at similar heights, and away from sources of heat such as radiators, sunlight, Raspberry Pis[1], etc...


Outdoor temperature sensors aren't so much about waterproofing (a decent heat-shrink job should suffice), as getting them away from the wall and shielding them from sunlight.  I have a DS18B20 wired for parasite power[2] on a short cable terminating in a female F-connector connected to one of the down-leads from the satellite dish we aren't using.  The sensor's stuffed into the bracket behind the dish, which by nature of its alignment sticks out from the wall by some distance and serves to shield it from the sun.


If you're doing it properly, don't piss around with 3-core cable, just use cat6 for everything.  1-wire runs just fine on twisted pair, and it means you can do Power-Over-Ethernet to small micros, IP phones, CCTV cameras, or whatever.  I believe the PoE hat[3] for the Raspberry Pi is a bit crap, unfortunately.


If the topography gets challenging, you may get better results from a proper 1-wire driver than a bit-bashed GPIO interface.


RRDTool is your friend.  OWFS saves a lot of reinventing the wheel.


[1] I can't stress enough how much barely-warm-to-the-touch passively cooled electronics will cause temperature sensors to over-read.  If you're connecting one to a Pi or Arduino type board locally, you need it dangling on 20cm of cable, outside any enclosure.
[2] Avoid using parasite power unless you have to for something like this.  It makes things slower and/or glitchy.
[3] I have a Pi in each room, connected to my own board doing Other Stuff, which I've included a PoE module on.  Works well but massive overkill just for temperature/humidity monitoring.

hulver

  • I am a mole and I live in a hole.
Re: Home Temperature/Humidity monitoring
« Reply #2 on: 07 January, 2019, 05:02:09 pm »
I did a bit of fiddling with some ESP8266, some DHT22 and a server running phant.io code.

The code is pretty simple, every 5 minutes it logs the temperature and humidity, then pushes it to my phant server, which logs the room, the temp and humidity. It does this over WiFi. So all I have to do is a box with a power supply, the ESP8266 and the DHT22 in it (the DHT22 bit is external). I can add as many of these as I like, and I even did a low power one that run on batteries for logging the temperatures in the Guinea pig hutch.

I've not actually done much with the data, other than produce some pretty graphs of temperature around the house. But it works quite well. I don't actually have any circuit diagrams, but it's pretty easy. The code is straightforward if you understand that sort of thing already. Yes, it's WiFi, but the server would be easy to run on a Pi, and could all be done locally if you want (no need for any Internet access, just local addresses)

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: Home Temperature/Humidity monitoring
« Reply #3 on: 07 January, 2019, 05:02:52 pm »
I've got something similar running in our house, a bunch of ESP8266 boards scattered round running with SHT30 sensors to provide temperature and humidity.  For the weather station in the garden it's again ESP8266 based with a 1-wire humidity custom board (condensation-resistant) and Davies weather station components connected.

https://taaralabs.eu/1-wire-humidity-temperature-sensor/

There are also some ESP8266 based light and power switched doted round the house for various lights and stuff.

All this goes back over wifi to a mosquetto server using MQTT and is controlled using a node-red server. These could easily run on a pi or virtualised on a router - at the moment I have them on a HP micro-server as it's sat there running other stuff.  I'll probably migrate them to a virtual machine on my router at some point this year I think..

Lights are linked in to Alexa and a web UI plus a random /semi programmed timer for outside and hall lights based on sunrise/sunset etc
Temperature and Humidity are logged and also uploaded to thingspeak
Weather station data is also logged and uploaded to wunderground and tweeted every couple of hours
All data is presented on a desktop touchscreen driven by another ESP8266 listening to the MQTT traffic to then display it.

Only issues I have are
DHT22 style sensors die regularly
ESP8266 eventually die and need replacing (I think this is a eeprom read/write issue)

Yes you will need some wall warts for power - but you could also be cleaver in placement and put them local to existing USB ports (or even swap out some mans socket plates for combined USB & mains ?)

You can get some nice already thought out ESP8266 solutions which just plug together to minimise soldering etc.  I tend to use the WEMOS (and their clones) as there are a lot of ready made shields and 'expander' boards.  https://wiki.wemos.cc/products:d1_mini_shields


I originally started out down the 1-wire route for everything but it's easier to just put it all over wifi :) - there's nothing stopping you from 1-wire to ESP8266 of course :)
Regards,

Joergen

Kim

  • Timelord
    • Fediverse
Re: Home Temperature/Humidity monitoring
« Reply #4 on: 07 January, 2019, 05:10:58 pm »
For the weather station in the garden it's again ESP8266 based with a 1-wire humidity custom board (condensation-resistant) and Davies weather station components connected.

https://taaralabs.eu/1-wire-humidity-temperature-sensor/

That looks handy.  One thing I have discovered is that the DS2438 is much less robust at communications than the DS18B20, presumably because it's designed to be used internally to a device for battery monitoring, rather than on the end of a cable.  It likes to be the only thing on the bus, and seems to get disgruntled about long cable runs.  Star topography is probably Asking For It.

For added 'fun', they sometimes like to interpret line noise as a request to turn the current A/D off, and mysteriously start returning the same value.  Not a problem with the standard humidity sensor design, which only uses the voltage input, but I'm using the current channel for a crude ambient light sensor.

I also had one absolutely shit itself after a nearby lightning strike.  All other electronics in the house were unaffected.  Make of that what you will.


I'd probably still use them for a weather station, but if I were building a humidity sensor into a Raspberry Pi based device again (as I have with the deaf alerting system), I'd use some sort of standard I2C A/D converter, rather than using a DS2438 simply to make the software easier.

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: Home Temperature/Humidity monitoring
« Reply #5 on: 07 January, 2019, 05:36:49 pm »
Yep - it's on a very short leash :D
Regards,

Joergen

Re: Home Temperature/Humidity monitoring
« Reply #6 on: 07 January, 2019, 05:39:55 pm »
If you're doing it properly, don't piss around with 3-core cable, just use cat6 for everything.  1-wire runs just fine on twisted pair, and it means you can do Power-Over-Ethernet to small micros, IP phones, CCTV cameras, or whatever.  I believe the PoE hat[3] for the Raspberry Pi is a bit crap, unfortunately.

Cat 6 done properly would cost £3500 plus redecoration costs (another £3000 probably, plus we'd be looking to replace three carpets at the same time as the redecoration so a further ~£3000). I'd agree that PoE would be lovely, as would getting rid of my powerline stuff, as would being able to do HDMI over cat6 to get good quality telly in my office.

Using existing cabling borrowed from a decommissioned alarm system would be almost free.

If the topography gets challenging, you may get better results from a proper 1-wire driver than a bit-bashed GPIO interface.

I'd be using the modules from Sheepwalk Electronics that use a DS2482-100 and similar rather than direct connection to the GPIO pins, various are available that can give up to 8 separate 1-wire networks, easily enough.
"Yes please" said Squirrel "biscuits are our favourite things."

Kim

  • Timelord
    • Fediverse
Re: Home Temperature/Humidity monitoring
« Reply #7 on: 07 January, 2019, 05:46:53 pm »
The lack of general purpose 1-wire IO devices (preferably in sensible packages) baffles me.  There are a couple of open-drain GPIO options, but the eminently useful DS2450 is no longer in production.  Grr.

Kim

  • Timelord
    • Fediverse
Re: Home Temperature/Humidity monitoring
« Reply #8 on: 07 January, 2019, 05:50:41 pm »
If the topography gets challenging, you may get better results from a proper 1-wire driver than a bit-bashed GPIO interface.

I'd be using the modules from Sheepwalk Electronics that use a DS2482-100 and similar rather than direct connection to the GPIO pins, various are available that can give up to 8 separate 1-wire networks, easily enough.

Yeah, that approach works well.

...which leads me to http://www.brain4home.eu/node/1 which is a good response to my above winge.   :thumbsup:

Afasoas

Re: Home Temperature/Humidity monitoring
« Reply #9 on: 13 January, 2019, 09:09:49 am »
Currently have a rook of ESP8266 and a collection of BME280s for temperature and humidity sensing.
For communication and logging of data between the ESP8266 I'm looking at running and MQTT broker on a Pi.
Also on the Pi, I'll run either NodeRed or OpenHab as a means of displaying and acting on the data.

I'll hopefully be spiking this out in the next couple of months.
For now I've got an ESP8266 attached to a DS18B20 and a script running that retrieves the temperature on 10 minute intervals using HTTP.

Re: Home Temperature/Humidity monitoring
« Reply #10 on: 23 October, 2019, 06:38:21 pm »
Where to get DS18B20 for cheap?

RS and Farnell seem to be selling them for £2.50-£3 each, which is silly.

Was looking more for getting 10 for £5 in total.

Something like this: https://www.amazon.co.uk/DS18B20-Temperature-Long-distance-Multipoint-Detection/dp/B00AYE2T2O but personally I'd like to avoid Amazon (and eBay to a lesser degree) if I can.

I'll also look to get 10 x DHT22 too (where I also want humidity), plus at least one that I can house for outside temp/humidity measurements, plus some random module that does barometric pressure. (Can't remember if multiple DHT22 can be stuck on one bus or not, if not then replace DHT22 with whatever is 1-wire compatible). I'd start off with one and then move from there but the idea is to have ambient temp/humidity measured in each room and then a separate DS18B20 ziptied to the radiator in the room to keep an eye on that.

Also need to get a reel of 4-core low voltage alarm cable but I can go to Screwfix for that and it is under a tenner for a 50m reel.
"Yes please" said Squirrel "biscuits are our favourite things."

WOT

Re: Home Temperature/Humidity monitoring
« Reply #11 on: 23 October, 2019, 07:45:41 pm »
Check out flies thru the air. Very reasonable WiFi temp & humidity sensors and data logging / alarm system. We use them to monitor a controlled environment where I work.

Re: Home Temperature/Humidity monitoring
« Reply #12 on: 24 October, 2019, 10:10:09 am »
Check out flies thru the air. Very reasonable WiFi temp & humidity sensors and data logging / alarm system. We use them to monitor a controlled environment where I work.

https://www.filesthrutheair.com/store ?

The cheapest single sensor seems to be more than my entire planned spending to monitor temp/humidity in 10 different locations, plus barometric pressure and the computer needed to store and graph the resulting data.

Reminded me about CO and CO2 sensors though, was going to monitor that a few rooms (CO in kitchen by the boiler, CO2 in bedrooms and living room) if I can find a suitable cheap sensor.
"Yes please" said Squirrel "biscuits are our favourite things."

fruitcake

  • some kind of fruitcake
Re: Home Temperature/Humidity monitoring
« Reply #13 on: 24 October, 2019, 11:23:11 am »
What will you do with the data? i.e. what is the aim of the monitoring project?

Re: Home Temperature/Humidity monitoring
« Reply #14 on: 24 October, 2019, 11:51:39 am »
Just personal interest mainly. It's a fun toy project.

Keep an eye on temperature at home, see if one bedroom is colder than the other.
See what effect drying clothes indoors has on humidity in the different rooms.
If I get to monitor CO [EDIT - Thanks Kim!] CO2 then see how high it goes at night in each of the bedrooms.
Track how much we use the heating.

Also an excuse to remove the existing alarm system (which we've never used) and replace the alarm keypad with my bus time display.

And I get to play around with Grafana or D3.js and other such things.

I've no plans for it to control anything.
"Yes please" said Squirrel "biscuits are our favourite things."

Kim

  • Timelord
    • Fediverse
Re: Home Temperature/Humidity monitoring
« Reply #15 on: 24 October, 2019, 01:23:33 pm »
Are you confusing CO with CO2?  If you've got CO in your bedroom at night, you need to do more than monitor it...

Re: Home Temperature/Humidity monitoring
« Reply #16 on: 24 October, 2019, 01:31:27 pm »
Are you confusing CO with CO2?  If you've got CO in your bedroom at night, you need to do more than monitor it...

Ha, yes.

CO monitor in the kitchen.
CO2 monitors in the bedrooms/living room.

I read somewhere about sleep quality being affected by CO2 build up in bedrooms. Bad news is the flat is a converted house so air circulation is poor but good news are the bedrooms are large.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Home Temperature/Humidity monitoring
« Reply #17 on: 26 October, 2019, 05:55:13 pm »
Where to get DS18B20 for cheap?

RS and Farnell seem to be selling them for £2.50-£3 each, which is silly.

Was looking more for getting 10 for £5 in total.

Something like this: https://www.amazon.co.uk/DS18B20-Temperature-Long-distance-Multipoint-Detection/dp/B00AYE2T2O but personally I'd like to avoid Amazon (and eBay to a lesser degree) if I can.

Ordered the above (delivery 22nd November after they arrive on the slow boat from China). Worth a punt at that price.

Will look for a couple of DHT22's to start with too, and get the alarm cable from Screwfix or similar this week.

Removing the alarm system is the first job, and that means getting my multimeter working again (need to resolder the battery cable inside) so I can make 100% sure the mains power is off when I try to disconnect it.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Home Temperature/Humidity monitoring
« Reply #18 on: 19 November, 2019, 07:19:59 pm »
Slow progress.

10 x DS18B20 arrived. Also got 3 x DHT22 to play around with.

Screwfix didn't have any alarm cable so I settled on 4 core telephone cable.

Multimeter fixed and will find an appropriate time to start to remove the alarm system and trace the wiring that is left.

Good timing as Mrs GB has been complaining about the gentle "clicking" sound from the PIR sensor in the bedroom throughout the night (no idea why it is sensing movement when there is none, it can't be so sensitive it is set off by breating!), so decommisioning the alarm system has a genuine need.
"Yes please" said Squirrel "biscuits are our favourite things."

quixoticgeek

  • Mostly Harmless
Re: Home Temperature/Humidity monitoring
« Reply #19 on: 19 November, 2019, 08:16:44 pm »

I've been fettling things like this for a while, and have concluded that zigbee and bluetooth sensors are just easier, they are so damn cheap on aliexpress, there's simple software for the raspberry pi to make it work using mqtt, that it's just a no brainer not to do it that way, at least to me.

Now, what to do with these 1-wire sensors I never got to work...

J
--
Beer, bikes, and backpacking
http://b.42q.eu/

Re: Home Temperature/Humidity monitoring
« Reply #20 on: 20 November, 2019, 09:34:26 am »

I've been fettling things like this for a while, and have concluded that zigbee and bluetooth sensors are just easier, they are so damn cheap on aliexpress

How cheap? Links?
"Yes please" said Squirrel "biscuits are our favourite things."

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: Home Temperature/Humidity monitoring
« Reply #21 on: 20 November, 2019, 11:02:03 am »
I very much doubt you'll get an xbee unit less than you can get a ESP8266 for but happy to be educated, last I looked xbee were circa £18 each, esp8266 circa £4 each.

I've been a bit productive this last few weeks, thermostat progressed and a couple of sensors dotted around the house and some more Node.red action in the backend.

Regards,

Joergen

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: Home Temperature/Humidity monitoring
« Reply #22 on: 20 November, 2019, 11:38:43 am »
You can get NRF24L01 units for circa $8 each which might be an alternative to an xbee (though you need to put the protocol in to a mcu still. )

example: https://www.mysensors.org/hardware/slim-node
Regards,

Joergen

Re: Home Temperature/Humidity monitoring
« Reply #23 on: 20 November, 2019, 12:57:52 pm »
Interesting to look at this kind of thing: https://www.aliexpress.com/item/32819531770.html?spm=a2g0o.productlist.0.0.773436e3Ofoep1&algo_pvid=027ffc52-db9a-4772-821d-acb69a7a1fd8&algo_expid=027ffc52-db9a-4772-821d-acb69a7a1fd8-1&btsid=a2c223cb-0b3f-4361-a4f9-6d4cb0a7bec7&ws_ab_test=searchweb0_0,searchweb201602_8,searchweb201603_52

(Assuming it can be made to talk to a RPi via Zigbee rather than via a specific App)

Pros:
* Wireless
* Majority of the work is done for me
* Versions with humidity and/or pressure sensors are available

Cons:
* Slightly more expensive than a DIY solution but not prohibitively expensive
* Can't easily add sensors on pipes (I was going to ziptie a DS18B20 to some pipes to track hot water and central heating usage)
* Batteries - all the CR2032 batteries - not very environmentally friendly and a faff to be replacing them frequently
"Yes please" said Squirrel "biscuits are our favourite things."

quixoticgeek

  • Mostly Harmless
Re: Home Temperature/Humidity monitoring
« Reply #24 on: 20 November, 2019, 01:11:12 pm »

I've been fettling things like this for a while, and have concluded that zigbee and bluetooth sensors are just easier, they are so damn cheap on aliexpress

How cheap? Links?

https://www.aliexpress.com/item/32843489009.html - about €9 per sensor, plug and play. This uses bluetooth, so works straight off with a raspberry pi 4.

There are zigbee ones like this:

https://www.aliexpress.com/item/32946812631.html - marginally cheaper, but you'd need more effort with a zigbee usb stick. Also doesn't have the display, for not much less.

J
--
Beer, bikes, and backpacking
http://b.42q.eu/