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.
Copy the prompt, then paste it into Gemini’s message box.
View prompt
Introduction
Section titled “Introduction”This tutorial introduces message communication using LoRa Mary.
Before you start
Section titled “Before you start”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.
Required items
Section titled “Required items”Transmitter configuration
Section titled “Transmitter configuration”- 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
Receiver configuration
Section titled “Receiver configuration”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
Source code
Section titled “Source code”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.
Transmitter
Section titled “Transmitter”Receiver
Section titled “Receiver”Run the example
Section titled “Run the example”- 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.
- Upload the transmitter and receiver programs to their respective AP03 leaves. If PlatformIO’s
upload_portorupload_commandstill contains settings for an older computer environment, follow the current upload configuration instructions. - After uploading, switch each AP03 to Run and reset it. Open the receiver’s serial monitor at 115200 bps.
- Check that the receiver repeatedly displays
hello, the transmission count, and received signal strength (RSSI, in dBm). The-37below is an example; it varies with distance and installation conditions.
Received: hello 0, RSSI: -37The transmitter log alone does not confirm reception. Check that the count displayed by the receiver updates.
Troubleshooting
Section titled “Troubleshooting”| Symptom | What to check |
|---|---|
LoRa.h or TCA9536.h is not found | Check that the required libraries are installed for the selected development tool |
| Build succeeds but upload fails | Check AP03 upload mode, the USB port, and PlatformIO’s upload command |
| Execution stops while initializing LoRa or the IO expander | Turn off the power, check the AC07 and AP03 connections, and compare the assembly with the source’s target configuration |
| Transmission starts but nothing is received | Check 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.