Project source can be downloaded from https://github.com/alex-konshin/f007th-rpi.git
Alex Konshin akonshin@gmail.com
The main goal of this project is to intercept and decode radio signals from temperature/humidity sensors and show on console or send to REST/InfluxDB servers this received data.
The data is received with cheap RF 433.92MHz receivers like RXB6, SeeedStudio RF-R-ASK, RX-RM-5V, etc. It is tested with RXB6 and SeeedStudio RF-R-ASK.
This project currently supports following sensors:
Following platforms are supported and tested:
- Raspberry Pi 3
- Banana Pi M3
- ODROID C2
There are 3 executables on this platform: You can use it with pigpio library
- f007th-rpi is a demo/test program that receive data from sensors and prints it in plain text or JSON format.
- f007th-rpi_send is more advanced program that sends received and decoded data to a remote InfluxDB or REST server. This executable requires root permissions.
- f007th-send is the same as above but uses gpio-ts driver. This executable does not require root privileges but gpio-ts module must be already loaded.
On these platforms only f007th-send is supported and tested. This utility sends received and decoded data to a remote InfluxDB or REST server. It does not require root privileges but gpio-ts module must be already loaded.
File | Description |
---|---|
mach/rpi3.h |
Contains macros that are specific for platform Raspberry Pi 3. |
mach/bpi-m3.h |
Contains macros that are specific for platform Banana Pi M3. |
mach/odroid-c2.h |
Contains macros that are specific for platform ODROID C2. |
Bits.hpp |
Operations with long set of bits. It is used for storing decoded bits in Manchester decoder. |
F007TH.cpp |
Source code of f007th-rpi executable. |
f007th_send.cpp |
Source code of f007th-rpi_send executable. |
ReceivedMessage.hpp |
Container for received and decoded data. |
RFReceiver.cpp |
Implementation part of main class RFReceiver that actually receives and decodes data. |
RFReceiver.hpp |
Declaration part of class RFReceiver . |
SensorsData.hpp |
Contains the current list of sensors with the latest data. It is used for filtering duplicated data. |
Logger.hpp |
Implements functions for logging messages. |
makefile,*.mk |
Makefiles generated by Eclipse. They can be used for building executables outside Eclipse as well. |
README.md |
This file. |
There are several ways to do it. I actually cross-build this project in Eclipse on my Windows machine. You can look at this good instruction about setting up Eclipse for cross-compilation.
- You need to install libcurl library.
sudo apt-get install libcurl4-openssl-dev
- If you want to use pigpio library then you need to install it.
sudo apt-get install pigpio
- Clone sources from GitHub. The following command will create new sub-directory f007th-rpi in the current directory and download sources
git clone https://github.com/alex-konshin/f007th-rpi.git
- Build
/bin/sh f007th-rpi/build.sh
- Executables are created in directory
f007th-rpi/bin
. Note that you must run them with root privileges (for example withsudo
). Use Ctrl-C to terminate the program.
The command can send data to InfluxDB server or virtually any REST server that supports PUT requests. How to setup these servers? It is out of the scope of this instruction because there are many possible solutions. For REST server I personally use LoopBack with PostgreSQL that are run on QNAP NAS server.
The command sends JSON to REST server with following fields:
"time", "valid", "channel", "rolling_code", "temperature", "humidity","battery_ok"
.
The value of field temperature
is integer number of dF ("deciFahrenheit" = 1/10 of Fahrenheit). For example, if the value is 724 then the temperature is 72.4°F.
Instructions for InfluxDB can be found on site https://docs.influxdata.com/influxdb/v1.2/introduction/installation/. The command sends 3 types of metrics: "temperature", "humidity" and "sensor_battery_status" with tags "type" (always "F007TH"), "channel" and "rolling_code". The value of "temperature" is in Fahrenheit.
Value is GPIO pin number (default is 27) as defined on page http://abyz.co.uk/rpi/pigpio/index.html
Output temperature in degrees Celsius.
Timestamps are printed/sent in ISO 8601 format.
Timestamps are printed/sent in format "YYYY-mm-dd HH:MM:SS TZ".
Parameter value is server URL.
Parameter value is server type. Possible values are REST (default) or InfluxDB.
Send all data. Only changed and valid data is sent by default.
Parameter is a path to log file.
Verbose output.
More verbose output.
Print received data on console:
sudo f007th-rpi_send -A
Print received data on console with temperature in degrees Celsius:
sudo f007th-rpi_send -C -A
Run the command in background and send data to InfluxDB database smarthome
on server server.dom
:
sudo f007th-send -t InfluxDB http://server.dom:8086/write?db=smarthome &
or
sudo f007th-send --type=InfluxDB -s http://server.dom:8086/write?db=smarthome &
or
sudo f007th-send --type=InfluxDB --send-to http://server.dom:8086/write?db=smarthome &
Send data to Loopback (REST server) on server qnap.dom
:
sudo f007th-send http://qnap.dom:3000/api/roomtemps
or
sudo f007th-send -t REST -s http://qnap.dom:3000/api/roomtemps