Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Mon Jan 30, 2017 12:45 am

I have changed the subject of this thread because currently it supports 4 type of sensors:
Ambient Weather F007TH, AcuRite 00592TXR/06002RM, LaCrosse TX7U, Auriol HG02832 (IAN 283582).


-------
I have written C++ code for receiving data from temperature/humidity sensors Ambient Weather F007TH (~$10) with cheap RF 433MHz receiver like RXB6, RX-RM-5V, etc.
C++ is not my primary language (as well as English) but still I implemented some non-trivial features:
  • I used pigpio library to catch interruptions. The handler of interruptions tries to filter short spikes, long intervals and also drops short sequences of acceptable intervals. Lengths of intervals are stored in cyclic buffer.
  • Decoding is done outside of the handler in another thread. It means that support for other protocols can be potentially added.
  • The decoder tries to interpret data after and before preamble. The sensor repeats its message 3 times. So this feature helps to successfully decode chunked sequences with missing preamble at the beginning. Of course, checksum is checked in any case.
  • Decoded messages are queued and read by main thread (or any other thread). I provided a code for printing the data and generating JSON.

The code should be compiled and linked with argument -pthread and with libraries rt and pigpio. For unknown for me reasons the code does not work if it was compiled with optimization. But I am not very familiar with C++. If anybody knows why it happens then I will be glad to know it too. It is possible that it happened because I used cross-compiler on my WIndows machine.

This proof of concept program demonstrates better rate of successfully received messages than rtl_433 with SDR on my Windows machine. I have 8 sensors in my house and I am able to receive data from sensors on distances more than 30 feet through walls .

The code is available on GitHub https://github.com/alex-konshin/f007th-rpi
But I just submitted it without details.
I know that I have to provide more details and I will do it if anybody really needs it :).

Alex Konshin
Last edited by Alex Konshin on Tue Dec 25, 2018 3:34 pm, edited 1 time in total.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Mon Feb 06, 2017 1:31 am

I have updated my project.
  • Added makefiles and an instruction. The instruction still is not really comprehensive but it is better than nothing.
  • Added new executable f007th-rpi_push_to_rest that receives data from sensors and sends to a server via REST API.
  • Old bugs have been fixed. New bugs were added.
Please see more details on my project page on GitHub https://github.com/alex-konshin/f007th-rpi

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Sun Feb 12, 2017 5:10 am

I have added support for InfluxDB. I renamed f007th-rpi_push_to_rest to f007th-rpi_send.

The command f007th-rpi_send can now send data to InfluxDB (https://docs.influxdata.com/influxdb/v1.2/) that can be used in many monitoring and visualization tools like Grafana http://grafana.org/, Prometheus https://prometheus.io/, etc.

In my own setup I installed InfluxDB and Grafana on Windows that is running on Intel NUC. :roll: Now I can see nice dynamic graphs with temperatures/humidity from 8 sensors in my house.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Fri Feb 24, 2017 2:34 am

Project has been updated.
Added output in degrees Celcius.
Command f007th_send can print output to console now.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Sat Apr 29, 2017 5:24 am

There are significant changes in this project.
  • The utility can now work with gpio-ts driver: https://github.com/alex-konshin/gpio-ts. The driver is tested and works fine on RPi3, Banana Pi M3 and ODROID C2. Basically this driver makes such kind of utilities more portable. The new executable f007th-send works with this driver rather than with pigpio library which is not supported on platforms other than Raspberry Pi.
  • I Added support for sensors AcuRite 00592TXR (also known as 06002RM)https://www.acurite.com/kbase/592TXR.html. Actually this is a family of sensors with the same protocol. In particular I use this one: https://www.amazon.com/gp/product/B00T0 ... UTF8&psc=1. This sensor sends data in about every 15 seconds and it has greater range than Ambient Weather F007TH. My receiver also sees 2 other sensors of my neighbors :).

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Sat May 06, 2017 5:33 am

Added support of MinnowBoard and tested with MinnowBoard Turbot Quad Core.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Sat May 06, 2017 5:54 am

did you add an antenna to your receiver?

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Sat May 06, 2017 3:22 pm

Yes, I added antenna.
I would say that with good receiver and not very long distances antenna it is not so critical. I know it because one night my two kittens found my setup and extracted wire antenna from breadboard. But I still got data from thermometers that night :). Well, reception was worse but it was good enough to draw all graphs in Grafana (I have 9 thermometers now).

