

Show HN: PJON – Communications bus system for Arduino - gioscarab
https://github.com/gioblu/PJON/blob/master/PJON.cpp

======
gioscarab
Hi there I wrote in years of trial and error PJON library for my home home
automation project. It is a multi-master, single wire, addressed and checked
communication protocol and is designed to be an alternative to i2c, 1Wire,
Serial and the other Arduino compatible protocols with the addition of all the
functionalities you need to fastly bring working a multipurpose embedded
devices network. It was a really enourmous physical and mental effort of years
to bring together all the knowledge and code skills to let all this work, so I
hope could be useful for all Arduino users. Please feel free to suggest and
crytic if necessary and if you can TEST IT would be an enormous pleasure!!!

Have a nice summer! :)

~~~
raphman_
Thank you, this may be exactly what I need for a project!

~~~
gioscarab
Its a pleasure!!! Please try it and write me an email if you have some problem
gioscarab@gmail.com

~~~
raphman_
If I understand correctly, PJON is not directly a replacement for the 1-wire
bus as it does not specify pull-up/-down hardware that would be necessary for
using VCC as the physical communication medium, right?

(Which means that I would need to define/implement this part myself.)

~~~
gioscarab
Hi raphman_2 yes there is not the functionality of 1wire you are speaking
about! I never had time to dig further and work on this functionality. In any
case would be amazing to add it in PJON. But should be taken into account the
duration of 0s and probably a capacitor to rectify input voltage. I generally
use a single pulldown resistor on the bus to reduce interference.

------
creshal
RC4? Please don't. Use e.g. NORX for an embedded-friendly cipher that isn't
dangerously insecure.

~~~
gioscarab
Hi creshal, I started from the RC4 implementation but remains not much of it
and also i further fuzz information using a initialization vector after RC4
like procedure.

You think is so holed? Considering what u can do with an ATmega 328. (Most you
can do with this computation power can be in any case holed fastly with a
laptop)

------
liotier
> _One of the first tests I suggest to try with PJON is to let two arduinos
> communicate through your body touching with the left hand the port of the
> first and with the right the port of the other arduino. It 's stunning to
> see more then 90% of accuracy for this digital communication doing all that
> path inside a biological body. This opens the mind to possible creative
> solutions; generally the average reaction is like: "lets use the car frame
> to let all the digital embedded systems to communicate together" and so
> on..._

Hmmm... I guess I'm not the first to think that my home plumbing would be the
perfect transmission medium to gather data from temperature sensors.

~~~
gioscarab
It's absurd to see the level of advance in technology we can use and work with
and the level of advance of our houses and transportation systems.

------
gioscarab
Thank you for your suggestion. Take a look if you can to the crypt() function,
I use on top of a modified version of RC4 the use of 1 byte initialization
vector to further fuzz information (the iv is trasmitted with the string).

I am not so much into cryptoanalysis so, I really should have some suggestion
in this case.

------
earlz
This is really awesome. I tried to make something like this once since I
needed multi-master with like 50-60 attiny chips with poor time consistency
etc, but never really got anywhere... This looks like exactly what I would
have liked

~~~
gioscarab
Thank you earlz. Try it if you can and contribute if you want to expand the
features contained in PJON. I am really happy to have this type of feedback
from the hacker community :) thank u guys/girls really!

------
swah
I know its not very important for automation, but what are the defining factor
to arrive at that bandwidth?

(If I were you, I wouldn't even maintain the two modes - the bandwidth
difference is not that big)

~~~
gioscarab
Hi! I have a test sketch, it runs for 10 seconds and a transmitter send a
string made by ID + LENGTH + 10byte string + CRC + ACKNOWLEDGE. The
transmitter counts every correct and mistaken reception by the receiver:

What I mean with practical bandwidth is the byte sum of all the correct
packets received that are useful (so the ID, LENGTH and ACKNOWLEDGE are not
counted) / 10 (seconds of test) and so you get how many correct and useful
bytes/s you can send in the fastest setup (for or while). The absolute
banwidth is the total byte count wihtout no exception.

You are right the difference is not enormous. fast_mode is quite near to the
limits of delayMicroseconds(), micros(), function execution time. I left a
standard_mode with a really solid behaviour to let people use PJON also with
boards without an external oscillator (like using internal PPL clock to 16mhz
on ATtiny) or equipped with ceramic resonator that is less precise in timing.

