cdeletre/txtpms

Send the signal

Closed this issue · 4 comments

The tool works perfectly following the guide, but I would like to try to use it differently.
I have 2 SDR hackRF One and USRP b210. I would like to know if is possible to use one of the two to send the message and receive it with the other, so as to try some tools and read the received message for example using https://github.com/jboone/tpms

Hi zanaries

You can use hackrf_transmit to transmit the generated signal. I've pushed a minor update in the commit 3097149 to support this. See the README at the end for more details. Regarding the reception I would suggest to use rtl_433 with a RTLSDR dongle if possible. I have never used jboone/tpms so I can't help on this.

I've just noticed that rtl_433 can be compiled with soapysdr support. This will give you the possibility to use the HackRF directly with rtl_433.

soapysdr dependencies can be installed this way:

sudo apt-get install libsoapysdr libsoapysdr-dev # common libraries
sudo apt-get install soapysdr-tools # SoapySDRUtil tool
sudo apt-get install soapysdr-module-hackrf # hackrf support

You can check that your HackRF is detect by soapy with SoapySDRUtil:

SoapySDRUtil --find
######################################################
## Soapy SDR -- the SDR abstraction library
######################################################

[INFO] [UHD] linux; GNU C++ version 8.2.0; Boost_106700; UHD_3.13.1.0-3
Found device 0
  default_input = True
  default_output = True
  device_id = 0
  driver = audio
  label = default

Found device 1
  device = HackRF One
  driver = hackrf
  label = HackRF One #0 xxxxxxxxxxxxxxxx
  part_id = xxxxxxxxxxxxxxxx
  serial = 0000000000000000xxxxxxxxxxxxxxxx
  version = 2017.02.1

Also the --probe can give you more details:

SoapySDRUtil --probe="driver=hackrf"
######################################################
## Soapy SDR -- the SDR abstraction library
######################################################

Probe device driver=hackrf
[INFO] Opening HackRF One #0 xxxxxxxxxxxxxxxx...

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=HackRF
  hardware=HackRF One
  clock source=internal
  part id=xxxxxxxxxxxxxxxx
  serial=0000000000000000xxxxxxxxxxxxxxxx
  version=2017.02.1

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 1 Rx, 1 Tx
  Timestamps: NO
  Other Settings:
     * Antenna Bias - Antenna port power control.
       [key=bias_tx, default=false, type=bool]

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: NO
  Stream formats: CS8, CS16, CF32, CF64
  Native format: CS8 [full-scale=128]
  Stream args:
     * Buffer Count - Number of buffers per read.
       [key=buffers, units=buffers, default=15, type=int]
  Antennas: TX/RX
  Full gain range: [0, 116] dB
    LNA gain range: [0, 40] dB
    AMP gain range: [0, 14] dB
    VGA gain range: [0, 62] dB
  Full freq range: [0, 7250] MHz
    RF freq range: [0, 7250] MHz
  Sample rates: 1, 2, 3, 4, 5, ..., 16, 17, 18, 19, 20 MSps
  Filter bandwidths: 1.75, 2.5, 3.5, 5, 5.5, ..., 14, 15, 20, 24, 28 MHz

----------------------------------------------------
-- TX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: NO
  Stream formats: CS8, CS16, CF32, CF64
  Native format: CS8 [full-scale=128]
  Stream args:
     * Buffer Count - Number of buffers per read.
       [key=buffers, units=buffers, default=15, type=int]
  Antennas: TX/RX
  Full gain range: [0, 61] dB
    VGA gain range: [0, 47] dB
    AMP gain range: [0, 14] dB
  Full freq range: [0, 7250] MHz
    RF freq range: [0, 7250] MHz
  Sample rates: 1, 2, 3, 4, 5, ..., 16, 17, 18, 19, 20 MSps
  Filter bandwidths: 1.75, 2.5, 3.5, 5, 5.5, ..., 14, 15, 20, 24, 28 MHz

Then you need to rebuild the rtl_433 from sources (check that cmake detects soapy and enbale its support). You should be able to run rtl_433 with HackRF. Take care to set the frequency away from the transmit frequency as the DC from HackRF will disturb demodulation especially for ASK signals, FSK should be more friendly with this DC but I haven't checked.

Here is a command where I've used with success the HackRF centered on 433 MHz with 4 Msps sampling rate so it covers 431 - 435 MHz:

rtl_433 -d driver=hackrf -f 433000000 -s 4000000 -g LNA=40,AMP=0,VGA=20
rtl_433 version 19.08-39-ge3930ab branch master at 201910220852 inputs file rtl_tcp RTL-SDR SoapySDR
Use -h for usage help and see https://triq.org/ for documentation.
Trying conf file at "rtl_433.conf"...
Trying conf file at "/home/cde/.config/rtl_433/rtl_433.conf"...
Trying conf file at "/usr/local/etc/rtl_433/rtl_433.conf"...
Trying conf file at "/etc/rtl_433/rtl_433.conf"...

	Consider using "-M newmodel" to transition to new model keys. This will become the default someday.
	A table of changes and discussion is at https://github.com/merbanan/rtl_433/pull/986.

Registered 111 out of 141 device decoding protocols [ 1-4 8 11-12 15-17 19-21 23 25-26 29-36 38-60 63 67-71 73-100 102-103 108-116 119 121 124-128 131-141 ]
[INFO] Opening HackRF One #0 xxxxxxxxxxxxxxxx...
Sample rate set to 4000000 S/s.
Setting gain element LNA: 40.000000 dB
Setting gain element AMP: 0.000000 dB
Setting gain element VGA: 20.000000 dB
Tuned to 433.000MHz.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2020-02-11 05:25:59
model     : Waveman Switch Transmitter             id        : G
channel   : 4            button    : 1             state     : on
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2020-02-11 05:25:59
model     : Waveman Switch Transmitter             id        : G
channel   : 4            button    : 1             state     : on
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2020-02-11 05:25:59
model     : Waveman Switch Transmitter             id        : G
channel   : 4            button    : 1             state     : on
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2020-02-11 05:25:59
model     : Waveman Switch Transmitter             id        : G
channel   : 4            button    : 1             state     : off
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2020-02-11 05:25:59
model     : Waveman Switch Transmitter             id        : G
channel   : 4            button    : 1             state     : off

thanks. Is possible to send the packet using USRP? Because I have both HackRF one and USRP, but the second is better.

Using Gnuradio you should be able. Just use SoX to convert the cu8 in cfile to use it as source file in Gnuradio. Here is an example:
sox -t raw -r2000k -b8 -eunsigned-integer -c2 iqrecord_2M.cu8 -t raw -b32 -efloat iqrecord_2M.cfile