YP.Lam | SX1280 LoraRanging 功能测试

SX1280 LoraRanging 功能测试

之前用现成的Lora串口模块感觉挺顺手,最近偶尔看到带 LoraRanging 功能的 SX1280,于是买了两个模块回来测试一下。

源码地址 https://github.com/yplam/LoraRangingTest

基于 mbed 与 STM32 Nucleo-64 开发板;主机为 NUCLEO_F411RE,从机为 NUCLEO_L476RG。

硬件为两个 Morpho 转接板,板载一个高抑制比的LDO,使用 SPI 接口通讯;

![硬件]({{ site.url }}/assets/2019/LoraRangingTest.jpg “硬件”)

![电路图]({{ site.url }}/assets/2019/Schematic.png “电路图”)

编译

先配置好 mbed 命令行工具以及git,然后运行

git clone https://github.com/yplam/LoraRangingTest.git
mbed deploy
mbed compile -m NUCLEO_F411RE -t gcc_arm
mbed compile -m NUCLEO_L476RG -t gcc_arm

主机固件: ./BUILD/NUCLEO_F411RE/GCC_ARM/LoraRangingTest.hex

从机固件: ./BUILD/NUCLEO_L476RG/GCC_ARM/LoraRangingTest.hex

mbed_app.json 引脚配置:

{
  "config": {
    "trace-level": {
      "help": "Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG",
      "macro_name": "MBED_TRACE_MAX_LEVEL",
      "value": "TRACE_LEVEL_INFO"
    }
  },
  "target_overrides": {
    "*": {
      "target.features_add": ["COMMON_PAL"],
      "mbed-trace.enable": true,
      "platform.stdio-convert-newlines": true
    },
    "NUCLEO_F411RE": {
      "platform.default-serial-baud-rate": 115200,
      "target.OUTPUT_EXT": "hex",
      "target.macros": [
        "LORA_MOSI=PA_7",
        "LORA_MISO=PA_6",
        "LORA_SCLK=PA_5",
        "LORA_NSS=PA_4",
        "LORA_BUSY=PC_8",
        "LORA_DIO1=PC_6",
        "LORA_RST=PA_12",

        "APP_HAS_LCD=1",
        "LCD_MOSI=PC_3",
        "LCD_MISO=PC_2",
        "LCD_SCLK=PB_10",
        "LCD_NSS=PB_12",
        "LCD_RESET=PC_10",
        "LCD_DC=PC_11",

        "APP_LED1=PC_9",
        "APP_LED2=PC_5",
        "APP_ENTITY_MODE=MASTER"
      ]
    },
    "NUCLEO_L476RG": {
      "platform.default-serial-baud-rate": 115200,
      "target.OUTPUT_EXT": "hex",
      "target.macros": [
        "LORA_MOSI=PA_7",
        "LORA_MISO=PA_6",
        "LORA_SCLK=PA_5",
        "LORA_NSS=PA_4",
        "LORA_BUSY=PC_8",
        "LORA_DIO1=PC_6",
        "LORA_RST=PA_12",
        "APP_LED1=PB_13",
        "APP_LED2=PC_5",
        "APP_ENTITY_MODE=SLAVE"
      ]
    }
  }
}

测试效果

周边走了一圈,板载PCB天线,SF7, BW800,发现最大距离也就100米多点(有点树阻挡),并且都有几米的范围波动,距离到100米时差不多在80到120之间

本来想着如果能有1km左右测距距离的话还可以试试用来做低功耗牛羊耳标,但现在这种距离跟精度感觉真没什么地方可以用