How we made PJON from scratch

PJON (Padded Jittering Operative Network) is a lightweight, efficient and completely open network protocol. It has revolutionary features such as single wire communication with a range of up to 2 kms, wireless LED-to-LED communication and long range laser communication.

2009 - Communication

Far back in 2009, while following Digital Communication, Advertising and Art Direction at NABA (New Academy of Fine Arts of Milan), I became interested in Professor Massimo Banzi's classes and managed to get an Arduino Diecimila. In just one day my vision of the world had changed and I slowly started to better understand computers and electronics while sharing results with the Arduino community both on my website and on Arduino's forum. I started to build robots and after few years of experiments I launched my first start­up: a webshop of arduino-compatible, CNC machined robot kits, boards and sensors.

2010 - Let's transmit data

At the time in my projects I had to connect many microcontrollers on a common bus and I found myself not satisfied by the solutions available, for this reason I started to develop my own data link. I perfectly remember that night back in 2010 when I started bit-banging bits using an Arduino and trying to sample them with another. The first problem I hit were bugs in the implementation that were quickly resolved. Then I unsterstood I did not have any synchronization, depending on when the receiver was powered on bits were shifted. That night, with no experience in electronics or engineering I instinctively defined the synchronization pulse that is still present as the core of PJDL (Padded Jittering Data Link) v5.0. To make sure to synchronize with the start of each byte I have added a 1 longer than data bits followed by a 0 and instructed the receiver to find it and only then start sampling 8 bits. Data was coming in perfectly. That was PJDL (Padded jittering data link) v0.1 which was basic and working by mere chance. Then, after debugging it further, experiments proved it was working well not only through wires and the human body, but also wirelessly through radio and infrared light, yet it showed to be robust operating bidirectionally in spite of interference. After I noticed that it was possible to connect more than 2 devices to the same wire, I started to experiment with an initial collision avoidance phase, an 8 bits device id and a synchronous acknowledgement at the end of the packet. It was shocking to see that many devices were able to send and receive data through the same wire. Soon after I released PJON v0.1 on the Arduino forum, receiving plenty of "don't ­reinvent ­the ­wheel" and few active contributors.

PJON protocol usecase example Micheal Teeuw testing the PJON library and sharing results on his blog
PJON over PJDL bus made by 15 arduinos Mauro Zancarlin and I testing PJDL bus with 15 arduinos

2014 - Let's network

In those days I became aware of how quickly the cloud was eating the world and how difficult was to connect stuff directly without relying on a third-party. It seemed like noone could connect computers together anymore without an ever present observing big brother. To be honest, I did not like it: that was the point when I understood how PJON could have changed the game and what I personally could have done to influence the outcome. I decided to double my efforts on the protocol and try my best to provide humanity with a free and more efficient way to make networks. With a working protocol layer and support from the community, I went further in the address space development adding an optional 32 bits bus id used to identify a group of up to 255 devices, supporting up to 4.294.967.295 buses and a total of 1.090.921.692.930 devices. This addition released in PJON v0.2 enabled coexistence and networking for groups of devices. Thanks to Micheal Teeuw's post on his blog, PJON received contributions, testing, debugging and feature requests. Then many talented contributors added support for devices like ESP8266, Teensy 3.2 and Node MCU.

2015 - Abstracting the data link

The community wanted to use PJON over different existing protocols and physical layers, to obtain that without making the implementation complex and more difficult to use I have defined the strategy abstraction. The curiously recurring template pattern or CRTP was adopted to abstract the physical layer in separate classes called strategies. Thanks to this change from then it was possible to instantiate a PJON object passing the selected data link. Initially, I developed three strategies, a bit-banged implementation of PJDL called SoftwareBitBang, OverSampling for radio communication and AnalogSampling able to communicate wirelessly or with optical fiber using off-the-shelf LEDs. Later on, I developed together with Fred Larsen ThroughSerial able to operate through a serial port.

PJON over PJDL operating using the human body as a conductor PJON over PJDL communication using the human body as a conductor
PJON wireless LED-to-LED communication PJON over PJDLS LED-to-LED wireless bidirectional communication