In my "production" setup I use RXB6 with antenna like this http://www.instructables.com/id/433-MHz ... d-antenna/. But in my test setup I was lazy and just connected a jumper wire with suitable length to SeeedStudio RF-R-ASK receiver ( https://www.seeedstudio.com/433MHz-ASK% ... -2205.html ). It also works but little bit worse than my "production" setup. But it could be because of worse antenna :).

From my experience thermometer 00592TRX sends better signal and does it more often (about once per 15 seconds). I have it outside on my backyard. And I also receive signals from my neighbor's thermometer, I don't even know where it is located but the distance is obviously more than 100 feet. Note that I am sure that it a real thermometer rather that errors in received data from my own thermometer because I check CRC in all received data, it has a different id and data is a little bit different.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Sun Mar 04, 2018 1:56 am

I have updated the utility.
  • I added support for sensor LaCrosse TX7U. Sensors TX6 and TX3 may also work but I don't have them and I cannot test it. Please also note that these sensors send separate packages for temperature and humidiry and as result the utility handles then separately.
  • JSON package now contains field "type" with type of the sensor (""AcuRite 00592TXR", "Ambient Weather F007TH", "LaCrosse TX3/TX6/TX7").
  • Fixed several bugs.

Schween
Posts: 1
Joined: Thu Dec 13, 2018 8:16 am

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Thu Dec 13, 2018 8:40 am

Hi Alex,

I'm trying desperately to integrate the f007th in pilight, while I found your script. With your script I can read my sensors successfully.
how can I get to the read-out data with pilight or with my own php-script? could you give a beginner some tips?

Thanks!

Best regards,
Schween

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Ambient Weather F007TH with cheap RF 433MHz receiver

Thu Dec 13, 2018 7:05 pm

Let's start with simple questions. What are you going to achieve in your scripts/setup?
I can just guess that you probably want to visualize the data on some web page.
Then I don't think that you have to integrate this utility directly in something like php script. Basically you need something to stage the data that is continuously sent by the utility. It could be either some REST service or InfluxDB. Then you can query this database from your php application. Actually your PHP server can be that REST service. I personally use InfluxDB on my Linux server that runs 24/4 but it probably could be run on the same Raspberry Pi. Of course, the performance will depends on the performance of the host where the server is located. In my own setup I currently use Grafana that is connected to InfluxDB to visualize data from 10 sensors inside and outside my house.

Actually I have ideas that will help to support other scenarios by the utility. For example, it is easy to implement support for pull-kind requests for current data. Then other application would be able to periodically pull current values in JSON format. I think this mode will be useful for many applications. I will think about and probably implement it during holidays.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Tue Dec 25, 2018 3:36 pm

I have implemented support of yet another temperature/humidity sensor: Auriol HG02832 (IAN 283582).

Merry Christmas!

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Sat Dec 29, 2018 10:13 pm

Added new option -H <port>. If this option is specified then the utility will also serve HTTP requests on this port and send JSON file in response with current values of all thermometers.
An example of JSON file:

Code: Select all

[
{"time":"2018-12-29 16:56:47 EST","type":"F007TH","channel":1,"rolling_code":207,"temperature":781,"humidity":23,"battery_ok":false},
{"time":"2018-12-29 16:57:49 EST","type":"00592TXR","channel":1,"rolling_code":92,"temperature":401,"humidity":56,"battery_ok":true},
{"time":"2018-12-29 16:57:40 EST","type":"00592TXR","channel":1,"rolling_code":146,"temperature":393,"humidity":54,"battery_ok":true},
{"time":"2018-12-29 16:54:58 EST","type":"F007TH","channel":6,"rolling_code":48,"temperature":681,"humidity":35,"battery_ok":true},
{"time":"2018-12-29 16:55:33 EST","type":"F007TH","channel":5,"rolling_code":245,"temperature":683,"humidity":32,"battery_ok":false},
{"time":"2018-12-29 16:57:03 EST","type":"F007TH","channel":3,"rolling_code":153,"temperature":669,"humidity":30,"battery_ok":false},
{"time":"2018-12-29 16:46:27 EST","type":"F007TH","channel":8,"rolling_code":83,"temperature":617,"humidity":79,"battery_ok":true},
{"time":"2018-12-29 16:42:32 EST","type":"TX7","rolling_code":104,"temperature":741,"humidity":33},
{"time":"2018-12-29 16:54:52 EST","type":"F007TH","channel":7,"rolling_code":88,"temperature":562,"humidity":54,"battery_ok":true},
{"time":"2018-12-29 16:48:26 EST","type":"F007TH","channel":2,"rolling_code":19,"temperature":692,"humidity":39,"battery_ok":true},
{"time":"2018-12-29 16:57:29 EST","type":"F007TH","channel":4,"rolling_code":120,"temperature":738,"humidity":28,"battery_ok":true}
]
As you understand this feature can be used for polling current data from another scripts or applications.
It also can be used for showing current values on some web page.

Decoding of signals from AcuRite 00592TXR/06002RM and LaCrosse TX7U has been improved a little.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Sun Feb 10, 2019 10:32 pm

I have added support of sensor Ambient Weather F007TP.

dvovla
Posts: 1
Joined: Sun Jun 30, 2019 6:46 pm

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Sun Jun 30, 2019 6:51 pm

Hi Alex,
I recently discovered your f007th-rpi program and think it is great. I would like to ask you a few questions.

My goal is to monitor temperatures (and humidity) in different places in the house.

I would also like to monitor electricity consumption. Probably using Aeotec Z-vawe energy meter (eventually Qubino 3-phase smart meter ZMNHXD1) + Z-vawe.me USB stick + Home Assistant > Influx > Grafana on the same Rpi. I would greatly appreciate if you let me know your opinion on this solution.

I am currently testing on Rpi2 (Raspbian Stretch Lite, Influx, Grafana) + RX500A 433mhz Superheterodyne receiver with helical antenna + 5x f007th.
All 5 sensors are now side by side about 2m from the receiver.

First, I tried to run the program without the -A argument
/f007th-rpi/bin/f007th-rpi_send -C -t InfluxDB http://localhost:8086/write?db=monitor &
I like the database size saving, but the saved metrics were few and there was not enough data to make the graph in a shorter period of time. Does it have a solution?

So I tried to run with the –A argument
/f007th-rpi/bin/f007th-rpi_send -A -C -t InfluxDB http://localhost:8086/write?db=monitor &
There are enough saved metrics, but the frequency is irregular. At times, each one is decoded (about every minute) and at times with dropouts of 3, 5 and more minutes. This is not a major problem, but I would like to understand why this is happening. Also, I don't understand why at some time points in Grafana, I only have one sensor (measure) f.e. temperature and not humidity, or vice versa. If the data is correctly decoded, both data (temperature + humidity) should always be there. Is this correct?

Since I would also like to run Tvheadend on the same Rpi, I tried to install it. Everything runs smoothly until I start a video stream on the client. At that point, the metrics from the sensors almost stop storing. The log shows that they are not decoding. The CPU and RAM don't seem to be so busy at that moment.
Please kindly advise what it could be. I would love to run a monitoring and TV server on one machine (I plan on switching to Rpi3 or more powerful + SSD)

Many thanks
Vladimir

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Mon Jul 01, 2019 5:19 pm

Hi Vladimir,

Too many questions at once :).
I suspect that you can speak Russian. Please consider contact me directly by email or Hangout. You can find address on readme page on Github.
  • I highly recommend to use f007th-send instead of f007th-rpi_send because it gives better results. The difference is that the first does processing, filtering and buffering of data at kernel level in driver. It minimizes delays caused by OS multitasking and makes time measurements more precise. As result more received sequences are decoded successfully. Please also note that CPU frequency also does matter because timestamps should be taken with precision not less than 50ms. So, think about upgrading your RPi2 to RPi3 or even new RPi4 (but I have not tested RPi4 yet).
  • Reception highly depends on the type of the receiver. The difference could be dramatic. I tested with 5 different receivers. From my experience RXB6 is the best. In my house it can work even without antenna (my cats helped me with this experiment one night).
  • Some type of sensors are better than others in terms of signal quality. From my experience AcuRite 00592TXR/06002RM is more reliable. It sends data more frequently with better range. I even receive data from a sensor of my neighbor and I don't even know where it is located :). But this sensor has some disadvantage: it supports just 3 channels. Yes, you can distinguish sensors by rolling code but it is changed every time you change batteries.
  • I thought about feeling gaps. Currently the utility by default does not send data if values are not changed. I am going to add an option to specify max gap.
  • I cannot help you with your energy meter.
    Actually I tried to receive and decode data directly from meters (ERT/AMR 900MHz) that are widely used in US but I did not succeed. There were 2 reasons: it is hard to find cheap receivers for this task and their supported bitrates are not compatible; the data is provided in KWh that is not enough for real time monitoring. BTW, RTL-SDR can receive this data just fine. It can be done with rtlamr https://github.com/bemasher/rtlamr.
    Then I bought emonPi https://shop.openenergymonitor.com/emonpi-3/. But there was another problem: sensors do not fit to input wires of my house. I tried to find other sensors but it was surprisingly difficult find them and they are pretty expensive.

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Tue Dec 24, 2019 1:31 am

