需先在 Arduino 库管理器装好 ArduinoJson、RadioLib(LoRa 用)和 PubSubClient(MQTT 用)三个依赖;使用前必须手动改 src/fdrs_globals.h 里的 WiFi 和全局参数,否则连不上;MQTT 网关地址固定为 0x00,ESP-NOW 和 LoRa 网关从 0x01 起,接中继时要改传感器的 GTWY_MAC。
Farm-Data-Relay-System
timmbognerMIT更新放缓用 ESP-NOW、LoRa 等无线协议在无 WiFi 覆盖的偏远农田中接力传输传感器数据,适合农业物联网场景。
A system that uses ESP-NOW, LoRa, and other protocols to transport sensor data in remote areas without relying on WiFi.
下载或克隆仓库后复制到 Arduino 的 libraries 文件夹;编辑 src/fdrs_globals.h 填入 WiFi 凭据等全局参数;先烧录 examples 中的 1_UART_Gateway.ino,再烧录 ESPNOW_Sensor.ino 测试。README 未说明具体芯片型号与内存要求,只提到使用 ESP32/ESP8266 类开发板,并推荐 ThingPulse ESPGateway 双 ESP32 WROVER-IB 板或带以太网的版本;LoRa 需配 LoRa32 等模块。
用 ESP-NOW 和 LoRa 搭建低功耗中继网络,让偏远地区的传感器数据不依赖 WiFi 也能传回来
用 ESP-NOW、LoRa 等无线协议在无 WiFi 覆盖的偏远农田中接力传输传感器数据,适合农业物联网场景。
核心能力
- 用 ESP-NOW 和 LoRa 组建网关与节点网络
- 网关按预设路由转发数据,可兼作中继扩展覆盖
- 节点分传感器节点和控制器节点,支持订阅回调
- 通过 UART 或 MQTT 把数据送到前端,MQTT 默认发到 fdrs/data
- 提供 ESP-NOW 与 LoRa 中继示例,改 GTWY_MAC 即可接入
容易踩的坑
暂无 release 数据(可能没有发版,或尚未同步)。
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Farm Data Relay System
In loving memory of Gay Holman, an extraordinary woman.
Farm Data Relay System is an easy way to communicate with remote IoT devices without relying on WiFi or LoRaWAN infrastructure. It establishes a series of inexpensive, low-power access points and repeaters to provide ESP-NOW and LoRa coverage for remote devices. FDRS can be used to transport sensor readings and control messages in situations where it would be too cumbersome to provide full WiFi/LoRaWAN coverage. While the system was designed with farming in mind, FDRS could also be beneficial in a classroom, home, or research setting.
Devices are classified into two types: Gateways and Nodes. Gateways comprise the infrastructure of the network, moving data along pre-directed routes and providing coverage to all devices. Nodes allow the user to exchange data with a gateway. Each gateway is identified with an 8-bit physical hex address (MAC), while nodes use 16-bit integers to identify datapoints as they move through the system.
Getting Started
Libraries Required:
- ArduinoJson
- RadioLib for LoRa
- PubSubClient for MQTT
Included:
To install FDRS:
-
Download or clone this repository and copy it into your Arduino 'libraries' folder.
-
After installing, edit the 'src/fdrs_globals.h' file with your WiFi credentials and other global parameters.
-
The first sketch you'll want to try is the 1_UART_Gateway.ino example. This device will listen for incoming ESP-NOW packets, then route them to the serial port (and vice versa). Next, flash the ESPNOW_Sensor.ino example to see how to send data to the gateway.
-
To use MQTT: Connect the second gateway to the first via the Rx and Tx pins (crossed), and flash it with the 0_MQTT_Gateway.ino example. If your WiFi and MQTT configurations are correct, data will be published to the topic 'fdrs/data'.
-
To extend your range, try the 2_ESPNOW_Repeater.ino or 3_LoRa_Repeater.ino. Just change the GTWY_MAC of your sensor to the address of your new repeater.
Nodes
Nodes can be described as sensors, controllers, or both:
- A Sensor node aggregates data into a packet, then sends it to a gateway via ESP-NOW or LoRa.
- A Controller node subscribes to one or more reading IDs. When data arrives from an ID the device is subscribed to, a callback function is called where the user can access the incoming data.
Gateways
Gateways are modular and configurable microcontroller devices that can perform a variety of useful functions including collecting, distributing, and relaying wireless data. They provide a flexible and cohesive interface between various wired and wireless protocols, and are generally arranged in a line or star topology. As a general rule, the gateway that uses MQTT always has the address 0x00, and ESP-NOW and LoRa gateways start at 0x01.
In its most common usage, an FDRS gateway is deployed as an access point for remote ESP-NOW and LoRa user nodes. If it receives a packet from an unknown ESP-NOW or LoRa address, the gateway assumes that these are sensor readings and passes them downstream towards the front-end. The gateway will also broadcast packets coming from the front-end out to any controller nodes that are registered/listening.
Gateways can also be configured as simple repeaters; passing data from one neighbor directly to another neighbor or vice versa. This can create a data wormhole that will carry packets upstream or downstream ad infinitum. You can configure your gateways to share data headed upstream with connected peers, thus providing them with any data being sent from the front-end.
If you're looking for a simple, attractve, and enclosed solution for your MQTT/UART gateway, I personally recommend both the ThingPulse ESPGateway and the ThingPulse ESPGateway Ethernet:
-
The ESPGateway contains two ESP32 WROVER-IB Modules on one board with external antennas. They are linked together by pins 14 and 15 to allow for serial communication between them. This is the perfect setup for a link between ESP-NOW and WiFi.
-
The ESPGateway Ethernet contains one ESP32 WROVER-IB Module with antenna, along with an RJ45 Ethernet connector. This is the hardware used in the ethernet gateway example.
Front-end
The front-end is where all data is entered or consumed by another application. This could be anything from a microcontroller communicating through UART and displaying data on a screen to a server/database platform logging the data via MQTT.
My recommended method of accessing your data is using a computer, server, or Raspberry Pi linked to an FDRS Gateway device via either MQTT or UART. Node-RED is my favorite platform for accessing/manipulating data on the front-end, and InfluxDB+Grafana is the dream team for storage and visualization.
Future Plans
Upcoming goals for FDRS include:
- A method for FDRS gateways to keep track of the time via NTP or an RTC module, then seamlessly distribute it amongst its neighbors and connected nodes.
- More sensor and controller examples. If you are using a device or sensor that is not covered in the examples, feel free to contribute an example of its basic usage!
- Support for cellular radios with TinyGSM.
- Channel Activity Detection (CAD) for LoRa.
Thank you
...very much for checking out my project! I truly appreciate everyone who has reached out with contributions and assistance, especially those featured in the "Contributors" section. If you have any questions, comments, issues, or suggestions please don't hesitate to contact me at [email protected] or open a discussion here on Github.
Many thanks go to the ever-instructional Andreas Spiess. His insight and ideas took this project from a roughly-hewn stone to the "diamond" you see today.
Thanks to LilyGo for sending me new LoRa32 modules when mine were damaged. Much of this project was created using TTGO devices, and I highly recommend their products!
It is a great honor to have been featured on Hackaday and hackster.io!
I started this project with instructions from Random Nerd Tutorials. If you are a beginner and trying to learn more about microcontrollers, I highly recommend starting there.