2016 - It's mainstream

Hackaday and the Atmel blog wrote about the PJON protocol and from that day an ongoing earthquake began. The initial response, especially in the Hackaday's comments, was quite negative - trolls were raging. Only when I joined the discussion and answered openly and sincerely to all the complaints and questions asked, the tone changed dramatically. Well, so dramatically, that in the next comments I got the most praiseworthy compliments I have ever received, those people for sure helped me not to desist. Since then, the PJON protocol specification has been used in academic researches and PhDs in different parts of the world, and the official PJON implementation has already been applied globally in a wide range of different systems.

2016 - Let's add a header

The release of the PJON v0.3 was the result of the most interesting proposal I have received so far, by Fred Larsen, who is a great friend already even if we never met personally. He proposed the addition of a 8 bits header containing a map of the fields contained in the packet and the configuration requested by the sender. At this point we left a fixed configuration scenario, where interoperability was impossible, heading towards a dynamic network architecture. An entire new set of possibilities opened up and users started to make use of this new field.

Hackaday PJON blogpost with raging trolls Hackaday in 2016 reviewed PJON and provoked a hell of trolls in the comments
Atmel blog reviews PJON in 2016 Atmel in 2016 reviewed PJON on its official blog

2016 - PJON over the internet

EthernetTCP and LocalUDP made by Fred Larsen enabled multiple devices with Ethernet ports use PJON to communicate with each other on a LAN, WAN or across the Internet. It became possible to create a PJON network of devices using also an Internet connection. Our constantly growing community has already provided PJON implementations in other programming languages like PJON-python by Zbigniew Zasieczny and PJON-c by Matheus Garbelini. Thanks to their work, it was for the first time possible to run PJON on a wider range of devices. At the same time the protocol reached its first stable version with the release of the PJON v1.0 which added a lot of new features.

2017 - Let's make it universal

New features brought new objectives: the community wanted to have PJON working on many different MCUs and real time operative systems although I wanted to avoid code duplication and maintain only one unified implementation. For this reason I defined the interface abstraction. With interfaces it was for the first time possible to run and cross-compile the same implementation on all supported targets. I developed the RPI interface to support Raspberry Pi, after few weeks Zbigniew Zasieczny developed the WINX86 interface enabling PJON communication on Windows computers, and soon after, Fred Larsen developed the LINUX interface. In late 2017 I discovered that frame inizialization was missing from both the specification and the implementation and that arbitrary data could have been mistaken for a valid frame. I vividly remember how shocked I was, that was a serious hole, so I quickly found a way to safely identify frames in each strategy. After that was fixed and all seemed perfect I discovered the length corruption vulnerability that affected PJON and still affects CAN (Controlled Area Network). To close that hole I added an additional CRC8 to protect the header and soon after I released PJON v2.0.

PJON ThroughLoRa wireless bus PJON over ThroughLoRa bus made by Micheal Branson
PJON LocalFile bus operating within system memory PJON over LocalFile runnning within a real-time operating system memory

2018 - Distributed field test

Although PJON is licensed "AS IS", the more it was applied in the real world, the more I was feeling the responsibility for possible failures. When in 2018 Fred Larsen used PJON and ModuleInterface to handle the life support systems of his hens' house in Norway I started to be preoccupied for those animals and be finally aware of the potential consequencies and the risks involved in PJON real world applications, specially if dealing with living beings. If for whatever reason the temperature value transmitted was corrupted by interference or because of a bug, the hens could have ended up frozen or roasted. The conception of this possibility pushed me to study deeper the implementation and make better software.

2019 - PJON in the top ten

After the release of PJON 12.0, in November 2019, unexpectedly, we experienced a 25% growth of the community in few days. The right HN post and few reddit discussions generated thousands of visits and in a couple of days pushed PJON in the Arduino Library List Top Ten. Thanks to the huge spike of traffic we received a lot of feedback and requests. PJON 12.0 fixed vulnerabilities detected in the earlier iteration and added a lot of new features like the LocalFile strategy that uses a file present on the hard drive to let multiple processes communicate on the same machine. With PJON 12.0 we also released the first physical edition of PJON in a fancy old-style big box format.

