https://github.com/powerbroker2/serialtransfer
Arduino library to transfer dynamic, packetized data fast and reliably via Serial, I2C, or SPI
https://github.com/powerbroker2/serialtransfer
arduino-library arduino-to-arduino bytes communication i2c i2c-communication i2c-protocol inter-arduino packets rx-buffer senddata serial serial-communication spi spi-communication spi-protocol transfer tx-buffer uart usart
Last synced: 6 days ago
JSON representation
Arduino library to transfer dynamic, packetized data fast and reliably via Serial, I2C, or SPI
- Host: GitHub
- URL: https://github.com/powerbroker2/serialtransfer
- Owner: PowerBroker2
- License: mit
- Created: 2019-07-16T21:50:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-02T20:17:47.000Z (4 months ago)
- Last Synced: 2025-04-08T02:39:18.586Z (about 1 month ago)
- Topics: arduino-library, arduino-to-arduino, bytes, communication, i2c, i2c-communication, i2c-protocol, inter-arduino, packets, rx-buffer, senddata, serial, serial-communication, spi, spi-communication, spi-protocol, transfer, tx-buffer, uart, usart
- Language: C++
- Homepage:
- Size: 445 KB
- Stars: 446
- Watchers: 23
- Forks: 69
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
# SerialTransfer
[](https://badge.fury.io/gh/PowerBroker2%2FSerialTransfer) [](https://www.ardu-badge.com/SerialTransfer)
SerialTransfer is an easy to use Arduino library for transferring packetized data fast and reliably via **Serial, I2C, and SPI interfaces**. Interconnect your Arduinos today minus the headache with SerialTransfer
This library:
- can be downloaded via the Arduino IDE's Libraries Manager (search "SerialTransfer.h")
- works with "software-serial", "software-I2C", and "software-SPI" libraries
- is non blocking
- uses packet delimiters
- uses consistent overhead byte stuffing
- uses CRC-8 (Polynomial 0x9B with lookup table)
- allows the use of dynamically sized packets (packets can have payload lengths anywhere from 1 to 254 bytes)
- supports user-specified callback functions
- **can transfer bytes, ints, floats, structs, even large files like JPEGs and CSVs!!**# Packet Anatomy:
```
01111110 00000000 11111111 00000000 00000000 00000000 ... 00000000 10000001
| | | | | | | | | | | | | | | | |______|__Stop byte
| | | | | | | | | | | | | | |______|___________8-bit CRC
| | | | | | | | | | | | |_|____________________Rest of payload
| | | | | | | | | | |______|________________________2nd payload byte
| | | | | | | | |______|_________________________________1st payload byte
| | | | | | |______|__________________________________________# of payload bytes
| | | | |______|___________________________________________________COBS Overhead byte
| | |______|____________________________________________________________Packet ID (0 by default)
|______|_____________________________________________________________________Start byte (constant)
```# ***How To Use:***
See the [example sketches](https://github.com/PowerBroker2/SerialTransfer/tree/master/examples)
- datum = tx/rx a single object
- data = tx/rx multiple objects# ***NOTE:***
SPITransfer.h and it's associated features are not supported for the Arduino Nano 33 BLE or DUE and other boards. This header file is disabled by default, but can be enabled by commenting out `#define DISABLE_SPI_SERIALTRANSFER 1` within `SerialTransfer.h`.