项目自述为实验性协议,README 明确提示按现状提供、使用风险自负;SoftwareBitBang 等总线测试需遵循抗干扰与保护电路指南;OverSampling、ThroughSerial、ThroughLoRa 无线电测试前需确认频率与功率符合当地法规。

PJON
gioblu更新放缓兼容 Arduino 的多主多介质网络协议,让单片机、ESP32、树莓派等设备通过 LoRa、MQTT 等介质组网通信。
PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
README 未给出安装命令,请参考 documentation/README.md 与 specification/PJON-protocol-specification-v4.0.mdREADME 未说明显存或 GPU 要求;面向 ATtiny、ATmega、SAMD、ESP8266、ESP32、STM32、Teensy、树莓派及 Linux、Windows x86、Apple、Android 等平台,无需额外硬件即可运行。
实验性多主多介质网络协议,让单片机用软件定义方式组网通信
兼容 Arduino 的多主多介质网络协议,让单片机、ESP32、树莓派等设备通过 LoRa、MQTT 等介质组网通信。
核心能力
- 用策略抽象层支持单线、串口、RS485、LoRa、UDP、TCP、MQTT 等多种介质
- 支持多主通信与热插拔,增删设备无需重启系统
- 模块化数据包仅含所需字段,开销 5–35 字节
- 用 CRC8 与 CRC32 多项式做错误检测,可选确认与 MAC 地址
- 通过接口抽象层可交叉编译到 ATtiny、ESP32、STM32、Linux 等平台
容易踩的坑
- 13.113.1 stable最新正式版2022-02-10 · 2022-02-10 21:49 UTC
Changelog:
- Documentation has been enhanced
- Updated the
MQTTTranslatestrategy to use PJON_Packet_Info by @fredilarsen - Limited scope of some Windows-specific defines for LocalFile strategy by @fredilarsen
- Added column to 1-wire comparison by @jdaandersj
- PJONDefines.h
PJON_MASTER_IDdefault added - SoftwareBitBang Surrogate avoid polling for ETCP
- Inline
LINUX_Interfacefunctions and remove global vars by @rainerschoe
Bugfix:
- Fixed undefined behavior when using ports by @rainerschoe
PJONLocalexamples fixed strategy inclusion error
Backward compatibility is preserved.
- 13.013.0 stable2020-11-10 · 2020-11-10 22:09 UTC
查看更新说明
New specifications:
- PJON v4.0 includes the hardware identification, the hop count and deprecates the asynchronous acknowledgement
- PJDL v5.0 includes a coherent specification of timing and tolerance of each mode, a new preamble able to reduce retransmissions and specifies the timeout to be derived from the length of the frame instead of requiring a common static configuration
- TSDL v3.0 includes a more reliable acknowledgement exchange
Changelog:
- Sender's and recipient's MAC address can be optionally included and used for addressing
- The hop count is included in shared mode to enable more advanced routing schemes
- The library can now be included and used more easily, see configuration
- SoftwareBitBang implements PJDL v5.0
- SoftwareBitBang full support for STM32F103/BluePill added by @jcallano
- ThroughSerial implements TSDL v3.0 and receives data asynchronously
- Zephyr support and examples by @Cimex97
- Routing improvements and examples by @fredilarsen
- The LINUX interface now uses
termios2for generic baudrate support by @callalilychen - The LINUX interface
delayMicrosecondsnow usesselectto reduce the CPU usage by @Girgitt - ESPNOW can use MAC addresses directly by @porkyneal
- Send functions can now receive a
PJON_Packet_Info, see documentation - The asynchronous acknowledgement has been removed
- Bus id getter and setter added
Bugfix:
- Fixed ThroughSerial and ThroughLoRa acknowledgement vulnerability in multi-master mode
This version is not backward compatible! If you need help see update from 12.x to 13.0
- 12.112.1 stable2020-03-19 · 2020-03-19 16:12 UTC
查看更新说明
New specifications:
- PJDL v4.1 includes the maximum range of each mode experimentally determined by @jdaandersj
- PJON v3.2 is updated with more detailed description of the model and its procedures
Changelog:
- PJONLocal class implements a subset of the PJON protocol's features and it was developed to enable PJON networking on very limited microcontrollers, where even few bytes of ram can make a difference
- MQTTTranslate strategy can connect PJON networks and more standard applications with each other using MQTT, developed by @fredilarsen
- SoftwareBitBang maximum range is 800-2000m, experimentally determined by @jdaandersj
- SoftwareBitBang ATmega328PB support added by @Willie68 (#309)
- PJONVirtualBusRouter detection of missing/moved devices added by @fredilarsen
- ESPNOW PlatformIO examples added by @justoke
- Enhanced routing documentation
Bugfix:
- DualUDP back-off frequency reduced to avoid performance loss by @fredilarsen
- DualUDP peformance loss on ESP8266 fixed by @fredilarsen (https://github.com/gioblu/PJON/commit/0325299538d314105d122cdb9f1e2d94bcdd348f)
Backward compatibility is preserved.
- 12.012.0 stable2019-10-25 · 2019-10-25 16:04 UTC
查看更新说明
New specifications:
- PJDL v4.0 includes the response initializer to avoid a set of vulnerabilities in multi-master mode
- PJDLR v3.0 is now able to keep the medium busy in between an exchange and includes the response initializer to avoid a set of vulnerabilities in multi-master mode
Changelog:
- The Dynamic addressing feature has been moved in the OSPREY repository because of development ease
- SoftwareBitBang now implements PJDL v4.0 and it is more secure if used in multi-master mode
- OverSampling now implements PJDLR v3.0, it is more secure and it supports multi-master mode without requiring a common configuration for all devices
- LocalFile strategy uses a file present on the hard drive to let multiple processes communicate on the same machine, can be used for inter-process communication, simulation, test applications and networks on a real time operative system. Developed by @DetAtHome and @fredilarsen
- ThroughLoRa does not support anymore the synchronous acknowledgement and retransmission because of the inherent limitations of LoRa (ALOHA) and its usage policy
- InteractiveRouter synchronous acknowledgement transmission added (https://github.com/gioblu/PJON/issues/292) proposed by @chestwood96
- SoftwareBitBang SAMD21 (Arduino Zero) supported pins added and timing optimized
- Early support for Android added by @gnomathibus
- Added support for STM32-duino installed via boards.json by @chestwood96
- Optional separation of functions declarations for linux interface by @mattze96
- PJON data buffer was of type
charnow changed inuint8_t - PJON send functions
payloadparameter is now of typeconst void * - Strategy
send_stringandreceive_stringmethod names changed tosend_frameandreceive_frame - Security policy added
Bugfix:
- Fixed ESP32 compilation error on Arduino 1.8.6+ by @mxbranson
- Added to
ThroughSerialandThroughSerialAsyncthe full buffer handling (https://github.com/gioblu/PJON/issues/288) by @chestwood96
If you want to know more and support PJON see the PJON protocol handbook and the PJON 12.0 big box.
This version is not backward compatible!
- 11.22019-01-22 · 2019-01-22 04:55 UTC
查看更新说明
New specifications:
- PJON Protocol specification v3.1 simplifies the model, and more clearly specifies the encoding
- PJDL v3.0 more clearly specifies the medium access method and the communication modes
- TSDL v2.1 more clearly describes the medium access method and the limits of multi-master mode
Changelog:
- ThroughSerialAsync strategy developed by @sticilface, it supports non-blocking data reception and has a higher performance than ThroughSerial in most usecases
- ESPNOW strategy developed by @xlfe added enabling communication over the ESPNOW protocol
- DualUDP strategy combining the best of LocalUDP and GlobalUDP by @fredilarsen
- Wiznet W5500 support added (https://github.com/gioblu/PJON/commit/897997737356fab424187bf1d379377974cc4557) by @fredilarsen
- Support to Network Address Translation (NAT) in switch (https://github.com/gioblu/PJON/commit/72a93b02b5f1ea64829d09f97080859c0b04b02d) added by @fredilarsen
- Linux Serial system calls implemented within the interface, wiring-pi discarded, as proposed by @xlfe
OS_PREAMBLE_PULSE_WIDTHadded to OverSampling to enable preamble length configuration (https://github.com/gioblu/PJON/commit/53769a4d3978d1865215f8c715edde4d126e7601)PJON_BROADCAST,PJON_MASTER_IDandPJON_NOT_ASSIGNEDconstants can be predefined and changed if required as requested by Adrian Slawinski- To ease users and developers working upon PJON all internal inclusions have been changed from
include <...>toinclude "..."(https://github.com/gioblu/PJON/commit/6fcfd759c6f376bd1328a681bd644790fea021b2) as requested by @Girgitt - Documentation and specifications have been expanded and corrected
Bugfix:
- Avoid compilation error using Arduino 1.8.6 (https://github.com/gioblu/PJON/issues/245) reported by @Girgitt
- Examples receiver function moved to avoid compilation error (https://github.com/gioblu/PJON/issues/205) reported by @fcastrovilli
- Packet id forwarding in router mode bug fixed (https://github.com/gioblu/PJON/commit/9457bc35a0daa6c2a5691fe007ac30aebb124974) reported by @Halytskyi
- ThroughSerial WIN32 bug fixed (https://github.com/gioblu/PJON/commit/9b5ccdc83358bde72e1a967094885aa87cd9dc74) reported by @Girgitt
- AnalogSampling
can_startbug fixed (https://github.com/gioblu/PJON/issues/240) reported by @andrei-volkau - ThroughSerial and ThroughSerialAsync
can_startbug fixed (https://github.com/gioblu/PJON/commit/1f61a10eac7bba23c3f9a87b6c298428d6a09573) - PJONMaster and PJONSlave compilation error fixed (https://github.com/gioblu/PJON/issues/248) reported by @maniekq
If your setup using W5x00 Ethernet shield and UDP freezes after an undetermined amount of time, it is affected by a bug present in the Ethernet library isolated and fixed by fred here.
Backward compatibility is preserved.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
PJON 13.1
PJON (Padded Jittering Operative Network) is an experimental, multi-master, software-defined network protocol that can be easily cross-compiled for many microcontrollers and real-time operating systems such as ATtiny, ATmega, SAMD, ESP8266, ESP32, STM32, Teensy, Raspberry Pi, Zephyr, Linux, Windows x86, Apple, and Android. PJON operates over a wide range of media, data links, and existing protocols like PJDL, PJDLR, PJDLS, Serial, RS485, USB, ASK/FSK, LoRa, UDP, TCP, MQTT, and ESPNOW. For more information, visit the documentation, the specification, or the wiki.
Why PJON?
- New technology: PJON is an experimental network protocol stack crafted through 10 years of research and experimentation. It was originally developed as an open-source alternative to i2c and 1-Wire, but during development, its scope and features were extended to cover use cases where IP is generally applied. PJON has been engineered to have a variable footprint (4.2–8.2 kB program memory) and overhead (5–35 bytes per packet) depending on its configuration.
- Multi-media support: PJON operates over a wide range of protocols including TCP, UDP, MQTT, ESPNOW, USB, Serial, RS485, and LoRa. The PJON network protocol stack also specifies and implements PJDL that operates over a single wire of up to 2000m shared by up to 255 devices, PJDLR that operates with many ASK/FSK/OOK radio modules and PJDLS that operates wirelessly with light pulses using off-the-shelf LEDs and laser diodes.
- Increased reliability: Many widely applied protocols expose significant vulnerabilities, have weak error detection algorithms, and are not resilient to interference. PJON is based on years of analysis and study to avoid the mistakes present in most alternatives and provide with a simpler and more efficient solution.
- High flexibility: PJON is fully software-defined and designed to be easily extensible. It builds out-of-the-box on all supported devices and operates transparently on top of any supported protocol or medium.
- Low cost: With no additional hardware needed to operate, minimal network wiring requirements, and direct pin-to-pin or LED-to-LED communication, PJON is extremely energy-efficient, inexpensive to implement, and maintain. This experimental reference implementation is kept up to date thanks to the strong commitment of its growing community.
Features
- Cross-compilation support with the interfaces system calls abstraction.
- Multi-media support with the strategies data link layer abstraction.
- Modular packet format that includes only the fields used (overhead 5–35 bytes).
- Hot-swap support, no need for a system reset or shutdown when replacing or adding devices.
- Flexible local (device ID) and shared (bus ID) network identification.
- Safe error detection using modern CRC8 and CRC32 polynomials.
- Optional inclusion of MAC addresses.
- Optional acknowledgement.
- Error handling.
Academic studies
Researchers are active in many universities worldwide using PJON in different environments. The following list contains known published academic studies about PJON:
- Definition and Application of PJON-PLC for sensor networks by Jorge Gómez Segurola, Ingeniería de Tecnologías de Telecomunicación - Universidad de Cantabria (ES).
- Biomimetic electronics by Charlie Williams with scientific input from researchers Vítor Martins dos Santos, Diana Machado de Sousa, and Sabine Vreeburg - Artist in Residency at Wageningen University (NL).
- LANC Video Camera Control by Jack Anderson - Department of Computer Science Loughborough University (UK).
- Implementation of a PJON hardware peripheral for the Croc SoC by Pius Sieber - ETH Zurich (CH)
Contribute
Feel free to send a pull request sharing something you have made that could help, if you want to support this project you can also try to solve an issue. Thanks to support, expertise, kindness and talent of the following contributors, the protocol's documentation, specification and implementation have been strongly tested, enhanced and verified:
Fred Larsen, Zbigniew Zasieczny, Matheus Garbelini, sticilface, Felix Barbalet, Oleh Halitskiy, fotosettore, fabpolli, Adrian Sławiński, Osman Selçuk Aktepe, Jorgen-VikingGod, drtrigon, Endre Karlson, Wilfried Klaas, budaics, ibantxo, gonnavis, maxidroms83, Evgeny Dontsov, zcattacz, Valerii Koval, Ivan Kravets, Esben Soeltoft, Alex Grishin, Andrew Grande, Michael Teeww, Paolo Paolucci, per1234, Santiago Castro, pacproduct, elusive-code, Emanuele Iannone, Christian Pointner, Fabian Gärtner, Mauro Mombelli, Remo Kallio, hyndruide, sigmaeo, filogranaf, Maximiliano Duarte, Viktor Szépe, Shachar Limor, Pantovich, Mauro Zancarlin, Franketto, jzobac, DanRoad, fcastrovilli, Andrei Volkau, maniekq, DetAtHome, Michael Branson, chestwood96, Mattze96, Steven Bense, Jack Anderson, callalilychen, Julio Aguirre, Cimex97, der-schne, porkyneal, der-schne, Rainer Schoenberger, jgOhYeah and kuchendieb.
Compliant tools
- ModuleInterface - easy config and value sync between IoT modules by Fred Larsen
- PJON-cython - cython PJON wrapper by xlfe github user
- PJON-piper - command line wrapper by Zbigniew Zasieczny
- PJON-python - python interface by Zbigniew Zasieczny
- PJON-gRPC - gRPC server-client by Oleh Halytskyi
- PjonHL - PjonHL is a highlevel wrapper around PJON
License
All the software included in this project is experimental and it is distributed "AS IS" without any warranty, use it at your own risk. Licensed under the Apache License, Version 2.0.
Safety warning
When testing PJON, take extreme care to avoid any danger. The implementation is experimental and may not behave as expected; use it at your own risk. If devices are connected to AC power, you face a high risk of electrocution unless the hardware is installed carefully and correctly. If you lack sufficient experience, seek assistance from a qualified technician, and be aware that many countries prohibit uncertified installations. When testing a SoftwareBitBang bus follow interference-mitigation and protective-circuitry guidelines. When experimenting with an AnalogSampling setup, wear safety glasses and operate transceivers cautiously to prevent eye injuries. Before testing OverSampling, ThroughSerial or ThroughLoRa radio communication, ensure that the frequency, power, and hardware comply with local regulations. When connecting a local bus to the Internet, treat all devices as potentially compromised, manipulated, or remotely actuated against your will. As a best practice, avoid connecting to the internet systems that could cause damage (fire, flood, data leakage) if hacked.