This is a RFM69 gateway for an ESP8266-based custom board.

The project is currently in beta-stage with a working hardware prototype and full featured code. Both the code, libraries and eagle schematics and board layout are free and open source and can be found in this repository.


RFM69GW board - front view

The custom PCB has the minimum required components:

  • ESP12 footprint
  • RFM69CW module footprint
  • Two push buttons to RESET and FLASH the board
  • A 2.1 5mm jack for powering with AMS1117-3V3 to power the modules
  • Filtering and push up resistors and capacitors
  • A 5 pin header to program it
  • An edge footprint for an SMA or RP-SMA antenna

The ESP12 and RFM69CW modules are wired according to the following schema:


You can also use your own hardware, SPI pins will probably be the same, only remember to change the pin numbers for SPI_CS and interruption in the RFM69Manager.h file.

#define SPI_CS              SS
#define IRQ_PIN             5
#define IRQ_NUM             5

UPDATE: The RFM69 library works a lot better over ESP8266 changing the SPI clock divider to 2. You will have to modify the source code for RFM69.cpp file with this patch:

diff --git a/RFM69.cpp b/RFM69.cpp
index a1e1eeb..ad2e30b 100644
--- a/RFM69.cpp
+++ b/RFM69.cpp
@@ -450,7 +450,7 @@ void RFM69::select() {
   // set RFM69 SPI settings
-  SPI.setClockDivider(SPI_CLOCK_DIV4); // decided to slow down from DIV2 after SPI stalling in some instances, especially visible on mega1284p when RFM69 and FLASH chip both present
+  SPI.setClockDivider(SPI_CLOCK_DIV2); // speeding it up for the ESP8266
   digitalWrite(_slaveSelectPin, LOW);

Note: the was an error in the ESP12 footprint for version 0.1 of the board and GPIO 4 and 5 were swapped, so even thou the schematic showed IRQ pin to be GPIO4 it was 5 instead.


  • WebServer for configuration using the great PureCSS framework
  • Flashing firmware Over-The-Air (OTA)
  • Up to 3 configurable WIFI networks
  • MQTT support
  • Arbitrary number of mappings between nodes/keys and MQTT topics (as long as there is free memory available)
  • Optional default topic for non mapped nodes/keys.
  • Configurable IP and Heartbeat topics
  • Visual status of the received messages via the ESP12 LED

The project uses a series of state-of-the-art libraries:


The board has a header with 3V3, GND, RX and TX pins, and two buttons for RESET and FLASH. Connect the pins to your favorite FTDI-like programmer. Remember: only 3V3 voltage and connect RX to your FTDI TX pin and TX to your RX pin.

To enter flash mode you have to hold the FLASH button pressed while reseting the board with the RESET button.

The project is ready to be build using PlatformIO. Please refer to their web page for instructions on how to install the builder. Once installed:

> platformio run --target upload -e wire-debug
> platformio run --target uploadfs -e wire-debug

Once you have flashed it you can flash it again over-the-air using the ota environment:

> platformio run --target upload -e ota-debug
> platformio run --target uploadfs -e ota-debug

When using OTA environment it defaults to the IP address of the device in SoftAP mode. If you want to flash it when connected to your home network best way is to supply the IP of the device:

> platformio run --target upload -e ota-debug--upload-port
> platformio run --target uploadfs -e ota-debug --upload-port

Library dependencies not included in the project are automatically managed via PlatformIO Library Manager.


On normal boot (i.e. button not pressed) it will execute the firmware. It configures the radio, the SPIFFS memory access, the WIFI, the WebServer and MQTT connection.

Obviously the default values for WIFI network and MQTT will probably not match your requirements. The device will start in Soft AP creating a WIFI SSID named "RFM69_GATEWAY". Connect with phone, PC, laptop, whatever to that network, password is "fibonacci". Once connected browse to and you will be presented a configuration page where you will be able to define up to 3 possible WIFI networks and the MQTT configuration parameters, and topic mappings.

It will then try to connect to the configured WIFI networks one after the other. If none of the 3 attempts succeed it will default to SoftAP mode again. Once connected it will try to connect the MQTT server.

You can configure several aspects, most importantly:

  • up to 3 wifi SSID and password
  • MQTT server, port and optionally user and password
  • MQTT topics for IP and heartbeat messages
  • nodeID, key and topic to map a given key from a given nodeID to a certain MQTT topic
  • a defaultTopic, if defined, will be used as a default topic for any combination of nodeID+key not mapped. You can use {nodeid} and {key} as placeholders that will be replaced in execution time.

Messages from the nodes (probably Monteinos) do have to stick to one of these formats:


The first one being the default for Rusu's MotionNotes, for instance. "BAT:3812" could be a valid payload to notify battery status. The send method of the RFM69Manager library included will take care of the formatting. It will also add a correlative packetID that will be used in the gateway to detect duplicates or missing packages.

The RFM69Manager library inherits from RFM69_ATC, so it supports Automatic Transmission Control that improves battery life by reducing radio power dynamically.

The device will publish its IP to the given topic upon reboot and will send a heartbeat message every 60 seconds.


After flashing the firmware via serial do a hard reset of the device (unplug & plug). There is an issue with the ESP.reset() method that may stuck the device after an OTA update. Check https://github.com/esp8266/Arduino/issues/1017 for more info.