Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Transport based on single wire PJON protocol
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

Transport based on single wire PJON protocol

Scheduled Pinned Locked Moved Development
19 Posts 5 Posters 5.8k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 4ib3r4 Offline
    4ib3r4 Offline
    4ib3r
    wrote on last edited by
    #10

    Sory, I forgot commit MySensors.h file, with definitions.
    Definition "MY_PJON" sets transport to PJON.

    /* Simple serial gateway with PJON transport and error handling */
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    #define MY_PJON //select PJON transport
    #define PJON_PIN 12 //optional to change pin (12 is default)
    
    #define MY_GATEWAY_SERIAL
    
    #include <MySensor.h>  
    void before() {
     //bus object is not initialized in this method
    }
    
    void setup() {
      bus.set_error(error_handler); //direct bus object access
    }
    
    void presentation() {
    }
    
    void loop() { 
    }
    
    void error_handler(uint8_t code, uint8_t data) {
      if(code == CONNECTION_LOST) {
        Serial.print("Connection with device ID ");
        Serial.print(data);
        Serial.println(" is lost.");
      }
      if(code == PACKETS_BUFFER_FULL) {
        Serial.print("Packet buffer is full, has now a length of ");
        Serial.println(data, DEC);
        Serial.println("Possible wrong bus configuration!");
        Serial.println("higher MAX_PACKETS in PJON.h if necessary.");
      }
      if(code == MEMORY_FULL) {
        Serial.println("Packet memory allocation failed. Memory is full.");
      }
      if(code == CONTENT_TOO_LONG) {
        Serial.print("Content is too long, length: ");
        Serial.println(data);
      }
      if(code == ID_ACQUISITION_FAIL) {
        Serial.print("Can't acquire a free id ");
        Serial.println(data);
      }
    }
    

    I created a pull request to PJON with change that allows define the broadcast address because in MySensors is 0xff.

    1 Reply Last reply
    1
    • Giovanni Blu MitoloG Offline
      Giovanni Blu MitoloG Offline
      Giovanni Blu Mitolo
      wrote on last edited by
      #11

      Ciao @4ib3r , thank you for your support to the PJON project. I accepted your pull request. What you proposed highers portability and reduces compatibility issues like this one in particular with MySensors. I will soon use your attached example to make a brief wiki page where to explain how to use PJON with MySensors.

      1 Reply Last reply
      1
      • Giovanni Blu MitoloG Offline
        Giovanni Blu MitoloG Offline
        Giovanni Blu Mitolo
        wrote on last edited by
        #12

        I should now point to your personal fork here https://github.com/4ib3r/Arduino and keep an eye on MySensors releases and change the link to MySensors master as soon as your proposal will be accepted, right?

        1 Reply Last reply
        0
        • 4ib3r4 Offline
          4ib3r4 Offline
          4ib3r
          wrote on last edited by
          #13

          I created pull request to main repository 6 days ago but as for now still hangs.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gryzli133
            wrote on last edited by
            #14

            WOW, just find that PJON protocol, quite good stuff! Working more reliable than RS485 on my work table :)

            I'm creating smart home solution that will work 100% on cable. Because there are some known issues with RS485, PJON would be the great alternative for my project. Is there an official support for MySensors already?

            1 Reply Last reply
            1
            • Giovanni Blu MitoloG Offline
              Giovanni Blu MitoloG Offline
              Giovanni Blu Mitolo
              wrote on last edited by Giovanni Blu Mitolo
              #15

              Ciao gryzli133! I am happy to hear that.
              Are you testing SoftwareBitBang (PJDL v2.0) data-link?

              The system works also if using the human body as a common conductor, so yes, quite rugged I agree. There are a lot of setups around the world running PJDL, many of them have matured already years of operation. I have personally built a bus of more than 40 meters of wires in star topology, made by cat 5 ethernet (gnd, vin, PJDL bus, the rest is unused) positioned in the same channels where AC wiring is positioned.

              With AC wiring or appliancies in the vicinity, without any pull-down resistor, the induced 50Hz waveform may be present in the bus stealing half of the bandwidth (the PJDL protocol is perfectly able to avoid the wave crests and operate nominally in this scenario) obviously placing pull down resistors that can be erased obtaining the best performance.

              4ib3r worked out the support long ago and made a pull request, I am not sure what happened then and if that was accepted. Many things are changed since then in PJON so that work may be outdated, although it should be fairly simple to fix. I am obviously always available for support if required.

              1 Reply Last reply
              1
              • K Offline
                K Offline
                kimot
                wrote on last edited by
                #16

                https://github.com/4ib3r/MyTransportPJON

                But it is 2 years old.

                1 Reply Last reply
                0
                • Giovanni Blu MitoloG Offline
                  Giovanni Blu MitoloG Offline
                  Giovanni Blu Mitolo
                  wrote on last edited by Giovanni Blu Mitolo
                  #17

                  Ciao kimot, yes the class that adds to Mysensors the support to PJON was made by 4ib3r 2 years ago, looking at the source, it is 101 lines of commented code.
                  It seems fairly simple to wire up PJON functions with Mysensor's.
                  If you need some help I am here although I am not able to physically setup a testbed running Mysensors for now.

                  G 1 Reply Last reply
                  0
                  • Giovanni Blu MitoloG Giovanni Blu Mitolo

                    Ciao kimot, yes the class that adds to Mysensors the support to PJON was made by 4ib3r 2 years ago, looking at the source, it is 101 lines of commented code.
                    It seems fairly simple to wire up PJON functions with Mysensor's.
                    If you need some help I am here although I am not able to physically setup a testbed running Mysensors for now.

                    G Offline
                    G Offline
                    gryzli133
                    wrote on last edited by
                    #18

                    @giovanni-blu-mitolo would it be possible for you to refresh the PJON transport layer? Maybe even try with new pull request for PJON transport? I think I'm out of skills to do it by myself. The phissically setup is quite easy, you need one Arduino board as Serial Gateway and one as node. The communication is then running over PJON between arduinos. From Gateway you can see over Serial Monitor if the communication is running well.

                    I'm trying to build a floor heating controller for all my house. The idea is to have an Arduino (probably ESP8266 with switched off WiFi) with OLED display (SH1106 using u8g2 lib) and BME280 sensor (Temp+Baro+Hum) in each room. All these should communicate with Arduino Mega as Serial Gateway and main controller for the Valves. For now the only problem is the communication between Arduino Mega and multiple ESP8266 over PJON. It would be even enough to get it work outside MySensors, but I get some trouble. For test I have programm the ESP8266 room thermostat that is communicating with other ESP8266 over PJON. But sometimes I cannot get any data over PJON. Have no idea where is the problem, sometimes it is working, sometimes not... Do you think, that the problem could be SW i2c for the OLED diplay?

                    1 Reply Last reply
                    1
                    • G Offline
                      G Offline
                      gryzli133
                      wrote on last edited by
                      #19

                      Hi Giovanni, did I understood good, that PJON will be included in next release of MySensors? :)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      14

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.0k

                      Posts


                      Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular