Skip to content
Shop

STM32 LoRa message communication

Explore with your favorite AI

Gemini & other AI

Copy this page’s context into your AI to explore how it works and what you can build.

Open Gemini

Copy the prompt, then paste it into Gemini’s message box.

View prompt

This tutorial introduces message communication using LoRa Mary.

This example requires two devices, each combining AP03 STM32 MCU and AC07 LoRa Mary: a transmitter and a receiver. They use different source programs. Choose Arduino IDE or PlatformIO and prepare the upload environment first.

Use Leafony’s arduino-LoRa and arduino-tca9536 libraries. Match the dependencies of the chosen source instead of substituting other implementations with similar names. See How to run an example for the basics of obtaining and uploading the source.

  • AC07 LoRa Mary
  • AP03 STM32 MCU
  • AV04 2V–4.5V
  • AZ67 AAA battery holder
  • AZ63 Nut Plate
  • Two M2 × 12 mm screws
  • Three AAA batteries

Use Back to back to keep the USB cable from covering the LoRa Mary antenna area.

  • AC07 LoRa Mary
  • AP03 STM32
  • AZ01 USB
  • AX07 Back to back
  • AZ63 Nut Plate 2P
  • Two M2 × 8 mm screws
  • Two M2 × 10 mm screws
  • USB cable
  • Computer

Obtain the transmitter and receiver sources for the same development tool. For Arduino IDE, open the complete sketch folder. For PlatformIO, open the complete project including platformio.ini and src. The distribution links point to master or main, so their contents may change between downloads.

  1. Check the transmitter and receiver sources and match communication settings such as frequency, spreading factor, and signal bandwidth. Refer to the downloaded source for setting names and values.
  2. Upload the transmitter and receiver programs to their respective AP03 leaves. If PlatformIO’s upload_port or upload_command still contains settings for an older computer environment, follow the current upload configuration instructions.
  3. After uploading, switch each AP03 to Run and reset it. Open the receiver’s serial monitor at 115200 bps.
  4. Check that the receiver repeatedly displays hello, the transmission count, and received signal strength (RSSI, in dBm). The -37 below is an example; it varies with distance and installation conditions.
Received: hello 0, RSSI: -37

The transmitter log alone does not confirm reception. Check that the count displayed by the receiver updates.

SymptomWhat to check
LoRa.h or TCA9536.h is not foundCheck that the required libraries are installed for the selected development tool
Build succeeds but upload failsCheck AP03 upload mode, the USB port, and PlatformIO’s upload command
Execution stops while initializing LoRa or the IO expanderTurn off the power, check the AC07 and AP03 connections, and compare the assembly with the source’s target configuration
Transmission starts but nothing is receivedCheck that both devices start in Run mode, communication settings match, and the receiver’s serial port and 115200 bps setting are correct

Keep USB cables and metal from covering the antenna area. For connection basics, see the AC07 reference and FAQ.