Farm-Data-Relay-System/FDRS_Gateway2000/README.md

35 lines
1.6 KiB
Markdown
Raw Normal View History

2022-01-30 03:13:02 +00:00
# Gateway 2.000
2022-05-21 13:00:55 +00:00
This is the FDRS Multiprotocol Gateway sketch. The device listens for packets over ESP-NOW, UART, LoRa, and/or MQTT, then retransmits the packets over these interfaces using rules defined in the "Actions" section of the configuration file.
2022-01-30 03:13:02 +00:00
2022-02-04 16:22:09 +00:00
The most commonly used configuration tells the device to take any ESP-NOW packet it receives and output the data over the serial port (UART):
2022-01-30 03:13:02 +00:00
```
2022-02-03 21:25:08 +00:00
#define UNIT_MAC 0x00
2022-01-30 03:13:02 +00:00
#define ESPNOWG_ACT sendSerial();
```
The companion for this device, connected via serial, takes any data it receives from the serial port and sends it via MQTT:
```
#define USE_WIFI
#define SERIAL_ACT sendMQTT();
```
Splitting the gateway into two devices allows you to use ESP-NOW and WiFi simultaneously without channel conflicts. You can also connect the first device to a computer with a USB-UART adapter and get the data that way, eliminating WiFi altogether.
2022-03-24 05:08:07 +00:00
If you have sensors that are out of range of your first gateway, you can use a gateway as a repeater. First set the UNIT_MAC to 0x01, then send general ESP-NOW traffic to the address of the first gateway:
2022-01-30 03:13:02 +00:00
```
2022-02-07 18:10:31 +00:00
#define UNIT_MAC 0x01
2022-02-07 18:07:59 +00:00
#define ESPNOWG_ACT sendESPNOW(0x00);
2022-01-30 03:13:02 +00:00
```
2022-05-21 13:00:55 +00:00
### LoRa
You can also use LoRa to expand the distances between hops. While ESP-NOW is quick enough to handle a lot of traffic in real-time, LoRa is much slower. For this reason, you must send LoRa data to a buffer and transmit it at standard intervals.
2022-02-22 14:14:02 +00:00
![Basic](/FDRS_Gateway2000/Basic_Setup.png)
2022-04-21 00:05:34 +00:00
![Advanced](/FDRS_Gateway2000/Advanced_Setup.png)
2022-02-22 14:14:02 +00:00
2022-04-21 00:05:34 +00:00
![Basic LoRa](/FDRS_Gateway2000/Basic_LoRa_Setup.png)
2022-02-22 14:14:02 +00:00
2022-04-21 00:05:34 +00:00
![Advanced LoRa](/FDRS_Gateway2000/Advanced_Setup_LoRa.png)
2022-02-22 14:14:02 +00:00