omatrot
Posts: 1
Joined: Sun Mar 13, 2016 5:55 pm

Home Automation with the Pi 3

Sun Mar 13, 2016 6:11 pm

I would like to control an air extractor in my bathroom based on the local moisture level.
I have a moisture and temperature sensor (Oregon scientific THGR 122 NX).
The idea is to get a Bluetooth switch to power the extractor and an USB 433Mhz receiver to connect to the Pi.
If someone tried that (or something similar) already, please let me know. I'm not sure about the support of the received under Windows 10 for IoT.
Of course I'll have to wait for W10 to support the Pi Bluetooth.

Thanks in advance.
Olivier.

User avatar
ab1jx
Posts: 868
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: Home Automation with the Pi 3

Sun May 01, 2016 8:22 pm

I was just looking around to see what was supported if anything. I have an EMR211 thermometer (Oregon Scientific). The thermometer transmits over 433 MHz to an indoor unit, which then retransmits on Bluetooth. There are Android and iPhone apps for processing the retransmitted data The Android one is awful, keeps unpairing.

Image
Is an example of what the app does. Notice the listed minimum temp doesn't match the plotted one. It really got down to -18 that night, I stayed up watching. But this was over bluetooth to a phone. I'd like to send this data to my Pi.

Your posted sensor number looked familiar, this base unit comes with a THN132N which only does temperature, but there's mention of using a different sensor to read humidity. Searching my PDF for the EMR211 doesn't find your sensor number though.

I just got my Pi 3 yesterday, I've got about 2 days more by torrent before I have the full Raspbian image (I have the Lite). But I can scan on my Pi and see a bluetooth device IDTW211R which is probably the thermometer. No clue how to decode it. The app does a daily temperature plot, I'd like to record over longer periods and be able to do something other than screenshots for records. The Pi 3 coming with bluetooth opens up possibilities.

Take a look at https://github.com/kevinmehall/rtlsdr-433m-sensor for a way to use an RTL2832 DVB/SDR dongle to directly receive the 433 MHz signal. Or here http://www.gearbest.com/transmitters-re ... aQodvJAFPg for a dirt-cheap (under $1) receiver module.

I little tutorial on bluetooth programming I just found: http://people.csail.mit.edu/rudolph/Tea ... BTBook.pdf But it was written in 2005, doesn't cover low energy bluetooth (BLE). One of the example programs finds my phone, not my thermometer.

User avatar
ab1jx
Posts: 868
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: Home Automation with the Pi 3

Sat Jul 02, 2016 2:06 pm

7/2/2016 I discovered this on decoding the 433 MHz directly with Gnuradio: https://github.com/kevinmehall/rtlsdr-433m-sensor

Arn0
Posts: 1
Joined: Thu Sep 15, 2016 11:39 am

Re: Home Automation with the Pi 3

Thu Sep 15, 2016 11:45 am

You'll find how to connect your BLE thermometer to Raspberry Pi and collect temperature data on this post: http://www.instructables.com/id/Connect ... -BLE-Weat/
Last edited by Arn0 on Wed Sep 28, 2016 8:04 am, edited 1 time in total.

User avatar
ab1jx
Posts: 868
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: Home Automation with the Pi 3

Thu Sep 15, 2016 2:22 pm

Nah, I've been doing it since July, I just haven't cleaned up my code enough to post. I'm using rtl_433 with an rtl2832 dongle like http://www.nooelec.com/store/sdr/sdr-re ... r820t.html (Just bought my 3rd one because I have 2 in semi-permanent use now).

I run it like

Code: Select all

rtl_433 >> afile.txt
and I get a pair of (usually equal) data points about once a minute into my text file. It has output options like csv, json but I wrote my own program to parse the default text file and write time_t and temperature values out to another file, which I run when I feel like it. A plot file for Gnuplot does the actual plotting. I'm interested in having probably a weekly plot and something like a yearly one of daily averages or highs and lows, I haven't decided exactly what I want to do, I'm just gathering data.

Raw output from rtl_433 looks like:

Code: Select all

