kopia lustrzana https://github.com/xaelsouth/rtl-wmbus
rx_sdr
rodzic
4098aa84bb
commit
6d92d1b3f1
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
rtl-wmbus is a software defined receiver for Wireless-M-Bus. It is written in plain C and uses RTL-SDR (https://github.com/osmocom/rtl-sdr) to interface with RTL2832-based hardware.
|
rtl-wmbus is a software defined receiver for Wireless-M-Bus. It is written in plain C and uses RTL-SDR (https://github.com/osmocom/rtl-sdr) to interface with RTL2832-based hardware.
|
||||||
|
|
||||||
|
It can also use LimeSDR or other SDR receiver through rx_sdr (see https://github.com/rxseger/rx_tools),
|
||||||
|
which in turn is using SoapySDR to interface with underlying hardware in a vendor-neutral way.
|
||||||
|
|
||||||
Wireless-M-Bus is the wireless version of M-Bus ("Meter-Bus", http://www.m-bus.com), which is an European standard for remote reading of smart meters.
|
Wireless-M-Bus is the wireless version of M-Bus ("Meter-Bus", http://www.m-bus.com), which is an European standard for remote reading of smart meters.
|
||||||
|
|
||||||
The primary purpose of rtl-wmbus is experimenting with digital signal processing and software radio. rtl-wmbus can be used on resource constrained devices such Raspberry Pi Zero or Raspberry PI B+ overclocked to 1GHz. Any Android based tablet will do the same too.
|
The primary purpose of rtl-wmbus is experimenting with digital signal processing and software radio. rtl-wmbus can be used on resource constrained devices such Raspberry Pi Zero or Raspberry PI B+ overclocked to 1GHz. Any Android based tablet will do the same too.
|
||||||
|
@ -49,6 +52,10 @@ Before building Android version the SDK and NDK have to be installed. See androi
|
||||||
|
|
||||||
* rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | build/rtl_wmbus
|
* rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | build/rtl_wmbus
|
||||||
|
|
||||||
|
To run continuously with rx_sdr (or even with a higher sampling and decimation rate)
|
||||||
|
* rx_sdr -f 868.95M -s 1600000 - 2>/dev/null | build/rtl_wmbus
|
||||||
|
* rx_sdr -f 868.95M -s 4000000 - 2>/dev/null | build/rtl_wmbus -d 5
|
||||||
|
|
||||||
To count "good" (no 3 out of 6 errors, no checksum errors) packets:
|
To count "good" (no 3 out of 6 errors, no checksum errors) packets:
|
||||||
|
|
||||||
* cat samples.bin | build/rtl_wmbus 2>/dev/null | grep "[T,C]1;1;1" | wc -l
|
* cat samples.bin | build/rtl_wmbus 2>/dev/null | grep "[T,C]1;1;1" | wc -l
|
||||||
|
|
|
@ -447,6 +447,7 @@ static void time2_algorithm(unsigned bit, unsigned rssi, struct time2_algorithm
|
||||||
static int opts_run_length_algorithm_enabled = 1;
|
static int opts_run_length_algorithm_enabled = 1;
|
||||||
static int opts_time2_algorithm_enabled = 1;
|
static int opts_time2_algorithm_enabled = 1;
|
||||||
static unsigned decimation_rate = 2u;
|
static unsigned decimation_rate = 2u;
|
||||||
|
int show_used_algorithm = 0;
|
||||||
|
|
||||||
static void print_usage(const char *program_name)
|
static void print_usage(const char *program_name)
|
||||||
{
|
{
|
||||||
|
@ -454,13 +455,14 @@ static void print_usage(const char *program_name)
|
||||||
fprintf(stdout, "\t-r 0 to disable run length algorithm\n");
|
fprintf(stdout, "\t-r 0 to disable run length algorithm\n");
|
||||||
fprintf(stdout, "\t-t 0 to disable time2 algorithm\n");
|
fprintf(stdout, "\t-t 0 to disable time2 algorithm\n");
|
||||||
fprintf(stdout, "\t-d 2 set decimation rate to 2 (defaults to 2 if omitted)\n");
|
fprintf(stdout, "\t-d 2 set decimation rate to 2 (defaults to 2 if omitted)\n");
|
||||||
|
fprintf(stdout, "\t-s show used algorithm in the output\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_options(int argc, char *argv[])
|
static void process_options(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int option;
|
int option;
|
||||||
|
|
||||||
while ((option = getopt(argc, argv, "d:r:t:")) != -1)
|
while ((option = getopt(argc, argv, "d:r:st:")) != -1)
|
||||||
{
|
{
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
|
@ -489,6 +491,9 @@ static void process_options(int argc, char *argv[])
|
||||||
case 'd':
|
case 'd':
|
||||||
decimation_rate = strtoul(optarg, NULL, 10);
|
decimation_rate = strtoul(optarg, NULL, 10);
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
show_used_algorithm = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print_usage(argv[0]);
|
print_usage(argv[0]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -661,6 +661,8 @@ static inline uint32_t get_serial(const uint8_t *const packet)
|
||||||
return serial;
|
return serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int show_used_algorithm;
|
||||||
|
|
||||||
static void t1_c1_packet_decoder(unsigned bit, unsigned rssi, struct t1_c1_packet_decoder_work *decoder, const char *algorithm)
|
static void t1_c1_packet_decoder(unsigned bit, unsigned rssi, struct t1_c1_packet_decoder_work *decoder, const char *algorithm)
|
||||||
{
|
{
|
||||||
decoder->current_rssi = rssi;
|
decoder->current_rssi = rssi;
|
||||||
|
@ -682,7 +684,7 @@ static void t1_c1_packet_decoder(unsigned bit, unsigned rssi, struct t1_c1_packe
|
||||||
decoder->crc_ok = check_calc_crc_wmbus(decoder->packet, decoder->L) ? 1 : 0;
|
decoder->crc_ok = check_calc_crc_wmbus(decoder->packet, decoder->L) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
algorithm = ""; // uncomment of want to see which algorithm is executed right now
|
if (!show_used_algorithm) algorithm = "";
|
||||||
fprintf(stdout, "%s%s;%u;%u;%s;%u;%u;%08X;", algorithm, decoder->c1_packet ? "C1": "T1",
|
fprintf(stdout, "%s%s;%u;%u;%s;%u;%u;%08X;", algorithm, decoder->c1_packet ? "C1": "T1",
|
||||||
decoder->crc_ok,
|
decoder->crc_ok,
|
||||||
decoder->err_3outof^1,
|
decoder->err_3outof^1,
|
||||||
|
|
Ładowanie…
Reference in New Issue