Bresser 868 MHz Weather Sensor Radio Receiver based on ESP32/RP2040 and SX1262/SX1276 — sends data to a LoRaWAN Network
This is a remake of BresserWeatherSensorTTN based on RadioLib instead of MCCI Arduino LoRaWAN Library for LoRaWAN communication.
- RadioLib's LoRaWAN implementation is currently in beta stage.
- Helium Network is not supported (requires LoRaWAN v1.0.x)
- This should not be the first Arduino sketch you are ever trying to flash to your board - try somthing simple first (e.g.
blink.ino
) to get familiar with the tools and workflow. - If you are new to LoRaWAN
- Check out The Things Fundamentals on LoRaWAN
- Read the excellent article RadioLib LoRaWAN on TTN starter script
- You currently need the latest version (HEAD) of RadioLib
- Try and configure BresserWeatherSensorReceiver (examples/BresserWeatherSensorBasic) stand-alone before using it with BresserWeatherSensorLW
- LoRaWAN downlink commands (and responses) are not compatible with BresserWeatherSensorTTN
- Single 868 MHz Radio Transceiver for both Sensor Data Reception and LoRaWAN Connection
- Compatible to LoRaWAN Specification 1.1.0 / RP001 Regional Parameters 1.1 revision A
- Tested with The Things Network and ChirpStack
- Supports multiple 868 MHz Sensors (e.g. Weather Sensor and Soil Moisture Sensor or Indoor Thermometer/Hygrometer)
- See BresserWeatherSensorReceiver for supported sensors
- Low Power Design (using ESP32 Deep Sleep Mode / RP2040 Sleep State)
- Fast LoRaWAN Joining after Deep Sleep (using ESP32 RTC RAM / RP2040 RAM)
- ATC MiThermometer Bluetooth Low Energy Thermometer/Hygrometer Integration (optional)
- Theengs Decoder Bluetooth Low Energy Sensors Integration (optional)
- OneWire Temperature Sensor Integration (optional)
- ESP32/RP2040 Analog Digital Converter Integration (optional)
- A02YYUW / DFRobot SEN0311 Ultrasonic Distance Sensor (30...4500mm) (optional)
- Remote Configuration via LoRaWAN Downlink
- Implementation with Separation between LoRaWAN Network Layer and Application Layer for easy Repurposing
- Loading of LoRaWAN secrets from JSON file on LittleFS (optional)
- Weather sensor data reception
- BLE sensor data reception
- LoRaWAN join
- LoRaWAN data uplink
- LoRaWAN network time request & RTC setting
- Energy saving / battery deep-discharge protection
- Wakeup time adjustment
- LoRaWAN control downlink
- LoRaWAN status uplink
- Periodic LinkCheck
- Node/network status/debug information
- setDeviceStatus(battLevel)
- Log messages
- Supported boards
- Enforce minimum uplink interval
- RP2040 specific implementation
- Fix battery voltage measurement for HW targets FIREBEETLE_ESP32_COVER_LORA & LORAWAN_NODE
- Separate LoRaWAN network and application code
- Change LoRaWAN control downlink / status uplink messages
- Update Javascript encoders/decoders
- Implement using of BLE sensor addresses configured via downlink
- Update documentation
- Implement Heltec WiFi LoRa 32 V3 battery voltage measurement
- Supported Hardware
- LoRaWAN Network Service Configuration
- Software Build Configuration
- LoRaWAN Payload Formatters
- MQTT Integration
- Datacake Integration
- Remote Configuration Commands / Status Requests via LoRaWAN
- Loading LoRaWAN Network Service Credentials from File
- Customizing the Application Layer
- Doxygen Generated Source Code Documentation
- References
- Legal
Status | Setup | Board (/ Revision) | Define (Prefix: ARDUINO_) | Radio Module | Notes |
---|---|---|---|---|---|
⌛ | LILYGO®TTGO-LORA32 V1 | TTGO LoRa32-OLED / TTGO LoRa32 V1 (No TFCard) |
TTGO_LORA32_V1 | SX1276 (HPD13A) | - |
⌛ | LILYGO®TTGO-LORA32 V2 | TTGO LoRa32-OLED / TTGO LoRa32 V2 |
TTGO_LoRa32_V2 | SX1276 (HPD13A) | For LMIC only: Wire DIO1 to GPIO33 |
✅ | LILYGO®TTGO-LORA32 V2.1 | TTGO LoRa32-OLED / TTGO LoRa32 V2.1 (1.6.1) |
TTGO_LoRa32_v21new | SX1276 (HPD13A) | - |
⌛ | Heltec Wireless Stick | Heltec Wireless Stick | heltec_wireless_stick | SX1276 | - |
⌛ | Heltec WiFi LoRa 32 V2 | Heltec WiFi LoRa 32(V2) | heltec_wifi_lora_32_V2 | SX1276 | - |
✅ | Heltec WiFi LoRa 32 V3 | Heltec WiFi LoRa 32(V3) | heltec_wifi_32_lora_V3 | SX1262 | - |
✅ | LoRaWAN_Node | FireBeetle-ESP32 | ESP32_DEV -> LORAWAN_NODE | SX1276 (RFM95W) | - |
✅ | DFRobot FireBeetle ESP32 IoT Microcontroller with FireBeetle Cover LoRa Radio 868MHz | FireBeetle-ESP32 | ESP32_DEV & FIREBEETLE_ESP32_COVER_LORA | SX1276 (LoRa1276) | Wiring on the cover: D2 to RESET D3 to DIO0 D4 to CS D5 to DIO1 |
⌛ | Adafruit Feather ESP32S2 with Adafruit LoRa Radio FeatherWing | Adafruit Feather ESP32-S2 | FEATHER_ESP32S2 | SX1276 (RFM95W) | No Bluetooth available! Wiring on the Featherwing: E to IRQ D to CS C to RST A to DI01 |
✅ | Thingpulse ePulse Feather with Adafruit LoRa Radio FeatherWing | Adafruit ESP32 Feather | FEATHER_ESP32 | SX1276 (RFM95W) | Wiring on the Featherwing: E to IRQ D to CS C to RST A to DI01 see #55 |
✅ | M5Stack Core2 with M5Stack Module LoRa868 | M5Core2 | M5STACK_CORE2 | SX1276 (RA-01H) |
Wiring on the LoRa868 Module: DIO1 to GPIO35 "M5Unified" must be installed M5.begin() is called to control power management |
✅ | ESP32-S3 PowerFeather with Adafruit LoRa Radio FeatherWing | ESP32-S3 PowerFeather | ESP32S3_POWERFEATHER | SX1276 (RFM95W) | Wiring on the Featherwing: E to IRQ D to CS C to RST A to DI01 "PowerFeather-SDK" must be installed Board.init(BATTERY_CAPACITY_MAH); is called to control power management |
✅ | Adafruit Feather RP2040 with Adafruit LoRa Radio FeatherWing | Adafruit Feather RP2040 | ADAFRUIT_FEATHER_RP2040 | SX1276 (RFM95W) | No Bluetooth available! Configuration: Choose an entry with "FS" in section Flash Size! Wiring on the Featherwing: E to IRQ D to CS C to RST A to DI01 |
⌛ — confirmation pending
✅ — confirmed
By selecting a Board and a Board Revision in the Arduino IDE, a define is passed to the preprocessor/compiler. For the boards listed in Supported Hardware, the default configuration is assumed based on this define. If this is not what you need, you have to switch to Manual Configuration.
If you are not using the Arduino IDE, you can use the defines in Supported Hardware with your specific tool chain to get the same result.
If enabled in the Arduino IDE Preferences ("Verbose Output"), the preprosessor will provide some output regarding the selected configuration, e.g.
ARDUINO_ADAFRUIT_FEATHER_ESP32S2 defined; assuming RFM95W FeatherWing will be used
[...]
Radio chip: SX1276
Pin config: RST->0 , IRQ->5 , NSS->6 , GPIO->11
-
Check the board manufacturer's datasheet, pinout specifications and schematic.
-
Check the board's pin definitions file (
pins_arduino.h
) in the arduino-esp32 project -
Which LoRaWAN radio chip is used? SX1262 or SX1276?
-
Which pins are used for SPI (SCK, MISO and MOSI)?
-
On-board LoRaWAN radio chip:
- Which GPIO pins are connected to NSS (CSN), RST, IRQ and GPIO?
-
Separate LoRaWAN module:
- Which GPIO pins are available (i.e. otherwise unconnected) for NSS (CSN), RST, IRQ and GPIO?
- Connect the ESP32 board with the LoRaWAN module according to the selected GPIO pins.
- Connect the SPI and power supply pins as required.
Note
Alternative pin names: SX1262: IRQ => DIO0, GPIO => BUSY SX1276: IRQ => DIO0, GPIO => DIO1
Important
With the information above, the source code in both BresserWeatherSensorReceiver and BresserWeatherSensorLW has to be modified!
To find out which #define
is set for identifying your board:
In the Arduino IDE —
- In the
File
menu, openPreferences
and enable the checkbox "Show verbose output during compile" - In the
Tools
menu, select your board (and board variant, if available) - Compile any sketch (e.g.
Blink
from the Arduino examples) - Search for a string starting with
-DARDUINO_
in the output window (e.g.-DARDUINO_FEATHER_ESP32
)
The string which resembles your board name — without the preceding -D
— is the wanted define (e.g. ARDUINO_FEATHER_ESP32
).
This can be used by the C++ preprocessor to select board specific code, e.g.
#if defined(ARDUINO_FEATHER_ESP32)
// Put Adafruit Feather ESP32 specific code here
#endif
In WeatherSensorCfg.h
:
- Select or create a code section which will actually be used by the C++ preprocessor (`#if defined(<YOUR_BOARD_DEFINE>) ...).
- Set the radio chip according to your hardware by (un-)commenting
USE_SX1262
orUSE_SX1276
. - Set the pin definitions
PIN_RECEIVER_CS
,PIN_RECEIVER_IRQ
,PIN_RECEIVER_GPIO
andPIN_RECEIVER_RST
according to your hardware. - Cross check in the compiler log messages if the desired settings are actually used.
In config.h
:
- Select or create a code section which will actually be used by the C++ preprocessor (`#if defined(<YOUR_BOARD_DEFINE>) ...).
- Set the radio chip according to your hardware defining
LORA_CHIP
. - Set the pin definitions
#define PIN_LORA_NSS
,PIN_LORA_RST
,PIN_LORA_IRQ
andPIN_LORA_GPIO
according to your hardware. - Cross check in the compiler log messages if the desired settings are actually used.
If your setup is working — congratulations! Be nice and provide your insights to the project to help others!
Warning
Exceeding the allowed supply voltage or analog digital converter (ADC) input voltage range or reversing the polarity will destroy your board!
While the battery voltage measurement is not crutial for operation, it is still important if the device is powered from a battery.
The battery voltage is used for:
- Providing battery status to the LoRaWAN network server on request
- Battery deep-discharge protection and energy saving mode
- Monitoring battery status via uplink (e.g. for optimization of transmission interval)
Note
The following section is meant as a general introduction. Actual implementations may vary. Consult you board's documentation for details!
The boards used in this project can be supplied by 5V via USB or by another supply voltage via a second power supply connector. Many have an integrated lithium-ion battery charger. A lithium-ion battery has a voltage range of ~2.4...4.2V. The usable voltage range for the board depends on the actual circuit. If a voltage regulator is used (and no voltage converter), the usable battery voltage range is ~3.3...4.2V.
The MCUs used in this project have an integrated ADC with an input voltage range of 0...3.3V. Therefore, the battery voltage has to be reduced by a voltage divider to provide a voltage range suitable for the ADC.
The ADC input circuitry may come in a few different flavors:
- A voltage divider is directly connected to the battery and to the ADC input
- Resistors for a voltage divider are present, but solder bridges are required to actually connect them
- A voltage divider is implemented, but an electronic switch has to be enabled for using it
- A voltage divider has to be implemented as external circuit
Last, but not least, some boards provide a separate battery monitoring chip.
Only the cases 1 and 2 will be covered here.
Find the voltage divider and the ADC input pin used for battery voltage measurement (if available) in your board's circuit diagram.
In BresserWeatherSensorLWCfg.h
:
- Add a code section with your board definition (see Board Identification).
- Define
PIN_ADC_IN
with your board specific pin. - Define
UBATT_DIV
with your voltage divider ratio if it differs from the default value of0.5
.
The function getBatteryVoltage()
in adc.cpp provides the battery voltage. Any board specific implementation should be placed there. getBatteryVoltage()
returns 0
for any unknown board or a known board with out a default ADC input circuit to indicate that the battery voltage cannot be measured.
Create an account and set up a device configuration in your LoRaWAN network provider's web console, e.g. The Things Network.
- LoRaWAN v1.1
- Regional Parameters 1.1 Revision A
- Device class A
- Over the air activation (OTAA)
- Install the Arduino ESP32 board package in the Arduino IDE
- Select your ESP32 board
- Install all libraries as listed in the section package.json — section dependencies — via the Arduino IDE Library Manager
- Clone (or download and unpack) the latest (BresserWeatherSensorLW Release)
- Set your LoRaWAN Network Service credentials —
RADIOLIB_LORAWAN_DEV_EUI
,RADIOLIB_LORAWAN_NWK_KEY
andRADIOLIB_LORAWAN_APP_KEY
&mdash in secrets.h:
// The Device EUI & two keys can be generated on the TTN console
// Replace with your Device EUI
#define RADIOLIB_LORAWAN_DEV_EUI 0x---------------
// Replace with your App Key
#define RADIOLIB_LORAWAN_APP_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
// Put your Nwk Key here
#define RADIOLIB_LORAWAN_NWK_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
- Load the sketch BresserWeatherSensorLW.ino
- Compile and Upload
In BresserWeatherSensorLWCfg.h:
- Configure your time zone by editing
TZ_INFO
- Disable sensor/interface features which you do not want to use
- Adjust battery voltage levels
- Configure the timing parameters if required
- If enabled, configure your ATC MiThermometer's / Theengs Decoder's BLE MAC Address by by editing
KNOWN_BLE_ADDRESSES
- Configure the ADC's input pins, dividers and oversampling settings as needed
- Disable sensor decoders wich are not needed
Debug Output Configuration in Arduino IDE
Watch your board's debug output in the serial console and the LoRaWAN communication in your network provider's web console.
Upload Uplink Formatter and Downlink Formatter scripts in your LoRaWAN network service provider's web console to allow decoding / encoding raw data to / from JSON format.
See The Things Network MQTT Integration and Payload Formatters and TS013-1.0.0 Payload Codec API for more details.
Decode uplink payload (a sequence of bytes) into JSON format, i.e. data structures which are readable/suitable for further processing.
In The Things Network Console:
- Go to "Payload formatters" -> "Uplink"
- Select "Formatter type": "Custom Javascript formatter"
- "Formatter code": Paste scripts/uplink_formatter.js
- Apply "Save changes"
Note
The actual payload depends on the options selected in the Arduino sketch (see) BresserWeatherSensorsLW.cfg) — the decoder must be edited accordingly (add or remove data types and JSON identifiers). The configuration dependent part of the decoder can be created with a C++ preprocessor and the Python script generate_decoder.py.
Encode downlink payload from JSON to a sequence of bytes.
In The Things Network Console:
- Go to "Payload formatters" -> "Downlink"
- Select "Formatter type": "Custom Javascript formatter"
- "Formatter code": Paste scripts/downlink_formatter.js
- Apply "Save changes"
TTN provides an MQTT broker. How to receive and decode the payload with an MQTT client - see https://www.thethingsnetwork.org/forum/t/some-clarity-on-mqtt-topics/44226/2
V3 topic:
v3/<ttn app id><at symbol>ttn/devices/<ttn device id>/up
v3 message key field jsonpaths:
<ttn device id> = .end_device_ids.device_id
<ttn app id> = .end_device_ids.application_ids.application_id // (not including the <at symbol>ttn in the topic)
<payload> = .uplink_message.frm_payload
JSON-Path with Uplink-Decoder (see scripts/uplink_formatter.js)
.uplink_message.decoded_payload.bytes.<variable>
YouTube Video: Get started for free with LoRaWaN on The Things Network and Datacake IoT Platform
Many software parameters can be defined at compile time, i.e. in BresserWeatherSensorLWCfg.h. A few parameters can also be changed and queried at run time via LoRaWAN, either using raw data or using Javascript Uplink/Downlink Formatters.
Parameter | Description |
---|---|
<ws_timeout> | Weather sensor receive timeout in seconds; 0...255 |
<sleep_interval> | Sleep interval (regular) in seconds; 0...65535 |
<sleep_interval_long> | Sleep interval (energy saving mode) in seconds; 0...65535 |
<epoch> | Unix epoch time, see https://www.epochconverter.com/ ( <integer> / "0x....") |
<reset_flags> | Raingauge reset flags; 0...15 (1: hourly / 2: daily / 4: weekly / 8: monthly) / "0x0"..."0xF" |
<rtc_source> | Real time clock source; 0x00: GPS / 0x01: RTC / 0x02: LORA / 0x03: unsynched / 0x04: set (source unknown) |
<sensors_incX> | Bresser sensor IDs include list; e.g. "0xDEADBEEF"; "0x00000000" => empty list => default values |
<sensors_excX> | Bresser sensor IDs include list; e.g. "0xDEADBEEF"; "0x00000000" => empty list => default values |
<max_sensors> | Max. number of Bresser sensors per receive cycle; 1...8 |
<rx_flags> | Flags for getData(); see BresserWeatherSensorReceiver |
<en_decoders> | Enabled sensor data decoders; see BresserWeatherSensorReceiver |
<ble_active> | BLE active scan; 1 (active scan) / 0 (passive scan) |
<ble_scantime> | BLE scan time in seconds; 0...255 |
<ble_addrX> | BLE sensor MAC addresses; e.g. "DE:AD:BE:EF:12:23" |
Warning
Confirmed downlinks should not be used! (see here for an explanation.)
Important
To set sensors_inc / sensors_exc to the compile time default configuration, set the first ID in CMD_SET_SENSORS_INC / CMD_SET_SENSORS_EXC to 0x00000000. To set the BLE sensor addresses to the compile time default configuration, set the first address in CMD_SET_BLE_ADDR to 0x000000000000.
Note
Default values
- Sleep interval (long): see
BresserWeatherSensorLWCfg.h
- BLE addresses and scan parameters: see
BresserWeatherSensorLWCfg.h
- Weather sensor receive timeout: see
BresserWeatherSensorReceiver/src/WeatherSensorCfg.h
- Sensor IDs include/exclude list: see
BresserWeatherSensorReceiver/src/WeatherSensorCfg.h
Command | Port | Downlink | Uplink |
---|---|---|---|
CMD_GET_DATETIME | 0x86 (134) | 0x00 | epoch[31:24] epoch[23:16] epoch[15:8] epoch[7:0] rtc_source[7:0] |
CMD_SET_DATETIME | 0x88 (136) | epoch[31:24] epoch[23:16] epoch[15:8] epoch[7:0] |
n.a. |
CMD_SET_SLEEP_INTERVAL | 0xA8 (168) | sleep_interval[15:8] sleep_interval[7:0] |
n.a. |
CMD_SET_SLEEP_INTERVAL_LONG | 0xA9 (169) | sleep_interval_long[15:8] sleep_interval_long[7:0] |
n.a. |
CMD_GET_LW_CONFIG | 0xB1 (177) | 0x00 | sleep_interval[15:8] sleep_interval[7:0] sleep_interval_long[15:8] sleep_interval_long[7:0] |
CMD_GET_WS_TIMEOUT | 0xC0 (192) | 0x00 | ws_timeout[7:0] |
CMD_SET_WS_TIMEOUT | 0xC1 (193) | ws_timeout[7:0] | n.a. |
CMD_RESET_RAINGAUGE | 0xC3 (195) | flags[7:0] | n.a. |
CMD_GET_SENSORS_INC | 0xC4 (196) | 0x00 | sensors_inc0[31:24] sensors_inc0[23:15] sensors_inc0[16:8] sensors_inc0[7:0] ... |
CMD_SET_SENSORS_INC | 0xC5 (197) | sensors_inc0[31:24] sensors_inc0[23:15] sensors_inc0[16:8] sensors_inc0[7:0] ... |
n.a. |
CMD_GET_SENSORS_EXC | 0xC6 (198) | 0x00 | sensors_exc0[31:24] sensors_exc0[23:15] sensors_exc0[16:8] sensors_exc0[7:0] ... |
CMD_SET_SENSORS_EXC | 0xC7 (199) | sensors_exc0[31:24] sensors_exc0[23:15] sensors_exc0[16:8] sensors_exc0[7:0] ... |
n.a. |
CMD_GET_SENSORS_CFG | 0xCC (204) | 0x00 | max_sensors[7:0] rx_flags[7:0] en_decoders<7:0> |
CMD_SET_SENSORS_CFG | 0xCD (205) | max_sensors[7:0] rx_flags[7:0] en_decoders<7:0> |
n.a. |
CMD_GET_BLE_ADDR | 0xC8 (200) | 0x00 | ble_addr0[47:40] ble_addr0[39:32] ble_addr0[31:24] ble_addr0[23:15] ble_addr0[16:8] ble_addr0[7:0] ... |
CMD_SET_BLE_ADDR | 0xC9 (201) | ble_addr0[47:40] ble_addr0[39:32] ble_addr0[31:24] ble_addr0[23:15] ble_addr0[16:8] ble_addr0[7:0] ... |
n.a. |
CMD_GET_BLE_CONFIG | 0xCA (202) | 0x00 | ble_active[7:0] ble_scantime[7:0] |
CMD_SET_BLE_CONFIG | 0xCB (203) | ble_active[7:0] ble_scantime[7:0] |
n.a. |
- Set port for CMD_SET_SLEEP_INTERVAL to 168
- Convert interval to hex: 300 = 0x012C
- Set payload to 0x01 0x2C
- Send downlink via The Things Network Console
- Set port for CMD_SET_DATETIME to 136
- Get epoch (e.g. from https://www.epochconverter.com/hex) (Example: 0x63B2BC32); add an offset (estimated) for time until received (Example: + 64 / 0x40 seconds => 0x63B2BC72)
- Set payload to 0x63 0xB2 0xBC 0x72
- Send downlink via The Things Network Console
Command | Downlink | Uplink |
---|---|---|
CMD_GET_DATETIME | {"cmd": "CMD_GET_DATETIME"} | {"epoch": <epoch>} |
CMD_SET_DATETIME | {"epoch": <epoch>} | n.a. |
CMD_SET_SLEEP_INTERVAL | {"sleep_interval": <sleep_interval>"} | n.a. |
CMD_SET_SLEEP_INTERVAL_LONG | {"sleep_interval_long": <sleep_interval_long>} | n.a. |
CMD_GET_LW_CONFIG | {"cmd": "CMD_GET_LW_CONFIG"} | {"sleep_interval": <sleep_interval>, "sleep_interval_long": <sleep_interval_longC>} |
CMD_GET_WS_TIMEOUT | {"cmd": "CMD_GET_WS_TIMEOUT"} | {"ws_timeout": <ws_timeout>} |
CMD_SET_WS_TIMEOUT | {"ws_timeout": <ws_timeout>} | n.a. |
CMD_RESET_RAINGAUGE | {"reset_flags": <reset_flags>} | n.a. |
CMD_GET_SENSORS_INC | {"cmd": "CMD_GET_SENSORS_INC"} | {"sensors_inc": [<sensors_inc0>, ..., <sensors_incN>]} |
CMD_SET_SENSORS_INC | {"sensors_inc": [<sensors_inc0>, ..., <sensors_incN>]} | n.a. |
CMD_GET_SENSORS_EXC | {"cmd": "CMD_GET_SENSORS_EXC"} | {"sensors_exc": [<sensors_exc0>, ..., <sensors_excN>]} |
CMD_SET_SENSORS_EXC | {"sensors_exc": [<sensors_exc0>, ..., <sensors_excN>]} | n.a. |
CMD_GET_SENSORS_CFG | {"cmd": "CMD_GET_SENSORS_CFG"} | {"max_sensors": <max_sensors>, "rx_flags": <rx_flags>, "en_decoders": <en_decoders>} |
CMD_SET_SENSORS_CFG | {"max_sensors": <max_sensors>, "rx_flags": <rx_flags>, "en_decoders": <en_decoders>} | n.a. |
CMD_GET_BLE_ADDR | {"cmd": "CMD_GET_BLE_ADDR"} | {"ble_addr": [<ble_addr0>, ..., <ble_addrN>]} |
CMD_SET_BLE_ADDR | {"ble_addr": [<ble_addr0>, ..., <ble_addrN>]} | n.a. |
CMD_GET_BLE_CONFIG | {"cmd": "CMD_GET_BLE_CONFIG"} | {"ble_active": <ble_active>, "ble_scantime": <ble_scantime>} |
CMD_SET_BLE_CONFIG | {"ble_active": <ble_active>, "ble_scantime": <ble_scantime>} | n.a. |
- Build payload as JSON string:
{"sleep_interval": 360}
— the correct port is selected automatically - Send downlink via The Things Network Console
- Get epoch (e.g. from https://www.epochconverter.com) (Example: 1692729833); add an offset (estimated) for time until received (Example: + 64 seconds => 1692729897)
- Build payload as JSON string: {"epoch": 1692729897}
- Send downlink via The Things Network Console
To simplify deployment of a larger number of devices, LoRaWAN credentials can be read from a JSON file. This allows to use the same source code and binary file for a fleet of devices.
If a valid file secrets.json
exists on LittleFS, the settings defined at compile time (in secrets.h
) are overridden.
Modify the example data/secrets.json as required and install it to the board's Flash memory using earlephilhower/arduino-littlefs-upload.
Warning
Only very basic validation of the file secrets.json
is implemented.
By replacing the Application Layer with your own code, you can use this project as a starting point for your own purpose.
Use extras/customization/AppLayerMinimal.h and extras/customization/AppLayerMinimal.cpp as a template.
https://matthias-bs.github.io/BresserWeatherSensorTTN/index.html
Based on
- BresserWeatherSensorReceiver by Matthias Prinke
- RadioLib by Jan Gromeš
- Lora-Serialization by Joscha Feth
- ESP32Time by Felix Biego
- OneWireNg by Piotr Stolarz
- DallasTemperature / Arduino-Temperature-Control-Library by Miles Burton
- NimBLE-Arduino by h2zero
- Theengs Decoder by Theengs Project
- DistanceSensor_A02YYUW by Pablo Portela
- Preferences by Volodymyr Shymanskyy
This project is in no way affiliated with, authorized, maintained, sponsored or endorsed by Bresser GmbH or any of its affiliates or subsidiaries.