This guide assumes that you've gotten your Raspberry Pi up and running, and have CircuitPython installed.

Installing CircuitPython Libraries

We're running CircuitPython on the Raspberry Pi, installing the libraries for radio communication is simple.

To install the library for the display, enter the following into the terminal:

pip3 install adafruit-circuitpython-ssd1306

You'll also need to install the framebuf module in order to write to the display. 

sudo pip3 install adafruit-circuitpython-framebuf

To install the library for the RFM69HCW Module, enter the following into the terminal:

sudo pip3 install adafruit-circuitpython-rfm69

RFM69 Connection Test!

Do not use this if you have a RFM9x Radio

The following code is for checking if the RFM69 radio is set up for transmitting and receiving. Save the code on your Pi as

# SPDX-FileCopyrightText: 2018 Brent Rubell for Adafruit Industries
# SPDX-License-Identifier: MIT

Wiring Check, Pi Radio w/RFM69

Learn Guide:
Author: Brent Rubell for Adafruit Industries
import time
import busio
from digitalio import DigitalInOut, Direction, Pull
import board
# Import the SSD1306 module.
import adafruit_ssd1306
# Import the RFM69 radio module.
import adafruit_rfm69

# Button A
btnA = DigitalInOut(board.D5)
btnA.direction = Direction.INPUT
btnA.pull = Pull.UP

# Button B
btnB = DigitalInOut(board.D6)
btnB.direction = Direction.INPUT
btnB.pull = Pull.UP

# Button C
btnC = DigitalInOut(board.D12)
btnC.direction = Direction.INPUT
btnC.pull = Pull.UP

# Create the I2C interface.
i2c = busio.I2C(board.SCL, board.SDA)

# 128x32 OLED Display
reset_pin = DigitalInOut(board.D4)
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, reset=reset_pin)
# Clear the display.
width = display.width
height = display.height

# RFM69 Configuration
CS = DigitalInOut(board.CE1)
RESET = DigitalInOut(board.D25)
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

while True:
    # Draw a black filled box to clear the image.

    # Attempt to set up the RFM69 Module
        rfm69 = adafruit_rfm69.RFM69(spi, CS, RESET, 915.0)
        display.text('RFM69: Detected', 0, 0, 1)
    except RuntimeError as error:
        # Thrown on version mismatch
        display.text('RFM69: ERROR', 0, 0, 1)
        print('RFM69 Error: ', error)

    # Check buttons
    if not btnA.value:
        # Button A Pressed
        display.text('Ada', width-85, height-7, 1)
    if not btnB.value:
        # Button B Pressed
        display.text('Fruit', width-75, height-7, 1)
    if not btnC.value:
        # Button C Pressed
        display.text('Radio', width-65, height-7, 1)

To use the code, enter the following in your terminal:


You'll also want to download the font file, font5x8.bin, and copy it into the same directory as the script:

If you want to download this file to your Raspberry Pi via the command line, enter the following wget command into your terminal:

wget -O font5x8.bin

Now to check the setup:

The radio should display that a RFM69 module is detected. Pressing each of the buttons should display different text on the screen.

If it can't detect a RFM69 module, the screen will display RFM69: ERROR

With everything working, let's move on to using the radio.

This guide was first published on Jan 23, 2019. It was last updated on Jul 16, 2024.

This page (RFM69 Raspberry Pi Setup) was last updated on Jul 16, 2024.

Text editor powered by tinymce.