TinyDTN is a minimalistic implementation of the Bundle Protocol v7 (BPv7) designed specifically for Arduino-based platforms. It enables LoRa communication using DTN bundles, making it suitable for small, resource-constrained devices. The library intentionally focuses only on sending DTN bundles to maintain a minimal footprint, ensuring compatibility with even the simplest Arduino devices.
- Bundle Protocol v7 (BPv7) compliance
- Minimal implementation suitable for microcontrollers
- Optional CRC calculation
- Tested on Adafruit LoRa M0 development board
- Adafruit LoRa M0 development board or compatible
- Arduino IDE
- LoRa library (such as LoRaSem)
- tinyCBOR library for encoding CBOR
You can purchase the Adafruit LoRa M0 module from Adafruit's official store. Please note that you will also need to add an appropriate antenna to the module for optimal performance.
Ensure your development board is properly connected, and the pins are configured according to the following setup:
- CS Pin: Pin 8
- Reset Pin: Pin 4
- IRQ Pin: Pin 3
The default LoRa frequency is set to 434 MHz. Please adjust the frequency to match your local regulations.
- Clone this repository:
git clone https://github.com/samograsic/TinyDTN.git
- Open the Arduino IDE and load the
ArduinoDTN.ino
sketch from theTinyDTN
folder.
- Adjust the frequency if needed in the code:
#define FREQUENCY 434E6 // Set your local frequency here
- Set the source and destination endpoint IDs as required.
- If no accurate time is available, use 0 for
currentUnixTime
and increase thesequenceNumber
on every transmission to ensure unique identifiers.
Below is an example of how to create and send a DTN bundle:
IPNEndpointId source = {268484888, 2};
IPNEndpointId destination = {268484612, 2};
uint64_t lifetime = 3600000; // 1 hour in milliseconds
DTNBundle bundle(source, destination, currentUnixTime, 1, lifetime, true); // Set useCRC to true or false as needed
const char* payloadString = "Hello DTN world!";
bundle.setPayload(payloadString);
uint8_t encodedBundle[LORABUFLENGTH];
size_t bundleLength = bundle.encodeBundle(encodedBundle, sizeof(encodedBundle));
// Send bundle to LoRa
LoRa.beginPacket();
LoRa.write(encodedBundle, bundleLength);
LoRa.endPacket();
- This project was tested on the Adafruit LoRa M0 development board. Other compatible boards should work as well but may require adjustments.
- The CRC calculation is optional. You can disable it by setting
useCRC
tofalse
in theDTNBundle
constructor. - This implementation is focused only on sending bundles, and reception functionality is kept to a minimal example to reduce the library's size and complexity.
- On the receiving side, the IONe DTN implementation was used with the UART Convergence Layer. You can find more details here: IONe DTN UART LoRa.
Contributions are welcome! If you have suggestions for improvements or would like to contribute to this project, please open an issue or submit a pull request.
This project is licensed under the MIT License.
For more information, please contact Samo Grasic at [[email protected]].
This work was conducted as part of the IPNSIG Project Working Group.