Registering protocol "Silvercrest Remote Control"
Registering protocol "Rubicson Temperature Sensor"
Registering protocol "Prologue Temperature Sensor"
Registering protocol "Waveman Switch Transmitter"
Registering protocol "Steffen Switch Transmitter"
Registering protocol "ELV EM 1000"
Registering protocol "ELV WS 2000"
Registering protocol "LaCrosse TX Temperature / Humidity Sensor"
Registering protocol "Acurite 5n1 Weather Station"
Registering protocol "Acurite Temperature and Humidity Sensor"
Registering protocol "Oregon Scientific Weather Sensor"
Registering protocol "Mebus 433"
Registering protocol "Intertechno 433"
Registering protocol "KlikAanKlikUit Wireless Switch"
Registering protocol "AlectoV1 Weather Sensor (Alecto WS3500 WS4500 Ventus W155/W044 Oregon)"
Registering protocol "Cardin S466-TX2"
Registering protocol "Fine Offset Electronics, WH-2 Sensor"
Registering protocol "Nexus Temperature & Humidity Sensor"
Registering protocol "Ambient Weather Temperature Sensor"
Registering protocol "Calibeur RF-104 Sensor"
Registering protocol "X10 RF"
Registering protocol "DSC Security Contact"
Registering protocol "Brennstuhl RCS 2044"
Registering protocol "GT-WT-02 Sensor"
Registering protocol "Danfoss CFR Thermostat"
Registering protocol "Energy Count 3000 (868.3 MHz)"
Registering protocol "Valeo Car Key"
Registering protocol "Chuango Security Technology"
Registering protocol "Generic Remote SC226x EV1527"
Registering protocol "TFA-Twin-Plus-30.3049 and Ea2 BL999"
Registering protocol "Fine Offset WH1080 Weather Station"
Registering protocol "WT450"
Registering protocol "LaCrosse WS-2310 Weather Station"
Registering protocol "Esperanza EWS"
Registering protocol "Efergy e2 classic"
Registering protocol "Inovalley kw9015b rain and Temperature weather station"
Registering protocol "Generic temperature sensor 1"
Registering protocol "Acurite 592TXR Temperature/Humidity Sensor and 5n1 Weather Station"
Registering protocol "Acurite 986 Refrigerator / Freezer Thermometer"
Registering protocol "HIDEKI TS04 Temperature and Humidity Sensor"
Registering protocol "Watchman Sonic / Apollo Ultrasonic / Beckett Rocket oil tank monitor"
Registering protocol "CurrentCost Current Sensor"
Registering protocol "emonTx OpenEnergyMonitor"
Registering protocol "HT680 Remote control"
Registering protocol "S3318P Temperature & Humidity Sensor"
Registering protocol "Akhan 100F14 remote keyless entry"
Registering protocol "Quhwa"
Registering protocol "OSv1 Temperature Sensor"
Registering protocol "Proove"
Registering protocol "Bresser Thermo-/Hygro-Sensor 3CH"
Registering protocol "Springfield Temperature and Soil Moisture"
Registering protocol "Oregon Scientific SL109H Remote Thermal Hygro Sensor"
Registering protocol "Acurite 606TX Temperature Sensor"
Registering protocol "TFA pool temperature sensor"
Registering protocol "Kedsum Temperature & Humidity Sensor"
Registering protocol "blyss DC5-UK-WH (433.92 MHz)"
Registering protocol "Steelmate TPMS"
Registering protocol "Schraeder TPMS"
Registering protocol "LightwaveRF"
Registering protocol "Elro DB286A Doorbell"
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000013

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 250000.000414 Hz
Sample rate set to 250000.
Bit detection level set to 8000.
Tuner gain set to Auto.
Reading samples in async mode...
Tuned to 433920000 Hz.
2016-07-26 09:34:15 :	Thermo Sensor THN132N
	House Code:	 255
	Channel:	 1
	Battery:	 OK
	Temperature:	 23.10 C
2016-07-26 09:34:15 :	Thermo Sensor THN132N
	House Code:	 255
	Channel:	 1
	Battery:	 OK
	Temperature:	 23.10 C
2016-07-26 09:34:54 :	Thermo Sensor THN132N
	House Code:	 255
	Channel:	 1
	Battery:	 OK
	Temperature:	 23.10 C
The timing between points is slightly variable around a minute, it probably comes from something like a 555 timer in the sensor (it has no clock) and rtl_433 attaches the system time to each data point when it gets it. I'd run it for a month or so thinking it was stable and suddenly got a sporadic outlier, a point about 20 degrees higher than the rest. I can suppress those, I just haven't done it yet. In 2 1/2 months the raw text file has gotten up to 22 megabytes, not unmanageable. I'm not sure I'm going to keep the time_t format (numbers like 146954056), it seemed like a good idea at the time but it's not exactly human readable.

rtl_433 is at https://github.com/merbanan/rtl_433
Attachments
2labc_2016-08-09_1823.gif
2labc_2016-08-09_1823.gif (36.83 KiB) Viewed 6896 times

User avatar
ab1jx
Posts: 868
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: Home Automation with the Pi 3

Thu Jan 26, 2017 6:23 pm

6 months of data now, I've wanted to be able to do this kind of monitoring for years. And I wasn't even thinking of monitoring global warming initially.

Here I see a warming trend around January 1, a leveling off. I could do some smoothing but this is roughly a data point every minute for 6 months, 469072 lines in my tab delimited file I fed to Gnuplot. I haven't put my average and dual temperature scales into this plot file yet. I wish I had years of such data.

Quick and dirty plot file, averaging and dual scales took posts to the gnuplot mailing list. My time data is in unix time_t format, values like 1485450464.

Code: Select all

reset
set terminal gif size 1024,768
set output "first.gif"
set xdata time
set timefmt x "%s"
set format x "%b-%d"
set style data lines
set xtics auto
plot "outvals.tab" using 1:2 with lines
Attachments
first.gif
first.gif (25.24 KiB) Viewed 5703 times

User avatar
ab1jx
Posts: 868
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: Home Automation with the Pi 3

Tue Mar 05, 2019 4:15 pm

I was sort of looking at why there are so many skeptics about global warming and people who'd rather not believe it. I tried overlaying one year's plot over the other, that didn't work very well. About the only thing this is useful for is to look at and say "Yup, this is March, should be warming up soon" But both years also have a dip in March, it was 7 F (-14 C) last night.
2017-2018.gif
2017-2018.gif (51.81 KiB) Viewed 1493 times
The changes that global warming makes are quite small and hard to see in the short scale of 2 years. But I remember winters with snowbanks 10 feet tall beside the roads and snow 6 feet deep in the woods.

User avatar
ab1jx
Posts: 868
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: Home Automation with the Pi 3

Tue Mar 05, 2019 4:27 pm

It works much better to do a little simple analysis on the numbers.
3years.png
3years.png (39 KiB) Viewed 1488 times
If you look at the heating and cooling degree days you can sort of see it. Compare July 2018 with 2017. Then again there's a certain amount of randomness. July 2016 and 2017 were almost the same. There are significantly less heating degree days in December 2018 than 2017. My degree days are unique to me, the numbers depend on what you used for desired temperatures.

Return to “Windows 10 for IoT”