
PJON 12.0 – Networking freedom for hackers, makers and experimenters - gioscarab
https://github.com/gioblu/PJON
======
gorgoiler
PJON (pronounced _pigeon_ as I have just learned) looks exciting but it seems
like it’s trying to provide globally addressable devices, as well as local
ones?

In the case of global addressing, don’t we already have an open and free
protocol in the form of IPv6? Some quick googling found LWIP which provides an
IPv6 stack in “tens of kB” which seems comparable to PJON’s “4kB to 8kB” but
maybe that size difference really is important?

LWIP project:
[https://savannah.nongnu.org/projects/lwip/](https://savannah.nongnu.org/projects/lwip/)

~~~
gioscarab
Ciao gorgoiler, take a look to PJON's address space:
[https://github.com/gioblu/PJON/blob/master/specification/PJO...](https://github.com/gioblu/PJON/blob/master/specification/PJON-
protocol-specification-v3.1.md#pjon-v31)

"The PJON protocol v3.1 in local mode supports connectivity for up to 254
devices, in shared mode supports connectivity for up to 4.294.967.295 buses
(groups of devices) and up to 1.090.921.692.930 devices."

That means 32 bits for the bus id, and 8 bits for the device id.

Another interesting side-effect of the address-space scheme and the dynamic
meta-data inclusion in the packet is the overhead:

"It supports interoperability between systems that use a different
configuration and provides with high efficiency including only the protocol's
features used and the overhead effectively required (5-22 bytes)"

In terms of minimum requirements PJON is uncomparable to IPv4 or IPV6 needing
only in the most limited configuration: 1 IO pin, 16MHz clock frequency, 4144
bytes of program memory and 46 bytes of RAM

~~~
gorgoiler
Thanks for the information, and this release! The minimal memory requirements
are impressive.

With 32 bits of global addressing space, is that for routing, or more to avoid
address collisions when two networks are joined in an ad-how way?

I noticed the PJON bus-ID assignment process and it seems a bit like MAC
vendor ID assignment, so I’m guessing the latter?

I don’t have much experience in this space, but it feels like it would be
useful if the bus-addressing could be optionally extended to incorporate IP
addressing and routing infrastructure. Perhaps IP to PJON bridging is already
very easy?

~~~
filar
Although not using PJON addresses as IP addresses, PJON has a few strategies
that allow a PJON bus to span a Ethernet+WiFi LAN and/or WAN. I use this in my
PJON-based home automation system using clusters of SoftwareBitBang based
devices (a bus on a single wire plus ground), linking these clusters together
and with the master with routers using the DualUDP strategy over my LAN. PJON
is great for cases like this.

It could easily cross the Internet as well but in that case I would recommend
using site-to-site VPN commections for security as the PJON traffic is not
encrypted (encryption is a little too heavy when running on limited devices
like Arduino).

I have shared my PJON-based automation library here for those interested:
[https://github.com/fredilarsen/ModuleInterface](https://github.com/fredilarsen/ModuleInterface)

------
mxuribe
I'm encouraged by more and more of this type of work! Cheers to all involved!

------
charlesdaniels
I would be curious to see to what extent it supports error recovery. Perhaps I
missed it, but I didn't see anything that specifically addressed that.

This seems like it would be very compelling, especially for small scale stuff.
Being able to wire something as small as an ATiny85 into a computer and
communicate over a relatively high-level protocol would be very useful for
interfacing with sensors and other peripherals.

I wonder how difficult it would be to adapt something like USBtiny[0] build an
adapter. For potentially a few $ worth of parts, you could connect to all
kinds of nifty embedded peripherals, albeit at relatively slow speeds. One
obvious use case that comes to mind would be controlling lights / sensors /
fans etc. in custom computer builds.

0 -
[https://dicks.home.xs4all.nl/avr/usbtiny/](https://dicks.home.xs4all.nl/avr/usbtiny/)

~~~
Animats
There's an optional 8-bit CRC and sequence number, with a single bit ACK.[1]
This is even weaker than ARCnet, circa 1977, one of the earliest protocols for
talking to low-end devices.

This is for talking to things like lightbulbs with some US$0.50 CPU inside.
It's for really low end devices. It's best for idempotent operations that can
be requested repeatedly without harm and are timeout-tolerant.

[1]
[https://github.com/gioblu/PJON/blob/master/specification/PJO...](https://github.com/gioblu/PJON/blob/master/specification/PJON-
protocol-acknowledge-specification-v1.0.md)

~~~
filar
Small correction: Using CRC is not optional. Setting the crc flag makes it use
CRC32 even for very small packets. The default is to use CRC8 for packets of a
few bytes and then upgrade to CRC32 over a small size threshold. This is to
minimize the size of otherwise tiny packets.

Also, the ACK implementation depends on the strategy (physical media type),
and it is not a single bit but a single byte, and it seems to me to be robust.
I am sure the creator, gioblu, has some more comments about this.

------
gioscarab
More info here: www.pjon.org

~~~
booli
Great work on PJON! Where can I find documentation/more info on how to build
this for STM32 microcontrollers, like the STM32F091CCU7 using SerialAsync
(over PLC)?

~~~
jsilence
Would also be interested in PJON for stm32 based systems.

~~~
gioscarab
Although stm32 is not the widest support, some strategies work with it, see
the compatibility table here:
[https://github.com/gioblu/PJON/wiki](https://github.com/gioblu/PJON/wiki)

------
mahesh_rm
Happy to see somebody from my city dedicated to such an ambitious project. I
wish you all the best Giovanni! I see you are based in Via Larga, do you guys
have an office there?

~~~
gioscarab
Ciao mahesh, I do not know many people who is interested in computer science
or networking here in Milan. Would be a pleasure to have a chat :)

~~~
mahesh_rm
Email inviata!

------
thebruce87m
I work in embedded and I’m still not 100% clear on what this does after
reading the README.md. I find that for a lot of projects actually. Is this an
MQTT alternative? I find use-cases or working examples to be key, even better
if they compare with pros/cons to alternatives.

------
hcarvalhoalves
Cool! I see the documentation mentions:

> ... during development its scope and features have been extended to cover
> use cases where IP is generally applied

I understand the point is having minimal requirements, but how do you
interoperate w/ IP?

~~~
filar
PJON is based on a concept of selectable "strategies" to support using the
protocol with different physical media. Some of these, like the one named
SoftwareBitBang which allows a bus on a wire connected directly to an I/O pin,
are very compact.

There are also strategies for TCP and UDP based communication, essentially
using the same packet structure but sending them as TCP or UDP over a LAN or
WAN. These strategies need the Ethernet library, and use more memory.

Still, the memory requirement is small enough to run a router with two PJON
objects with the strategies SoftwareBitBang and DualUDP on an Arduino Nano
with a W5500 Ethernet shield. This allows easy traversal between different
physical media, and IP-based communication, also with PJON-based software
running on a Windows or Linux computer.

------
NKosmatos
Nice one, never heard of pigeon (PJON) before but it has potential. I
understand that it’s mainly for low end devices, but I’d like to see it
combined with [https://balena.io](https://balena.io)

------
ngcc_hk
Very hard to read in mobile github read me text. Is this require special
hardware? Or usable even if you just have a python interpreter say. Or is it a
replacement of ip stack. Wonder.