PJON big box The first big box physical edition of PJON
PJON stargazers growth The growth of PJON stargazers (blue) compared with Mysensors (yellow) and RFID (red) libraries

2020 - PJON and academics

Jack Anderson when working on a research for a better video camera control at the Department of Computer Science of the Loughborough University discovered PJDL which maximum range at the time was still unkown and it was experimentally tested up to 100 meters. Jack needed at least 1km of range for his use case, so he started patching existing wiring within the university's network to obtain a real-world test bed for PJDL and his application. Incredibly his experiments showed that Arduino boards could communicate flawlessly over a 2km long twisted pair using PJON over PJDL. Jack was able to successfully complete his research and publish his outstanding academic study LANC Video Camera Control. It was really a nice experience when Fred and I teamed up to support Jack directly and were present virtually when PJDL was being tested. The result of Jack's work was critically important to define the operational envelope of PJDL and it was a great pleasure to know its performance proved to be well above any possible expectation.

2020 - Let's do peer-to-peer

One of the users' requests was to avoid manual configuration of bus and device id for each device, at the same time Fred Larsen was working on the MQTTTranslate strategy which required the MAC address to work properly in some of its modes. Users were also asking for an easier way to implement peer-to-peer or mesh networking over PJON. Thanks to this really important feedback and support from the community I decided to add the optional MAC address and hop count fields. To make space to them I removed the asynchronous acknowledgment feature that was largely ignored by the community and at the same time performed poorly in most cases. With PJON v4.0 it is now possible to quickly create a mesh or a peer-to-peer network of devices with no manual configuration required.

PJDL frame mode 4 800m twisted pair A PJDL frame transmitted at the fastest mode successfully crossing a 800m twisted pair
PJDL frame mode 4 800m twisted pair Although bits are substantially deformed the frame is transmitted successufully

2020 - A better API

In late 2020 I released PJON 13.0 which was much more polished, mature and reliable than any earlier version. We simplified the library's API as well as how the data link is included reducing substantially the footprint of programs that use PJON. Thanks to the help of Cimex97 we added the support for Zephyr and thanks to the work of Julio Aguirre we included a more mature support for the STM32F103 MCU. Zbigniew Zasieczny and callalilychen also enhanced the linux interface. Although we were all hit by the pandemic in a way or another we teamed up and worked together on PJON as never before.

2020 - PJON Hardware

After I was contacted by the Universitat Politècnica de València (UPV) to support the development of a PJON network of temperature and humidity sensors to monitor the vault of the Cathedral of Valencia, I thought the protocol was mature enough to let users evaluate its performance. In december 2020 I released the first line of PJON-compatible hardware kits. Thanks to the help and the experience of Giuseppe De Lorenzo, we were able to quickly prototype and assemble a small batch for the community. We engineered 8 modules based on ATtiny85 that implement PJON over PJDL networking along with the application. Multiple modules can be connected in parallel on the same bus sharing the same power, ground and data connection. Each module runs an instance of the PJON protocol stack with its own configurable device id, so many can coexist on the same medium.

PJDL frame mode 4 800m twisted pair PJON hardware while being assembled in Italy
PJDL frame mode 4 800m twisted pair The first PJON hardware products taking shape

Embedded systems connected

PJON® (Padded Jittering Operative Network) is an open-source network protocol able to connect devices using most physical layers and media, such as wires (PJDL, Ethernet, Serial and RS485), radio (ASK, FSK, OOK, LoRa or WiFi) and light pulses (PJDLS). It is released in a single portable implementation that can be easily cross-compiled on many systems like ATtiny, ATmega, ESP8266, Teensy, Raspberry Pi, Windows X86, Apple and Android. It is a valid tool to quickly build a network of devices.


The PJON software big box

The PJON 13.0 big box is a limited edition. It contains the PJON protocol handbook, the PJON protocol source code in CD and the stickers. This product contains everything you need to master the PJON protocol and its implementation, although it is also designed to nicely fit in your big box collection. Choosing this handy kit, you will always have PJON with you in different formats, also when not being connected to Internet. Buying PJON products you support its further development and enhancement.