I have updated the utility.
  • Implemented support for sensors FT007TH (Telldus or Renkforce), Fine Offset Electronics WH2. They use the same protocol but despite of similarity of their name the protocol is completely different from the protocol of Ambient Weather F007TH. I have no such sensors. I tested my code with the data provided by user.
  • Implemented checksum validation for Auriol HG02832.
  • Tested the utility on Raspberry Pi 4. I have not observed any problems.
I am planing to make more changes and improvements during holidays. Stay turned.

Merry Christmas and a Happy New Year!

Alex Konshin
Posts: 44
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Receiving data from temperature/humidity sensors with cheap RF 433MHz receiver

Sun Jan 26, 2020 3:45 am

I have updated the utility.
In this update I focused on some usability improvements.
  • Introduced configuration files. Configuration file can contain any command line options (long form only) and commands that cannot be passed on command line. Currently there is just one such command sensor that is described below.
  • Now we can assign a name to a sensor. This name is printed with sensor's data and sent to servers. It partially solves the problem with changing of rolling code when you replace batteries on sensors. Now you can change the value of rolling code for the sensor in configuration file. Then servers will receive the same name and you can use this name for retrieving data from servers.
The syntax of sensor descriptor:
sensor <type> [<channel>] <rolling_code> <name>
Argument <name> can be any unique word without blanks or quoted string. The length of the name should not exceed 64.
Argument <type> could be one of (case insensitive): f007th, f007tp, 00592txr, hg02832, tx6, wh2, ft007th.
Argument <rolling_code> may be decimal number or hex number started with 0x.
Argument <channel> is not optional: You must specify it if this particular sensor type has channels. For sensors of type 00592txr the value of channel is A, B or C. For sensors f007th and f007tp it should be a number 1..8. For sensor hg02832 it should be number 1..3.

Example of configuration file:

Code: Select all

# Any comments are started with hash. Empty lines are ignored.

gpio 27
#all-changes
#verbose
httpd 8888

server-type InfluxDB
send-to http://m700.dom:8086/write?db=smarthome
max-gap 5

log-file "f007th-send.log"

sensor f007th   1  13 "Server room"
sensor f007th   2  19 "Main bedroom"
sensor f007th   4 120 "Alex office"
sensor f007th   5 174 "Kitchen"
sensor f007th   6  48 "TV room"
sensor f007th   7  88 "Garage"

sensor f007th   1  191 "Neighbor 2"
sensor 00592txr A 0x5c "Neighbor 1"
sensor 00592txr A  146 "Backyard"

sensor tx6  104 "LaCrosse TX7U 1" # note that channel is missing
sensor tx6   92 "LaCrosse TX7U 2"

Return to “Automation, sensing and robotics”