Skip to main content

A serial bridge package to connect RFM69 module to PC

Project description

rfm69-serial

A Python package for connecting PC to RFM69HCW board via USB Serial interface.

Overview

RFM69HCW module from HopeRF is an excellent tool for RF communication under license-free ISM band. Despite the fact that the community already has well-written library for interfacing the module to Arduino boards (e.g. RFM69 library from LowPowerLab @https://github.com/LowPowerLab/RFM69) or Raspberry Pi computer (e.g. Rpi-RFM69 library @https://rpi-rfm69.readthedocs.io/en/latest/), there are many times I find myself in need of the module to work with PCs - which don't have SPI communication capability. The best way to achieve interfacing between the RFM69 module and PCs is by using UART/Serial via USB port.

How does it work?

The idea for this library is simple:

An Arduino or Teensy board (middle man) is used to exchange data between RFM69HCW module and PC (running Linux OS). The connection diagram is shown as below:

PC / Raspberry Pi (USB Port) <---> (USB Port) Arduino / Teensy Board (SPI) <---> RFM69HCW Module

Firmware Code

The firmware code for Arduino/Teensy device is included in firmware/RFM69_Serial directory. The code is based on well-known RFM69 library from LowPowerLab @https://github.com/LowPowerLab/RFM69. The program is written in Arduino language (C++) with a set of commands (pre-defined by command opcode table). At the system start-up, the device is connected to PC using its USB port. After some initialization, the device sits idle waiting for the command opcode (and possibly data) to be transferred through USB port. The program selects the corresponding function and executes them to communicate with physical RFM69 module through SPI connection. After execution of the command, the device go back to waiting state, ready for the next command to be transferred.

Note: as the Arduino program uses RFM69 library from LowPowerLab, you need to install the library to your Arduino IDE first.

Python Library

The Python library covers almost every function/method from the RFM69 Arduino library. Each function is given an unique opcode as shown in the table below:

RFM69 Serial Function LUT Table 1. function opcode look-up table.

At the system start-up, the middle man device is initialized using default values for system parameters such as device ID, network ID, chip select pin and interrupt pin. It is user's responsibility to reinitialize the middle man device to your own system parameter set before requesting any other function to the RFM69 device. This can be done by calling constructor method with correct system parameter set for corresponding physical board (see examples in /examples).

Installation

For general usage, user can install the package from PyPi:

python3 -m pip install rfm69-serial

or

pip3 install rfm69-serial

For un-published version or developer version, git-clone the specific package then perform local install an editable package.

python3 -m pip install -e .

Then, you are free to modify the source code however you like it.

Supported Hardware and Limitations

RFM69 Serial library supports most Arduino devices. The only problem is that "low-end" Arduino boards such as Arduino UNO do NOT support serial baudrate greater than 115200 kbps. Therefore, there is limitation in data transfer speed between PC and physical RFM69 module using such middle man devices.

Here is the list of devices that I used to test the RFM69 Serial library:

Supported Device List Table 2. Supported and Tested Physical Boards (Middle Man).

(*): For Arduino MKRZERO, its serial buffer is smaller than 64 bytes -> cannot handle 64-byte message. Thus, 32-bit long message is used instead.

Recommendation: I use Teensy series as the middle man when it is possible as this class of devices comes with a well-designed USB serial connection to PC.

APIs Reference

Refer to docs/

Documentation of RFM69-Serial library is done automatically using Sphynx. Access build/html/ for the lastest build of the docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rfm69-serial-0.1.2.tar.gz (44.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rfm69_serial-0.1.2-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file rfm69-serial-0.1.2.tar.gz.

File metadata

  • Download URL: rfm69-serial-0.1.2.tar.gz
  • Upload date:
  • Size: 44.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.3

File hashes

Hashes for rfm69-serial-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9309f6283ca19ecbd44a25d57d23461c6fb9d72990bed94afbc1428f9ad21c9c
MD5 9401d5370833a8a844083f50b978aa5e
BLAKE2b-256 959d50232d33e014fc9aca8d2ec01dcdd0fb8b97131092cc141a1057b766f1e4

See more details on using hashes here.

File details

Details for the file rfm69_serial-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: rfm69_serial-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.3

File hashes

Hashes for rfm69_serial-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 082bb403f3cae6e896463c471680131cd2c038766e3c4804d7e72ea333429873
MD5 f7e550000c9f1dd04042c6714fc3baed
BLAKE2b-256 4b93d41752d98d1b830ccd056fd610eba41ebf903eae8dea7bceacde478e1260

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page