Datasheet
CircuitPython for RFM9x LoRa
It's easy to use the RFM9x LoRa radio with CircuitPython and the Adafruit CircuitPython
RFM9x (https://adafru.it/BjD) module. This module allows you to easily write Python code that sends and receives
packets of data with the radio. Be careful to note this library is for the RFM95/96/97/98 LoRa radio only and will
not work with the simper RFM69 packet radio.
Design Considerations
One thing to be aware of before you use the RFM9x series of radios with CircuitPython are some of the limitations and
design considerations for its module. Keep these in mind as you think about projects using the RFM9x and
CircuitPython:
You can only send and receive packets up to 252 bytes in length at a time. The size of the radio's internal buffer
dictates this limit so if you want to send longer messages you'll need to break them into a series of smaller send
calls in your application code.
Receiving packets is a 'best effort' in pure Python code. Unlike the Arduino versions of the RFM9x library there is
no interrupt support which means when a packet is received it must be immediately processed by the Python
code or it could be lost. For your application it will work best to only receive small, single packet messages at a
time. Don't try to receive kilobytes of data or else you'll lose packets. This module is really intended for simple
single packet messages like 'ON', 'OFF', etc.
Sending and receiving packets will 'block' your Python code until the packet is fully processed. This means you
can't do a lot of other things while sending and waiting for packets to be received. Design your application so
the radio usage is the primary scenario and very little other tasks need to happen in the background.
The module is written to be compatible with the RadioHead RFM95 Arduino library. This means by default the
module will setup the radio with the same modulation and configuration for transmitting and receiving at the
maximum distance with LoRa support. In addition the CircuitPython module uses the same packet preamble (8
bytes) and header (4 bytes) as RadioHead. If you want to use different modulations or settings you'll need to
configure the radio yourself after carefully consulting the datasheet.
The CircuitPython module does not support advanced RadioHead features like guaranteed delivery or its internal
node addressing scheme. Only the simple 'raw' RadioHead examples are supported (i.e. broadcasting a packet
to all listening radios).
Encryption and sync words are also not supported by the LoRa radio module. You must perform these
operations yourself in your application code if they're desired.
Wiring With Breakout
First wire up a RFM9x breakout to your board as shown on the previous pages for Arduino. Note that the G0/interrupt
line is not used by the CircuitPython module and can remain unconnected. Here's an example of wiring a Feather M0
to the radio with a SPI connection:
© Adafruit Industries
https://learn.adafruit.com/adafruit-rfm69hcw-and-rfm96-rfm95-rfm98-lora-packet-padio-
breakouts
Page 49 of 70