paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Home temperature monitoring

Tue Jan 02, 2018 3:59 am

With the cold weather that is hitting a lot of America at the moment, I am looking to build a home temperature monitor using The Raspberry Pi. I have built other Pi projects, but I cannot see recently published tutorials on how to build a remote temperature (and possibly humidity) monitor.

My top level requirements are:
- 2-4 sensors ( one or two for internal house temperature, one for outside temp and one for spare)
- Raspberry Pi running a web server that can be accessed remotely via the internet
- Ability to view temperatures using a phone/tablet
- Ability to set hi/lo alarm levels with email (or SMS) alerts
- Results stored in a database table and accessible for viewing as a graph. I need to be able to select the graph period - last day, week, month, year etc

I am familiar with the DS18B20 type temperature sensors and can use those or wireless sensors if these are available.

Are there any instructions on building such a system?

Thanks,

Paul

User avatar
Gavinmc42
Posts: 2173
Joined: Wed Aug 28, 2013 3:31 am

Re: Home temperature monitoring

Tue Jan 02, 2018 1:44 pm

Probably the Weather Station pages?
Also some home automation pages.
Read them all and see if any fit your app, if not you will have a few ideas for rolling your own.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Tue Jan 02, 2018 3:59 pm

Thanks - I looked at the Weather Station project but that seems too expensive ($142) and too much for what I want to do, which is basic temperature and humidity measurement of a remote house for safety reasons. I do not need the features such as wind speed, direction and atmospheric pressure, but what I do need is more that one, preferably four, temperature inputs. These are for inside upstairs and basement room temperature monitoring and monitoring of the temperatures inside the wall cavity where the water pipe enters the building.

Paul

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: Home temperature monitoring

Tue Jan 02, 2018 9:36 pm

