Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Edoardo Macrì
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Edoardo Macrì

    @Edoardo Macrì

    0
    Reputation
    6
    Posts
    463
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Edoardo Macrì Follow

    Best posts made by Edoardo Macrì

    This user hasn't posted anything yet.

    Latest posts made by Edoardo Macrì

    • Heatpump + remote controller

      Hello,
      happy xmas to all,
      I'm Edoardo and I'm playing with MySensors a lot since the last year.
      Today I decided to make a sensor that can turn on and off a heatpump from a relay (not implemented yet) with a remote controller with an 0.96" OLED I2C Display.
      Since I was making the code to work without mysensors the display work showing the temperature (obtained by a bme280), controls and display work flawlessly, but when I implemented the MySensrors part the display was stuck and didn't show up the loading splash screen.
      At the second attempt the Nano was rebooting itself (only on MySensors code).
      Can anyone explain me what I'm doing wrong?

      here are my sketches:

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_RF24
      //#define MY_RADIO_NRF5_ESB
      //#define MY_RADIO_RFM69
      //#define MY_RADIO_RFM95
      
      // Defining BME280 sensor
      #include <Adafruit_Sensor.h>
      #include <Adafruit_BME280.h>
      
      #include <SPI.h>
      #include <Wire.h>
      #include <Adafruit_GFX.h>
      #include <Adafruit_SSD1306.h>
      //#include <MySensors.h>
      
      #define SCREEN_WIDTH 128 // OLED display width, in pixels
      #define SCREEN_HEIGHT 64 // OLED display height, in pixels
      
      // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
      #define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
      Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
      
      #define SEALEVELPRESSURE_HPA (1013.25)
      
      Adafruit_BME280 bme; // I2C
      #define BME280 0x76
      
      float setTemp;
      float temperature;
      float humidity;
      float pressure;
      bool stat = 0;
      long onPushMillis;
      bool firstPush = true;
      bool push = false;
      
      // constants won't change. They're used here to set pin numbers:
      const int pPin = 5;    // the number of the pushbutton pin
      const int mPin = 4;      // the number of the LED pin
      const int relay = 6;    //relay of the Heatpump activator
      
      void setup() {
        // Pin for push button
        pinMode(pPin, INPUT);
        pinMode(mPin, INPUT);
      
        // Show initial display buffer contents on the screen --
        // the library initializes this with an Adafruit splash screen.
        display.display();
        setTemp = (int)bme.readTemperature();
        delay(500);
       }
      
      //void presentation()
      //{
      //  // Send the sketch version information to the gateway and Controller
      //  sendSketchInfo("Heatpump controller", "1.0");
      //  present(0, S_HVAC);
      //}
      
      void loop() {
        temperature = float( bme.readTemperature() );
        humidity    = float( bme.readHumidity() );
        pressure    = float( bme.readPressure() ) / 100.0;
        stat = 0;
      
        if(digitalRead(mPin)){
          onPushMillis = millis();
          push = true;
          if (firstPush){
            mainScreen(1);
            delay(500);
            firstPush = false;
          }
          else {
            setTemp -= 0.5;
          }
          mainScreen(1);
          delay(250);
        }
        else if(digitalRead(pPin)){
          onPushMillis = millis();
          push = true;
          if (firstPush){
            mainScreen(1);
            delay(500);
            firstPush = false;
          }
          else {
            setTemp += 0.5;
          }
          mainScreen(1);
          delay(250);
        }
        else if (push && ((millis() - onPushMillis) >1000)){
          push = false;
          firstPush = true;
          }
        else if (push){ mainScreen(1);}
        else{ 
          mainScreen(0);
        }
        delay(50);
      }
      
      void mainScreen(bool i){
        
        display.clearDisplay();
        display.setCursor(0,0);
        display.setTextSize(1);
        display.setTextColor(WHITE);
        display.print(i ? "imposta temperatura" : "25/12/18");
        if (!i){
          display.setCursor((pressure < 1000) ? 84 : 80,0);
          display.print(pressure,0);
          display.print(" hPa");
        }
        display.setCursor(0,16);
        display.setTextSize(4);
        display.print(i ? setTemp : temperature,1);
        display.setCursor(104,16);
        display.print("C");
        display.setTextSize(1);
        display.setCursor(0,56);
        display.print("U: ");
        display.print(humidity,0);
        display.print('%');
        display.setCursor(52,56);
        display.print(!i ? setTemp : temperature,1);
        display.setCursor(92,56);
        display.print(!stat ? "spento" : "acceso");
      
        // Schema 
        display.drawFastHLine(0,52,128,WHITE);
        display.drawFastHLine(0,10,128,WHITE);
        display.drawFastVLine(42,54,10,WHITE);
        display.drawFastVLine(84,54,10,WHITE);
        display.display();
      }
      
      //void receive(const MyMessage &message)
      //{
      //  if (message.type==V_STATUS) {
      //    // Change relay state
      //    stat = message.getBool() ? 1 : 0;
      //    // Write some debug info
      //    Serial.print("Incoming change for sensor:");
      //    Serial.print(message.sensor);
      //    Serial.print(", New status: ");
      //    Serial.println(message.getBool());
      //  }
      //  else if (message.type==V_TEMP){
      //    setTemp = message.getFloat();
      //    Serial.println(setTemp);
      //  }
      //}
      
      

      Enabling MySensors:

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_RF24
      //#define MY_RADIO_NRF5_ESB
      //#define MY_RADIO_RFM69
      //#define MY_RADIO_RFM95
      
      // Defining BME280 sensor
      #include <Adafruit_Sensor.h>
      #include <Adafruit_BME280.h>
      
      #include <SPI.h>
      #include <Wire.h>
      #include <Adafruit_GFX.h>
      #include <Adafruit_SSD1306.h>
      #include <MySensors.h>
      
      #define SCREEN_WIDTH 128 // OLED display width, in pixels
      #define SCREEN_HEIGHT 64 // OLED display height, in pixels
      
      // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
      #define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
      Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
      
      #define SEALEVELPRESSURE_HPA (1013.25)
      
      Adafruit_BME280 bme; // I2C
      #define BME280 0x76
      
      float setTemp;
      float temperature;
      float humidity;
      float pressure;
      bool stat = 0;
      long onPushMillis;
      bool firstPush = true;
      bool push = false;
      
      // constants won't change. They're used here to set pin numbers:
      const int pPin = 5;    // the number of the pushbutton pin
      const int mPin = 4;      // the number of the LED pin
      const int relay = 6;    //relay of the Heatpump activator
      
      void setup() {
        // Pin for push button
        pinMode(pPin, INPUT);
        pinMode(mPin, INPUT);
      
        // Show initial display buffer contents on the screen --
        // the library initializes this with an Adafruit splash screen.
        display.display();
        setTemp = (int)bme.readTemperature();
        delay(500);
       }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Heatpump controller", "1.0");
        present(0, S_HVAC);
      }
      
      void loop() {
        temperature = float( bme.readTemperature() );
        humidity    = float( bme.readHumidity() );
        pressure    = float( bme.readPressure() ) / 100.0;
        stat = 0;
      
        if(digitalRead(mPin)){
          onPushMillis = millis();
          push = true;
          if (firstPush){
            mainScreen(1);
            delay(500);
            firstPush = false;
          }
          else {
            setTemp -= 0.5;
          }
          mainScreen(1);
          delay(250);
        }
        else if(digitalRead(pPin)){
          onPushMillis = millis();
          push = true;
          if (firstPush){
            mainScreen(1);
            delay(500);
            firstPush = false;
          }
          else {
            setTemp += 0.5;
          }
          mainScreen(1);
          delay(250);
        }
        else if (push && ((millis() - onPushMillis) >1000)){
          push = false;
          firstPush = true;
          }
        else if (push){ mainScreen(1);}
        else{ 
          mainScreen(0);
        }
        delay(50);
      }
      
      void mainScreen(bool i){
        
        display.clearDisplay();
        display.setCursor(0,0);
        display.setTextSize(1);
        display.setTextColor(WHITE);
        display.print(i ? "imposta temperatura" : "25/12/18");
        if (!i){
          display.setCursor((pressure < 1000) ? 84 : 80,0);
          display.print(pressure,0);
          display.print(" hPa");
        }
        display.setCursor(0,16);
        display.setTextSize(4);
        display.print(i ? setTemp : temperature,1);
        display.setCursor(104,16);
        display.print("C");
        display.setTextSize(1);
        display.setCursor(0,56);
        display.print("U: ");
        display.print(humidity,0);
        display.print('%');
        display.setCursor(52,56);
        display.print(!i ? setTemp : temperature,1);
        display.setCursor(92,56);
        display.print(!stat ? "spento" : "acceso");
      
        // Schema 
        display.drawFastHLine(0,52,128,WHITE);
        display.drawFastHLine(0,10,128,WHITE);
        display.drawFastVLine(42,54,10,WHITE);
        display.drawFastVLine(84,54,10,WHITE);
        display.display();
      }
      
      void receive(const MyMessage &message)
      {
        if (message.type==V_STATUS) {
          // Change relay state
          stat = message.getBool() ? 1 : 0;
          // Write some debug info
          Serial.print("Incoming change for sensor:");
          Serial.print(message.sensor);
          Serial.print(", New status: ");
          Serial.println(message.getBool());
        }
        else if (message.type==V_TEMP){
          setTemp = message.getFloat();
          Serial.println(setTemp);
        }
      }
      

      Arduino IDE Compile (MySensors):

      Lo sketch usa 28798 byte (93%) dello spazio disponibile per i programmi. Il massimo è 30720 byte.
      Le variabili globali usano 924 byte (45%) di memoria dinamica, lasciando altri 1124 byte liberi per le variabili locali. Il massimo è 2048 byte.
      

      MySensors Messages from Arduino:

      23:34:40.390 -> qD⸮`OT_BJQSQL\f⸮⸮⸮B⸮⸮CA⸮⸮⸮%W⸮⸮⸮6j 
      23:34:41.703 ->  __  __       ____
      23:34:41.703 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      23:34:41.703 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      23:34:41.703 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      23:34:41.737 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      23:34:41.737 ->         |___/                      2.3.1
      23:34:41.737 -> 
      23:34:41.737 -> 16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
      23:34:41.737 -> 26 TSM:INIT
      23:34:41.737 -> 27 TSF:WUR:MS=0
      23:34:41.737 -> 34 TSM:INIT:TSP OK
      23:34:41.737 -> 35 TSF:SID:OK,ID=2
      23:34:41.773 -> 37 TSM:FPAR
      23:34:41.773 -> 73 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:41.878 -> 159 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      23:34:41.878 -> 163 TSF:MSG:FPAR OK,ID=0,D=1
      23:34:43.802 -> 2081 TSM:FPAR:OK
      23:34:43.802 -> 2082 TSM:ID
      23:34:43.802 -> 2083 TSM:ID:OK
      23:34:43.802 -> 2085 TSM:UPL
      23:34:43.802 -> 2088 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      23:34:43.802 -> 2095 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      23:34:43.802 -> 2100 TSF:MSG:PONG RECV,HP=1
      23:34:43.802 -> 2102 TSM:UPL:OK
      23:34:43.802 -> 2104 TSM:READY:ID=2,PAR=0,DIS=1
      23:34:43.835 -> 2108 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      23:34:43.835 -> 2117 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      23:34:43.835 -> 2124 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
      23:34:43.835 -> 2132 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      23:34:44.559 -> 2841 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      23:34:44.559 -> 2848 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=0,st=OK:Heatpump controller
      23:34:44.559 -> 2859 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      23:34:44.559 -> 2867 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=29,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:44.592 -> 2873 MCO:REG:REQ
      23:34:44.592 -> 2876 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      23:34:44.592 -> 2885 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      23:34:44.592 -> 2890 MCO:PIM:NODE REG=1
      23:34:44.592 -> 2892 MCO:BGN:STP
      23:34:44.627 ->  
      23:34:44.627 ->  __  __       ____
      23:34:44.627 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      23:34:44.627 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      23:34:44.627 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      23:34:44.627 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      23:34:44.627 ->         |___/                      2.3.1
      23:34:44.627 -> 
      23:34:44.627 -> 18 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
      23:34:44.627 -> 27 TSM:INIT
      23:34:44.627 -> 28 TSF:WUR:MS=0
      23:34:44.661 -> 35 TSM:INIT:TSP OK
      23:34:44.661 -> 37 TSF:SID:OK,ID=2
      23:34:44.661 -> 38 TSM:FPAR
      23:34:44.696 -> 75 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:45.610 -> 1007 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      23:34:45.610 -> 1012 TSF:MSG:FPAR OK,ID=0,D=1
      23:34:46.713 -> 2082 TSM:FPAR:OK
      23:34:46.713 -> 2083 TSM:ID
      23:34:46.713 -> 2084 TSM:ID:OK
      23:34:46.713 -> 2086 TSM:UPL
      23:34:46.713 -> 2089 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      23:34:46.713 -> 2100 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      23:34:46.713 -> 2105 TSF:MSG:PONG RECV,HP=1
      23:34:46.713 -> 2107 TSM:UPL:OK
      23:34:46.713 -> 2109 TSM:READY:ID=2,PAR=0,DIS=1
      23:34:46.713 -> 2113 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      23:34:46.749 -> 2122 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      23:34:46.749 -> 2129 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
      23:34:46.749 -> 2138 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      23:34:47.565 -> 2948 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      23:34:47.565 -> 2955 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=0,st=OK:Heatpump controller
      23:34:47.565 -> 2965 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      23:34:47.600 -> 2972 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=29,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:47.600 -> 2978 MCO:REG:REQ
      23:34:47.600 -> 2982 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      23:34:47.600 -> 2992 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      23:34:47.600 -> 2997 MCO:PIM:NODE REG=1
      23:34:47.600 -> 2999 MCO:BGN:STP
      23:34:47.633 ->  
      23:34:47.633 ->  __  __       ____
      23:34:47.633 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      23:34:47.633 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      23:34:47.633 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      23:34:47.633 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      23:34:47.633 ->         |___/                      2.3.1
      23:34:47.633 -> 
      23:34:47.633 -> 17 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
      23:34:47.633 -> 27 TSM:INIT
      23:34:47.633 -> 28 TSF:WUR:MS=0
      23:34:47.667 -> 34 TSM:INIT:TSP OK
      23:34:47.667 -> 36 TSF:SID:OK,ID=2
      23:34:47.667 -> 38 TSM:FPAR
      23:34:47.701 -> 74 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:48.545 -> 942 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      23:34:48.582 -> 947 TSF:MSG:FPAR OK,ID=0,D=1
      23:34:49.685 -> 2081 TSM:FPAR:OK
      23:34:49.685 -> 2082 TSM:ID
      23:34:49.685 -> 2083 TSM:ID:OK
      23:34:49.719 -> 2085 TSM:UPL
      23:34:49.719 -> 2088 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      23:34:49.719 -> 2096 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      23:34:49.719 -> 2101 TSF:MSG:PONG RECV,HP=1
      23:34:49.719 -> 2103 TSM:UPL:OK
      23:34:49.719 -> 2105 TSM:READY:ID=2,PAR=0,DIS=1
      23:34:49.719 -> 2109 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      23:34:49.754 -> 2118 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      23:34:49.754 -> 2125 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
      23:34:49.754 -> 2134 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      23:34:50.559 -> 2933 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      23:34:50.559 -> 2940 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=0,st=OK:Heatpump controller
      23:34:50.559 -> 2951 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      23:34:50.595 -> 2959 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=29,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:50.595 -> 2964 MCO:REG:REQ
      23:34:50.595 -> 2968 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      23:34:50.595 -> 2977 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      23:34:50.595 -> 2982 MCO:PIM:NODE REG=1
      23:34:50.595 -> 2984 MCO:BGN:STP
      23:34:50.631 ->  
      23:34:50.631 ->  __  __       ____
      23:34:50.631 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      23:34:50.631 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      23:34:50.631 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      23:34:50.631 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      23:34:50.631 ->         |___/                      2.3.1
      23:34:50.631 -> 
      23:34:50.631 -> 17 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
      23:34:50.631 -> 27 TSM:INIT
      23:34:50.631 -> 28 TSF:WUR:MS=0
      23:34:50.666 -> 34 TSM:INIT:TSP OK
      23:34:50.666 -> 36 TSF:SID:OK,ID=2
      23:34:50.666 -> 38 TSM:FPAR
      23:34:50.699 -> 74 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:51.467 -> 865 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      23:34:51.467 -> 870 TSF:MSG:FPAR OK,ID=0,D=1
      23:34:52.700 -> 2081 TSM:FPAR:OK
      23:34:52.700 -> 2082 TSM:ID
      23:34:52.700 -> 2083 TSM:ID:OK
      23:34:52.700 -> 2085 TSM:UPL
      23:34:52.700 -> 2088 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      23:34:52.700 -> 2095 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      23:34:52.700 -> 2100 TSF:MSG:PONG RECV,HP=1
      23:34:52.700 -> 2102 TSM:UPL:OK
      23:34:52.737 -> 2104 TSM:READY:ID=2,PAR=0,DIS=1
      23:34:52.737 -> 2108 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      23:34:52.737 -> 2115 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      23:34:52.737 -> 2122 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
      23:34:52.737 -> 2130 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      23:34:53.559 -> 2939 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      23:34:53.559 -> 2947 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=0,st=OK:Heatpump controller
      23:34:53.559 -> 2956 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      23:34:53.594 -> 2964 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=29,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:53.594 -> 2970 MCO:REG:REQ
      23:34:53.594 -> 2973 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      23:34:53.594 -> 2982 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      23:34:53.594 -> 2988 MCO:PIM:NODE REG=1
      23:34:53.594 -> 2990 MCO:BGN:STP
      23:34:53.631 ->  
      23:34:53.631 ->  __  __       ____
      23:34:53.631 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      23:34:53.631 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      23:34:53.631 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      23:34:53.631 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      23:34:53.631 ->         |___/                      2.3.1
      23:34:53.631 -> 
      23:34:53.631 -> 17 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
      23:34:53.631 -> 27 TSM:INIT
      23:34:53.631 -> 28 TSF:WUR:MS=0
      23:34:53.631 -> 34 TSM:INIT:TSP OK
      23:34:53.631 -> 36 TSF:SID:OK,ID=2
      23:34:53.668 -> 38 TSM:FPAR
      23:34:53.706 -> 74 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      23:34:54.407 -> 791 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      23:34:54.407 -> 796 TSF:MSG:FPAR OK,ID=0,D=1
      23:34:55.698 -> 2081 TSM:FPAR:OK
      23:34:55.698 -> 2082 TSM:ID
      23:34:55.698 -> 2083 TSM:ID:OK
      23:34:55.733 -> 2085 TSM:UPL
      23:34:55.733 -> 2122 !TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      

      Imgur

      Useful data:
      – Clone Arduino Nano
      – MySensors Library 2.3.1
      – Working NRF24L04+
      – Working OLED Display

      posted in Troubleshooting
      Edoardo Macrì
      Edoardo Macrì
    • RE: arduino mega nrf wiring

      @ayo for me didn't worked.. maybe because i have an updated mysensor library?

      posted in Hardware
      Edoardo Macrì
      Edoardo Macrì
    • RE: Ethernet gateway with W5100

      @Boots33
      Thanks, now it's working.. probably somethin in the DHCP string!

      This is the working code:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex,
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       * Contribution by Tomas Hozza <thozza@gmail.com>
       *
       *
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the ethernet link.
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error
       *
       * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
       *
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable gateway ethernet module type 
      #define MY_GATEWAY_W5100
      
      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
      //#define MY_W5100_SPI_EN 4  
      
      // Enable Soft SPI for NRF radio (note different radio wiring is required)
      // The W5100 ethernet module seems to have a hard time co-operate with 
      // radio on the same spi bus.
      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
        #define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN 14
        #define MY_SOFT_SPI_MISO_PIN 16
        #define MY_SOFT_SPI_MOSI_PIN 15
      #endif  
      
      // When W5100 is connected we have to move CE/CSN pins for NRF radio
      #ifndef MY_RF24_CE_PIN 
        #define MY_RF24_CE_PIN 5
      #endif
      #ifndef MY_RF24_CS_PIN 
        #define MY_RF24_CS_PIN 6
      #endif
      
      // Enable to UDP          
      //#define MY_USE_UDP
      
      #define MY_IP_ADDRESS 192,168,1,35   // If this is disabled, DHCP is used to retrieve address
      // Renewal period if using DHCP
      //#define MY_IP_RENEWAL_INTERVAL 60000
      // The port to keep open on node server mode / or port to contact in client mode
      #define MY_PORT 5003
      
      // Controller ip address. Enables client mode (default is "server" mode). 
      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
       
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      #define MY_MAC_ADDRESS 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
      
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
      // Uncomment to override default HW configurations
      #define MY_DEFAULT_ERR_LED_PIN A3  // Error led pin
      #define MY_DEFAULT_RX_LED_PIN  A4  // Receive led pin
      #define MY_DEFAULT_TX_LED_PIN  A5  // the PCB, on board LED
      
      #include <SPI.h>
      
      #if defined(MY_USE_UDP)
        #include <EthernetUdp.h>
      #endif
      #include <Ethernet.h>
      #include <MySensors.h>
      
      
      void setup()
      {
      }
      
      void loop() {
      }
      
      posted in Troubleshooting
      Edoardo Macrì
      Edoardo Macrì
    • RE: Ethernet gateway with W5100

      Uh. I forgot to mention that the shield with the Ethernet library works perfectly, so it's isn't broken...

      posted in Troubleshooting
      Edoardo Macrì
      Edoardo Macrì
    • RE: Ethernet gateway with W5100

      @Boots33 said:

      @Edoardo-Macrì

      You may need to comment out this line. It is preventing soft spi from being enabled

       // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
       #define MY_W5100_SPI_EN 4  
      
      
      

      I've tried, moved SI SO SCK from the nrf to the respective analog pins but it won't worked, gave me the same problem

      posted in Troubleshooting
      Edoardo Macrì
      Edoardo Macrì
    • Ethernet gateway with W5100

      Hello,
      I recently decide to have some fun with Arduino and MySensors. I am not a programmer so I don know what exactly I'm doing.
      I bought on Ebay an Arduino Shield Compatible (not original, neither only for arduino uno r3) and to be sure an ethernet adapter too.
      The arduino shield have a Wiznet W5100 chip (which should be almost compatible with MySensors) and the etherent adapte have an ENC28J60 (which is supported but with some modificantions to the UIPE code).
      So, i put my shield on the arduino, in the w5100 gateway script enable the softspi and connected my nrf24... When I go to the serial console, it gave me DHCP Failture (once i got connected, on my router i reserved the ip for the arsuino specific mac address) and assigned a static ip of 192.168.1.35 (the one assigned by my router to the mac address). If I give the ip number in the console says that its connected successfully with that ip, but actually it isn't (if i go to my router it says that it isn't connected and the ip is free), even if i go to Domoticz it can't connect to the gateway, neither MyController (i hope it's spelled correctly).
      If i do the same for the ENC driver it works great, it even recognise my node (which is a RelayActuator on a nano) which when is connected through the w5100 doesn't show up in the Serial Console.

      I leave my codes Here so you can look and eventually tell me what is wrong:
      W5100 Code:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex,
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       * Contribution by Tomas Hozza <thozza@gmail.com>
       *
       *
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the ethernet link.
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error
       *
       * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
       *
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable gateway ethernet module type 
      #define MY_GATEWAY_W5100
      
      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
      #define MY_W5100_SPI_EN 4  
      
      // Enable Soft SPI for NRF radio (note different radio wiring is required)
      // The W5100 ethernet module seems to have a hard time co-operate with 
      // radio on the same spi bus.
      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
        #define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN 14
        #define MY_SOFT_SPI_MISO_PIN 16
        #define MY_SOFT_SPI_MOSI_PIN 15
      #endif  
      
      // When W5100 is connected we have to move CE/CSN pins for NRF radio
      #ifndef MY_RF24_CE_PIN 
        #define MY_RF24_CE_PIN 5
      #endif
      #ifndef MY_RF24_CS_PIN 
        #define MY_RF24_CS_PIN 6
      #endif
      
      // Enable to UDP          
      #define MY_USE_UDP
      
      #define MY_IP_ADDRESS 192,168,1,35   // If this is disabled, DHCP is used to retrieve address
      // Renewal period if using DHCP
      #define MY_IP_RENEWAL_INTERVAL 60000
      // The port to keep open on node server mode / or port to contact in client mode
      #define MY_PORT 5003
      
      // Controller ip address. Enables client mode (default is "server" mode). 
      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
       
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      #define MY_MAC_ADDRESS 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
      
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN A0  // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN  A2  // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN  A1  // the PCB, on board LED
      
      #include <SPI.h>
      
      #if defined(MY_USE_UDP)
        #include <EthernetUdp.h>
      #endif
      #include <Ethernet.h>
      #include <MySensors.h>
      
      
      void setup()
      {
      }
      
      void loop() {
      }
      
      

      ENC28J60 Code:

      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // When ENC28J60 is connected we have to move CE/CSN pins for NRF radio
      #define MY_RF24_CE_PIN 5
      #define MY_RF24_CS_PIN 6
      
      // Enable gateway ethernet module type 
      #define MY_GATEWAY_ENC28J60
      
      // Gateway IP address
      #define MY_IP_ADDRESS 192,168,1,35
      
      // The port to keep open on node server mode / or port to contact in client mode
      #define MY_PORT 5003   
      
      // Controller ip address. Enables client mode (default is "server" mode). 
      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
      
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      #define MY_MAC_ADDRESS 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
      
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
      //#define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN  9  // the PCB, on board LED
      
      #include <SPI.h>
      #include <UIPEthernet.h>
      #include <MySensors.h>
      
      
      void setup()
      {
      }
      
      void loop() {
      }
      

      Sorry for my bad english but it isn't my native language 😄

      posted in Troubleshooting
      Edoardo Macrì
      Edoardo Macrì