0

Radio Bonnet convert transmitted message
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Please be positive and constructive with your questions and comments.

Radio Bonnet convert transmitted message

by Joseyeire on Fri Jun 14, 2019 12:39 pm

To whom it concerns,
I'm sending LoRa messages from a Adafruit Radio bonnet to a PyCom LoPy4 but the message received seems to be in Hex -

Adafruit Radio bonnet with the following settings:

Code: Select all | TOGGLE FULL SIZE
# Configure LoRa Radio
CS = DigitalInOut(board.CE1)
RESET = DigitalInOut(board.D25)
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, 869.85) # freq = 869.85mHz
rfm9x.tx_power = 23
rfm9x.spreading_factor = 12
rfm9x.signal_bandwidth = 125000
rfm9x.preamble_length = 8


when button "A" is pressed "Hello" is transmitted as follows:

Code: Select all | TOGGLE FULL SIZE
button_a_data = bytes("Hello","utf-8")
        rfm9x.send(button_a_data)



On the LoPy4 set up as follows:

Code: Select all | TOGGLE FULL SIZE
lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868, sf=12, frequency=869850000, bandwidth=LoRa.BW_125KHZ, public=False, preamble=8, coding_rate=LoRa.CODING_4_5, tx_iq=False, rx_iq=False, power_mode=LoRa.ALWAYS_ON, tx_power=14)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setblocking(False)
raw_data = s.recv(32)
if len(raw_data) != 0:
   print('RX: data received')
        print(len(raw_data))
        print(type(raw_data))
        print(raw_data)
        data = raw_data.decode("utf-8")
        print(type(data))
        print(data)


The LoPy receives the "Hello" from the Adafruit Radio Bonnet as follows:

RX: data received
9
<class 'bytes'>
b'\xff\xff\x00\x00tO+\xf1\x80'
<class 'str'>
��tO+�
RSSI: -126, SNR: -7.0


How should I interpret the raw data received and convert it back to the original "Hello" transmitted?

Thank you,

Paul

Joseyeire
 
Posts: 10
Joined: Tue Nov 03, 2015 1:59 pm

Please be positive and constructive with your questions and comments.