I think you are going to be building that from scratch with pieces of code from other projects. Upside: it will do exactly what you need and have a low overhead. (as opposed to something like Cactus which I found to be a pig on resources. Couldn't remove it fast enough)

Multiple Zero W with DS18B20 and one with another type that senses humidity as well as temp? I have a bme280 in use but it's one downside is that it is fragile...inside only.
I like rrdtool for lightweight database and graphing. You could spend a long time looking at examples online if you get stuck.
nginx or apache with php to serve it is easy to setup and (relatively) lock down.

I don't have an alarm for hi/low but that would be interesting to do. Probably trivial for a skilled person like some here.

This is on a Pi in my house. Top graph is cpu temp from this pi and outside temp that another pi (outside sends over via scp every 5 min), middle graph is temp/humidity in the house from a bme280 sensor. Lowest graph is pressure from that same sensor. I only keep two days because I wasn't interested in historical data... just trends now. This pi runs a little warm because it also has a camera and and 433mhz transmitter turning on/off lights.

Image

I would advise using a usb flash drive to save the data and serve it from to save wear on your micro sd card.

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Tue Jan 02, 2018 11:57 pm

I like this solution. Thanks for the lead. I have looked at RRDTool and it looks good. I am also familiar with the DS18B20 onewire sensors. I have used a Raspberry Pi 3B and am excited about the cost and compactness of the Pi Zero. I assume this boots up to some default Ip and I can use remote desktop to gain access to it and load programs, set up security etc.

What I do not understand at this point is what program I load to receive the temperature from the sensor and load it into a table that RRDTool can use. From the brief look at RRDTool I did, it did not look like it interfaced directly with the sensor. Am I correct?

Thanks. Sorry for the Noob questions. I am new to this.

Paul

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: Home temperature monitoring

Wed Jan 03, 2018 12:30 am

that's cool, no worries.

you need scripts: python, bash, etc to get info from the sensor and write to the rrd database, then a script to take that data from the db and make the graph. Cron takes care of it all at the interval you choose. It's automated, hands off once you get it working.

There is not action to be taken once it's setup. If the pi is running, then it's making graphs with data.
I set my router to hand out a specified IP to each Pi on my network instead of messing around with trying to set static on the Pi. It's as static as I need it to be that way.

The scripts I use are from various sources I found online through google and modified for my own purposes. I'd be happy to post them for you.


Edit: I started here a year ago. It explains a lot about rrdtool in an easy way:
https://calomel.org/rrdtool.html

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Wed Jan 03, 2018 4:08 am

Thanks so much for the help and quick replys. My experience is limited to downloading a turnkey application and hooking the Pi up to an Arduino and power control relays. It was a complex set-up but only involved downloading applications and no programming.

Are there any resources you found helpful in learning how to write scripts? It all seems a little intimidating to me at the moment. I guess like all projects the first thing is to map out the data flow from sensor to graph.

Paul

btidey
Posts: 1599
Joined: Sun Feb 17, 2013 6:51 pm

Re: Home temperature monitoring

Wed Jan 03, 2018 9:58 am

I use a raspberry Pi running EasyIOT as the central database / web interface but decided to use esp8266 modules for the remote ds1b820 sensors rather than Pi Zeros.

These wifi processor modules are programmed like arduinos and are very small and very cheap. That allows deploying lots in an unobtrusive fashion.

For example,
https://www.thingiverse.com/thing:2166068/
temp1.jpg
temp1.jpg (40.4 KiB) Viewed 15578 times
Sensor program https://github.com/roberttidey/ds18b20-esp8266

Example EasyIoT screens
temp2.jpg
temp2.jpg (55.01 KiB) Viewed 15578 times
temp3.jpg
temp3.jpg (57.25 KiB) Viewed 15578 times

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: Home temperature monitoring

Wed Jan 03, 2018 2:59 pm

That looks like a more elegant (and well supported) solution than what I am doing. Very nice.

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Wed Jan 03, 2018 4:31 pm

Thanks. I was not aware of the Easy IOT environment or the ESP8266 modules. They seem good and can be battery powered making installation easier.

Have I got this right? Easy IOT gets loaded onto the Raspberry Pi (or Pi Zero W) and remotely the ESP8266 modules are connected to temp sensors such as the DS18B20. The sensor nodes are then added to the Easy IOT program, reported and displayed over time. I am guessing that something like Open VPN can then be run on the Pi to allow access over the internet from a tablet or computer miles away?

What is the range of sensors that could be added to the ESP8266? Can a voltage monitor be added for monitoring the health of remote sensors?

Paul

User avatar
bensimmo
Posts: 3458
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Home temperature monitoring

Wed Jan 03, 2018 6:04 pm

I don't know too much about them but they in some forms become an Arduino-ish with direct WiFi on them.
Using NodeMCU and LUA (something like that).
That's about it from me, something I intend to look into.
http://www.esp8266.com

Seems to be where adafruit keep pointing to for information.


Also it's WiFi so battery usage is probably not going to be the way to power them, I think it'll be. About 250mA for the WiFi from the few bits I've scanned over, though it will depend if it can power down up etc, please report back :-) .

My A+/Zero's are not far of that power draw.... at idle.

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Wed Jan 03, 2018 6:35 pm

Thanks - from what I have researched, they have a 'deep sleep' mode so a Lithium AA can in theory power the ESP8266 for a couple of years if readings are being taken every 5 mins or so. Practically as long as I get to once/year battery replacement, like smoke detectors, I am happy.

See this: https://hackaday.com/2017/12/03/minimiz ... ery-drain/

You are correct in that they seem to use the Arduino IDE which runs well on the Pi.

Paul

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Wed Jan 03, 2018 6:42 pm

Just to clarify, I meant AA form factor batteries. The actual battery would be a 18650 type battery which is 3.6V.

Paul

btidey
Posts: 1599
Joined: Sun Feb 17, 2013 6:51 pm

Re: Home temperature monitoring

Wed Jan 03, 2018 6:55 pm

paulthbrit wrote:
Wed Jan 03, 2018 4:31 pm
Thanks. I was not aware of the Easy IOT environment or the ESP8266 modules. They seem good and can be battery powered making installation easier.

Have I got this right? Easy IOT gets loaded onto the Raspberry Pi (or Pi Zero W) and remotely the ESP8266 modules are connected to temp sensors such as the DS18B20. The sensor nodes are then added to the Easy IOT program, reported and displayed over time. I am guessing that something like Open VPN can then be run on the Pi to allow access over the internet from a tablet or computer miles away?

What is the range of sensors that could be added to the ESP8266? Can a voltage monitor be added for monitoring the health of remote sensors?

Paul
Yes. EasyIOT is installed on Raspberry. You can then define logical sensors and controls on that. The logical sensors then get their input from remote devices sending in data periodically either via a REST interface or MQTT messaging via their wifi interface.. The ESP modules are the remote sensors with a local ds18b20 temperature sensor attached. You can have multiple sensors being read and reported from one esp8266 module if it makes sense to do so but you then have to have the wire from the module to the actual sensors. This one wire connection to the ds18b20 can be quite long, but most of the time it is more convenient to keep it short and use the wifi to avoid dealing with wiring. It is good to keep the sensor away from electronics as otherwise you might find the reading a little too high from the heat from the electronics I normally have them on a external stub of a few cms.

The wifi range of the esp modules is very good and I have no problem getting reliable reporting all over my house.

The average current consumption of the modules is about 80mA with wifi active. There are short duration peaks of about 300mA when the wifi transmits but that doesn't affect the average consumption.

As you noted It is possible to put the module into deep sleep (current consumption ~ 20uA) and get it to wake up periodically, take a reading, report it and go back to sleep. That makes battery operation pretty feasible particularly if the readings are spaced out quite a bit.

The modules do have one ADC input which can be used to monitor either its own supply or an external voltage like the battery before a regulator if a potential divider is used.

btidey
Posts: 1599
Joined: Sun Feb 17, 2013 6:51 pm

Re: Home temperature monitoring

Wed Jan 03, 2018 7:11 pm

paulthbrit wrote:
Wed Jan 03, 2018 4:31 pm
I am guessing that something like Open VPN can then be run on the Pi to allow access over the internet from a tablet or computer miles away?
Paul
The easyIOT web interface has user login security so you can access it remotely just by forwarding a port on the router with reasonable security. VPN could be used to make it even more secure.

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Wed Jan 03, 2018 7:24 pm

I am liking this solution and have just ordered a bunch of parts on Amazon including a Pi Zero W, the Huzzah ESP8266 breakout, some DHT11 sensors and connection parts. I am looking forward to this, but I am sure will have lots of questions regarding setting it up and configuring the software.

I am not familiar with REST or MQTT. Are these hard to configure?

All the best,

Paul

User avatar
DougieLawson
Posts: 34166
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Home temperature monitoring

Wed Jan 03, 2018 9:39 pm

Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

btidey
Posts: 1599
Joined: Sun Feb 17, 2013 6:51 pm

Re: Home temperature monitoring

Wed Jan 03, 2018 10:06 pm

REST is essentially just making a http request.

So an example of sending a temperature to easyIOT sensor N1S0 using this method means POST to
http://host:port/Api/EasyIoT/Control/Module/Virtual/N1S0/ControlLevel/21.5

ranpitime
Posts: 68
Joined: Sat Mar 23, 2013 5:21 am

Re: Home temperature monitoring

Thu Jan 04, 2018 9:49 am

Hi,
for me a good option was to use the ruuvi tags (https://tag.ruuvi.com/)
temp/huminity collecting via bluetooth on Pi Zero W.
Main benefit is:
No wiring needed ;)
There is a python lib available to read them.

BR
ranpitime

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Thu Jan 04, 2018 5:21 pm

Thanks for the information on Ruuvi. I had no idea about them or Google's Eddystone framework and have spent the last hour reading and watching videos to learn more.

The beacons appear to cost ~70 Euro for 3 on their web site? Is that the only way of buying them? It would be interesting to experiment with them.

Thanks. Lots of ideas here. We live in exciting times.

Paul

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Fri Jan 05, 2018 3:16 am

Btidey: What sort of sampling period do you have set up on your system and what sort of power supply is used? If batteries, what sort of battery life are you seeing?

Are there any other details of your ESP8266 sensor based system you can share?

Thanks,

Paul

hunty1980
Posts: 36
Joined: Mon May 22, 2017 3:25 pm

Re: Home temperature monitoring

Fri Jan 05, 2018 3:38 pm

@paul - following this thread with great interest. With the help of the kind and knowledgeable people on this forum, I'm now controlling my hot water and central heating using a Raspberry Pi 3 and Node-Red. Still pretty basic On/Off and Daily Schedules.

I'm still controlling the central heating temperature using a standard hall thermostat, but starting to play with a 'smarter' alternative. I like the idea of using battery power ESP8266 modules positioned in various rooms around the house. I can then analyse how the house warms and cools - thus being able to optimise heating schedules and heating shut off temps.

Today I connected a BMP085 Temperature Module to a Pi Zero W, which is sending the Lounge temperature via MQTT to a Node-Red Dashboard (see the screenshot below).

If you get chance I recommend you have a play with Node-Red. It comes installed as standard on Raspbian Stretch. Easy to use and very powerful.

I have a few Pi Zero W lying around the house, which I could use, but I like the idea of the battery power - hence keen to see what you do with the ESP8266 modules.

Any chance you can share what components you've purchased for the temp node build?

Image

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Fri Jan 05, 2018 4:54 pm

Hi Hunty. I have a Raspberry Pi3 connected to an Arduino Uno and power control relays that is running the BrewPi application in order to control fermentation temperature of my Homebrew beer. A worthy application! Fermentation temperatures are critical and follow a profile over the course of a week or so and the freezer that I use is in a garage location which has close to 100F of temperature swing in the course of a year so the BrewPi application is controlling the fermenting beer temperature (not the fridge temperature to within 0.1 degree F. that has worked well over the past year.

Moving on from that I have a summer house that I am trying to monitor the temperatures at. I currently have two NEST thermostats and a webcam I can steer to point at an indoor thermostat to see what the temperature is. This is a cumbersome, and expensive solution, but I put it in 2-3 years ago before I knew, or had the confidence to dabble with Raspberry Pi, ESP8266, Arduinos etc. So now I am looking to come up with a better monitoring solution.

My first thought was to buy a turnkey weather station but this didn't do quite what I want to do (monitor temperature at various points in the house) and was expensive. So what I have ordered and should arrive tomorrow is:
- A Huzzah ESP8266 Breakout development board ($12)
- An Adafruit Pi Cobbler plus breakout cable ($11)
- A Uctronics ESP8266 Weather station IoT starter kit with another ESP8266, development board and 0.96" OLED display and DHT11 sensor ($18)
- A 5 pack of DHT11 temp/humidity sensors ($13)
-A Raspberry Pi zero Wireless kit with 16GB card, power supply, case, HDMI & USB adapters etc ($33)

This should get me going so I can learn more about the 8266 modules and EasyIoT to see if they will do the job.

I must say I am impressed with the RUUVI tags though. See post above by RanPiTime. I almost bought a three pack of those as well to experiment with ($83) but was put off by the $24 shipping fee from Finland. They need more of a US presence to get going.

All the best. It's 7 degrees F (-14C) outside here at the moment so pipes freezing are a real concern and heating is electric baseboard which is expensive to run and I need a more accurate picture of the actual temperatures of the pipes and water shut-off valves in order to set the thermostats to the optimum temperature to prevent freezing.

Paul

paulthbrit
Posts: 21
Joined: Sat Feb 25, 2017 4:56 pm
Location: Bergen County, New Jersey, USA
Contact: Facebook

Re: Home temperature monitoring

Sun Jan 07, 2018 3:12 am

Status Update:

All the hardware I ordered arrived today. So far I have the ESP8266 module running, connected to a DHT11 and have uploaded several test programs to flash and LED and verify WiFi operation. That was easy. The Raspberry Pi is loaded with Debian, the Arduino IDE and mono in preparation for installation of EasyIoT. That is where things stopped.

I find the support information for Easy IoT very poor and not a lot of good tutorials or information in the IoT-Playground forums. I registered for an account five hours ago, but am waiting for the confirmation email so I cannot post a question there.

I downloaded the Easy IoT for Raspberry and the instructions say that a .img file should be created when it is unzipped, but there are no .img files and I do not know what files need to be loaded on the Pi or where to load them. When I started I thought that loading EasyIoT would be a simple matter of doing a 'sudo apt-get Easy IoT' but it does not appear to be that simple.

I'll work it out and report back.

Paul

btidey
Posts: 1599
Joined: Sun Feb 17, 2013 6:51 pm

Re: Home temperature monitoring

Sun Jan 07, 2018 11:21 am

paulthbrit wrote:
Fri Jan 05, 2018 3:16 am
Btidey: What sort of sampling period do you have set up on your system and what sort of power supply is used? If batteries, what sort of battery life are you seeing?

Are there any other details of your ESP8266 sensor based system you can share?

Thanks,

Paul
My esp8266 temp sensors pick up their config (easyIOT node address, sampling parameters etc) from a central config file stored on the easyIOT web server. They pick out their own settings based on their Mac address. That keeps the firmware identical in all modules and makes it easy to adjust parameters without changing firmware.

Instead of a fixed sampling rate, the sensors report normally report whenever the temperature changes but also enforce a minimum reporting interval which I normally have set at 60 seconds. I use a separate interval setting to enforce a report even if nothing has changed and I normally have that at 10 minutes.

All my temperature sensors are mains powered. I took this decision as for me it was easy to find a power outlet in each location particularly as the sensors are small. As I have a lot of sensors I didn't want the aggravation of battery changing / charging even if I used sleep to give 1 to 2 year life. Some of my early sensors run off usb from a usb power brick, but most now have a tiny AC to 3.3V power brick inside so they just plug right and are hardly noticeable.

I do have some PIR sensors based on the esp8266 which are battery powered and these have been giving very good battery life. They are in deep sleep all the time until the PIR detects motion and turns them on to report to my security system. They use small 400maH rechargeable LIPO and checking the state of charge I reckon I will get about 1 year usage between charges.

Return to “Automation, sensing and robotics”