Skip to content
  • MySensors
  • 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. My Project
  3. Power/ Usage sensor - multi channel - local display

Power/ Usage sensor - multi channel - local display

Scheduled Pinned Locked Moved My Project
41 Posts 6 Posters 19.6k 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.
  • J Offline
    J Offline
    jeti
    wrote on last edited by jeti
    #19

    @AWI thanks again!
    I am using your sketches with only one S0 Meter (the 2000pulse/kwh one).
    *One thing i just found out, that as long as the master arduino is connected to the serial port of my pc it is running fine but when its not, it does not send.I have checked the voltage at the radio and it is the same... I also do not have any display or rotary encoder, as I do the visualisation with FHEM.
    Do you know why this is the case? * -> Voltage was to low... but the secon question remains:

    Any idea to use differen pulses/kwh S0 meters? for example one 2000pulse/kwh and one 800 pulse/kwh.
    thanks in advance!

    AWIA 1 Reply Last reply
    0
    • M Offline
      M Offline
      marten
      wrote on last edited by
      #20

      Arduino: 1.6.5 (Windows 7), Board:"Arduino Nano, ATmega328"

      sketch_oct03e:128: error: 'V_TEXT' was not declared in this scope
      sketch_oct03e.ino: In function 'void setup()':
      sketch_oct03e:162: error: 'S_INFO' was not declared in this scope
      sketch_oct03e.ino: In function 'void loop()':
      sketch_oct03e:337: error: 'V_TEXT' was not declared in this scope
      sketch_oct03e.ino: In function 'void incomingMessage(const MyMessage&)':
      sketch_oct03e:364: error: 'V_TEXT' was not declared in this scope
      'V_TEXT' was not declared in this scope

      Dit rapport zou meer informatie hebben met
      "Tijdens de compilatie uitgebreide uitvoer weergeven"
      ingeschakeld in Bestand > Voorkeuren.

      M AWIA 2 Replies Last reply
      0
      • M marten

        Arduino: 1.6.5 (Windows 7), Board:"Arduino Nano, ATmega328"

        sketch_oct03e:128: error: 'V_TEXT' was not declared in this scope
        sketch_oct03e.ino: In function 'void setup()':
        sketch_oct03e:162: error: 'S_INFO' was not declared in this scope
        sketch_oct03e.ino: In function 'void loop()':
        sketch_oct03e:337: error: 'V_TEXT' was not declared in this scope
        sketch_oct03e.ino: In function 'void incomingMessage(const MyMessage&)':
        sketch_oct03e:364: error: 'V_TEXT' was not declared in this scope
        'V_TEXT' was not declared in this scope

        Dit rapport zou meer informatie hebben met
        "Tijdens de compilatie uitgebreide uitvoer weergeven"
        ingeschakeld in Bestand > Voorkeuren.

        M Offline
        M Offline
        marten
        wrote on last edited by
        #21

        this is what i'll get when trying to upload the master sketch

        1 Reply Last reply
        0
        • M marten

          Arduino: 1.6.5 (Windows 7), Board:"Arduino Nano, ATmega328"

          sketch_oct03e:128: error: 'V_TEXT' was not declared in this scope
          sketch_oct03e.ino: In function 'void setup()':
          sketch_oct03e:162: error: 'S_INFO' was not declared in this scope
          sketch_oct03e.ino: In function 'void loop()':
          sketch_oct03e:337: error: 'V_TEXT' was not declared in this scope
          sketch_oct03e.ino: In function 'void incomingMessage(const MyMessage&)':
          sketch_oct03e:364: error: 'V_TEXT' was not declared in this scope
          'V_TEXT' was not declared in this scope

          Dit rapport zou meer informatie hebben met
          "Tijdens de compilatie uitgebreide uitvoer weergeven"
          ingeschakeld in Bestand > Voorkeuren.

          AWIA Offline
          AWIA Offline
          AWI
          Hero Member
          wrote on last edited by AWI
          #22

          @marten You need to use the "Development" branch of MySensors until the production version gets updated -or- you can uncomment the lines with "const int ..."

          // new V_TEXT variable type (development 20150905)
          //const int V_TEXT = 47 ;
          // new S_INFO sensor type (development 20150905)
          //const int S_INFO = 36 ;
          
          1 Reply Last reply
          0
          • J Offline
            J Offline
            jeti
            wrote on last edited by
            #23
            This post is deleted!
            1 Reply Last reply
            0
            • J jeti

              @AWI thanks again!
              I am using your sketches with only one S0 Meter (the 2000pulse/kwh one).
              *One thing i just found out, that as long as the master arduino is connected to the serial port of my pc it is running fine but when its not, it does not send.I have checked the voltage at the radio and it is the same... I also do not have any display or rotary encoder, as I do the visualisation with FHEM.
              Do you know why this is the case? * -> Voltage was to low... but the secon question remains:

              Any idea to use differen pulses/kwh S0 meters? for example one 2000pulse/kwh and one 800 pulse/kwh.
              thanks in advance!

              AWIA Offline
              AWIA Offline
              AWI
              Hero Member
              wrote on last edited by
              #24

              @jeti as mentioned in a previous post..

              There are a few ways of getting it changed:

              You can keep/ leave most as it is and when you send/ or display the values divide the pulses by two and double the Watt values in the routines "LCD_local_display" and "sendPowerUpdate"

              or: make the necessary calculations when the data comes in. This is a little more complicated in routine "storeMeterJSON" but if you understand the logic (including error corrrection) should be not too hard.

              I don't have the time at this moment to do it for you...

              J 1 Reply Last reply
              0
              • AWIA AWI

                @jeti as mentioned in a previous post..

                There are a few ways of getting it changed:

                You can keep/ leave most as it is and when you send/ or display the values divide the pulses by two and double the Watt values in the routines "LCD_local_display" and "sendPowerUpdate"

                or: make the necessary calculations when the data comes in. This is a little more complicated in routine "storeMeterJSON" but if you understand the logic (including error corrrection) should be not too hard.

                I don't have the time at this moment to do it for you...

                J Offline
                J Offline
                jeti
                wrote on last edited by
                #25

                @AWI: :smiley: nevermind I will start workin on it
                Thanks again for the great work!

                J 1 Reply Last reply
                0
                • J jeti

                  @AWI: :smiley: nevermind I will start workin on it
                  Thanks again for the great work!

                  J Offline
                  J Offline
                  jeti
                  wrote on last edited by jeti
                  #26

                  was not that much work :smiley:
                  this is the modified master-sketch from AWI i am starting to use. The changes i made:
                  -deletion of LCD and rotray part
                  -deletion of accumulation part
                  -modified meterType to meter800, meter1000 and meter2000 this reflects meters with 800imp/khw;1000imp/kwh;2000imp/kwh

                  I am using this with only one meter (2000imp/kwh) for now and works pretty nicly second different meter type is on the way.

                  As I am a beginner please be gentle with comments :-)

                  
                  #include <MySensor.h>                   // MySensors network
                  #include <SPI.h>
                  #include <Time.h> 
                  #include <ArduinoJson.h>                // used to parse the simple JSON output of the pulse meter https://github.com/bblanchon/ArduinoJson
                  
                  // Constants & globals
                  const int NO_METERS = 1 ;               // actual meters used (max 12)
                  const int NODE_ID = 152 ;                // fixed MySensors node ID
                  
                  const int JSON_LENGHT = 80 ;            // Maximum json string length
                  
                  // new V_TEXT variable type (development 20150905)
                  const int V_TEXT = 47 ;
                  // new S_INFO sensor type (development 20150905)
                  const int S_INFO = 36 ;
                  
                  char lastLCD1[21] = "--                  "; // LCD message line
                  
                  typedef enum meterTypes: int8_t {meter800, meter1000, meter2000} ;             // metertype meter800, meter1000, meter2000; 
                  const char METER_NAMES[NO_METERS][4] = {"PC"} ; // meter names
                  const meterTypes METER_TYPES[NO_METERS] = {meter2000};
                  
                  const unsigned long idleTime = 10000 ;  // Delay time for any of the states to return to idle
                  unsigned long idleTimer ;               // Delay timer for idleTime
                  
                  
                  
                  union {                                 // used to convert long to bytes for EEPROM storage
                      long kWhLongInt;
                      uint8_t kWhLongByte[4];
                      } kWhLong ;
                  
                  
                  // Possible states for the state machine.
                  // Idle: default state, show totals for in/out nett
                  // Browse: dive into meter details 
                  // Update: update meter value (Wh total)
                  // Reset: reset day values
                  enum States: int8_t {IDLE, BROWSE, UPDATE, RST} ;
                  uint8_t State = IDLE;                   // current state machine state
                  
                  // meter class, store all relevant meter data (equivalent to struct)
                  class pulseMeter              
                  {
                  public:                                  
                      long UsageWh;                       // last (current) usage (in W) from pulse counter
                      long UsageAccumWh;                  // usage accumulator (to keep in sync) from pulse counter
                      long PowerW;                        // actual power, calculated from pulse "rate"
                      long DayUsageWh;                    // daily usage for display
                      meterTypes Type;                    // metertype for addition in totals: meter800, meter1000, meter2000; 
                      char Name[4] ;                      // meter name for display
                  };
                  pulseMeter pulseMeters[NO_METERS] ;     // define power meters
                  //pulseMeter meter800, meter1000, meter2000; //  pulse/kWh
                  unsigned long tempUsageWh ;             // temporary store while manually updating (state UPDATE) 
                  
                  // Json parser:  define parse object: <10> = number of tokens in JSON: ~10 per m (4 * [key, value] + key_total, value_total))
                  // example: "{\"m\":1,\"c\":12,\"r\":120000,\"cA\":12345}"
                  char json[JSON_LENGHT] ;        // Storage for serial JSON string (init for example)
                  
                  // flags & counters 
                  bool timeReceived = false;              // controller time
                  bool newDay = false;                    // reset at 00:00:00
                  unsigned long lastUpdate=0, lastRequest=0, lastDisplay=0, lastSyncKWH=0;  // loop timers for once in while events
                  int updateMeter = 0;                    // current meter for update
                  bool updateDisplayFlag = true ;         // indicate that display needs to be updated
                  int currentMeter = 0;                   // active meter for update & check, cycles through meters (0..NO_METERS-1)
                  int lastRotary = 0;                     // last rotary encoder position
                  int updateIncrement = 1000 ;            // Interval multiplier for Update 
                  int errCount = 0 ;                      // error counter
                  // *** Definition and initialisation
                  // define the MySensor network
                  MySensor gw;                            // pins used RFX24(default 9,10)
                      
                  // Initialize messages for sensor network
                  MyMessage powerMsg(0,V_WATT);           // message to send power in W
                  MyMessage usageMsg(0,V_KWH);            // message to send usage in kWH
                  MyMessage textMsg(0,V_TEXT);            // message to send/receive text
                  
                  
                  
                  // function to reset the Arduino (jump to 0 address)
                  void(* resetFunc) (void) = 0;//declare reset function at address 0
                  
                  void setup(void)
                  {
                      gw.begin(incomingMessage, NODE_ID, false);              // this node is fixed, no repeat
                      //Send the sensor node sketch version information to the gateway
                      gw.sendSketchInfo("AWI-12ChannelPulse", "2.0");
                      // Initialize the meter names
                      
                      // Register all Pulse counters to gw (they will be created as child devices from 0 to MAX-1)
                      for (int x = 0; x < NO_METERS; x++){ 
                          gw.present(x, S_POWER, METER_NAMES[x]);             // present power meters to gateway
                          delay(10);                                          // give it some time to process
                          }
                      
                      delay(100);
                  
                      
                      for (int x = 0; x < NO_METERS; x++){                    // initialize previous kWh values from EEPROM and init
                          for (int y = 0; y < 4 ; y++){                       // convert from bytes
                              kWhLong.kWhLongByte[y]= gw.loadState(x *4 + y) ;// EEPROM position = meter number * 4 bytes
                              }                                               // controller is updated later automatically
                          pulseMeters[x].UsageWh = kWhLong.kWhLongInt;
                          strcpy(pulseMeters[x].Name, METER_NAMES[x] );       // copy string for meter names
                          pulseMeters[x].Type = METER_TYPES[x];               // Set type
                          }
                   }
                  
                  void loop(void)
                  {
                      // Before specific states, perform generic tasks
                      unsigned long now = millis();                           // Timer in loop for "once in a while" events
                      gw.process() ;                                          // process incoming messages
                      // If no time has been received yet, request it every 10 second from controller
                      if ((!timeReceived && (now-lastRequest > 10*1000)) ||   
                          (now-lastRequest > 3600000UL)){                     // request update every hour to keep in sync
                          Serial.println(F("requesting time"));               // Request time from controller. 
                          timeReceived = false;
                          gw.requestTime(receiveTime);  
                          lastRequest = now;
                      }
                      // Check if new day has started (hour == 0) and reset day usage counters of meters
                      if (hour()==0 && !newDay){
                          newDay = true;
                          for (int x = 0; x < NO_METERS; x++){ 
                              pulseMeters[x].DayUsageWh = 0 ;                 // reset daily counters
                              saveMeters(x);                                  // save meter values to EEPROM
                          }   
                      } else if(hour() != 0 && newDay)                        // reset newday flag if hour != 0
                          { newDay = false;}
                       
                      // Every 10 seconds update one meter to controller to avoid traffic jams
                      if (now-lastSyncKWH > 10000){
                      //    printPulsemeter(updateMeter);
                          sendPowerUpdate(updateMeter);                               // update the values for currentMeter
                          updateMeter++ ;
                          if (updateMeter >= NO_METERS){                              // increment and wrap current meter
                              updateMeter = 0 ;}
                          lastSyncKWH = now ;
                          }
                          
                      // Update sensors every 10 secs
                      if (now-lastUpdate > 10000) {
                          // get values to be displayed from controller
                          
                          lastUpdate = now;
                      }
                      
                      // get readings from serial (sent every 10s)
                      // format {"m":meter,"c":count,"r":rate, "cA":countAccum}
                      // use JSON parser to process (could be replaced by simple split routine, but this works just fine)
                      if(readLineJSON(Serial.read(), json, JSON_LENGHT) > 0 ){        //dummySerial(), Serial.read()
                      // if(readLineJSON(dummySerial(), json, 80) > 0 ){              //dummySerial(), Serial.read()
                          Serial.println(json);
                          storeMeterJSON(json);                                       //store the meter reading
                          //calcMeterTotals();                                          // update totals
                          }
                  }
                  
                  // This is called when a new time value was received
                  void receiveTime(unsigned long controllerTime) {
                      // Ok, set incoming time 
                      Serial.print(F("Time value received: "));
                      Serial.println(controllerTime);
                      setTime(controllerTime);                                        // set the clock to the time from controller
                      timeReceived = true ;
                  }
                  
                  // This is called when a message is received 
                  void incomingMessage(const MyMessage &message) {
                    // Expect few types of messages from controller, V_VAR1 for messages
                      if (message.type==V_TEXT) {
                          // if message comes in, update the kWH reading for meter with value since last update
                          // Write some debug info
                          //Serial.print("Last reading for sensor: ");
                          //Serial.print(message.sensor);                
                          //Serial.print(", Message: ");
                          //Serial.println(message.getString());
                  
                          }
                      }
                  
                  
                  // save Meter to EEPROM when needed
                  void saveMeters(int8_t meterNo){
                      kWhLong.kWhLongInt = pulseMeters[meterNo].UsageWh ;                     // convert to separate bytes via struct
                      for (int y = 0; y < 4 ; y++){
                          gw.saveState(meterNo * 4 + y, kWhLong.kWhLongByte[y])  ;            // EEPROM position = meter number * 4 bytes
                          }
                      }
                  
                  void sendPowerUpdate(int meterNo)
                  // Sends update to controller for current meter 
                  {
                      gw.send(powerMsg.setSensor(meterNo).set((long)pulseMeters[meterNo].PowerW));            // meterNo * 100 ));
                      gw.send(usageMsg.setSensor(meterNo).set((float)pulseMeters[meterNo].UsageWh/1000L ,3)); // send in kWh!
                  }
                  
                  int storeMeterJSON(char *json)
                  /* convert JSON to values and store in corresponding meter (if used)
                   input: JSON string (can be wrong formatted), with length
                   output: changed meter record number or -1 if error
                   use JsonParser 
                  */
                  {
                    StaticJsonBuffer<50> jsonBuffer;                          // 4 object  -> 4 + 4*10 = 44
                    // char njson[] = "{\"m\":1,\"c\":12,\"r\":120000,\"cA\":12345}";
                      JsonObject& root = jsonBuffer.parseObject(json);
                    if (!root.success())
                      {
                          Serial.println(F("JsonParser.parse() failed"));
                          errCount++ ;
                          return -1;
                      }
                    int m = (long)root["m"];
                    if (m > NO_METERS){                                       // meter value out of range for used meters (m starts at 1)
                      return -1 ;
                    } else {                                                  // update meter values, Power is momentary, Usage is cumulative
                      long newAccumWh = (long)root["cA"] ;
                      long newWh = (long)root["c"] ;
                      long diffAccumWh = newAccumWh - pulseMeters[m-1].UsageAccumWh;  // check for missed pulses by comparing cA with last stored value
                      if (diffAccumWh >= newWh){                              // no difference or missed pulses -> correct: add difference
                          pulseMeters[m-1].UsageWh += diffAccumWh;
                          pulseMeters[m-1].DayUsageWh += diffAccumWh;
                          }
                      else {                                                  // negative diff, out of sync -> add pulses only (can be out of range or restart)
                          pulseMeters[m-1].UsageWh += newWh;
                          pulseMeters[m-1].DayUsageWh += newWh;
                          }
                      pulseMeters[m-1].UsageAccumWh = newAccumWh;             // always update sync counter (only for sync and error correction(serial))
                      if ((long)root["r"] == 0){                              // calculate power from pulse rate (ms) and truncate to whole Watts
                        pulseMeters[m-1].PowerW = 0;                          // if overflow assume no Usage
                      } else if (pulseMeters[m-1].Type == meter800){
                        pulseMeters[m-1].PowerW = long( 3600000000L / (long)root["r"]*0.8); // rate in microseconds for 800 pulse/kWh
                        }
                        else if (pulseMeters[m-1].Type == meter1000){
                        pulseMeters[m-1].PowerW = long( 3600000000L / (long)root["r"]); // rate in microseconds for 1000 pulse/kWh
                        }
                         else if (pulseMeters[m-1].Type == meter2000){
                         pulseMeters[m-1].PowerW = long( 3600000000L / (long)root["r"]/2); // rate in microseconds for 2000 pulse/kWh
                        }
                        else {
                          Serial.println("geht nicht");
                          }
                      return m ;
                    }
                  }
                  
                  int readLineJSON(int readch, char *buffer, int len)
                  /* checks for JSON and when started append char tot buffer and checks for line completion 
                  usage:
                    static char buffer[80];
                    if (readline(Serial.read(), buffer, 80) > 0) { // line complete}
                    returns simple JSON
                    */
                  {
                    static int pos = 0;
                    int rpos;
                  
                    if (readch > 0) {
                      switch (readch) {
                        case '\n':                // Ignore new-lines
                          break;
                        case '\r':                // Return on CR
                          rpos = pos;
                          pos = 0;                  // Reset position index ready for next time
                          return rpos;
                        default:
                          if (pos < len-1) {
                            buffer[pos++] = readch;
                            buffer[pos] = 0;
                          }
                      }
                    }
                    // No end of line has been found, so return -1.
                    return -1;
                  }
                  
                  /*
                  int dummySerial()
                  // Acts as a dummy JSON serial character generator for debugging
                  // input: none
                  // output: preset JSON string
                  {
                    static int pos = 0;
                    char json[] = "{\"m\":1,\"c\":12,\"r\":120000,\"cA\":12345}\r{\"m\":2,\"c\":212,\"r\":2120000,\"cA\":212345}\r{\"m\":3,\"c\":212,\"r\":2120000,\"cA\":212345}\n\r";
                    if (pos++ >= strlen(json)){
                      pos = 0;
                    } 
                    return json[pos] ;
                    
                  }
                  */
                  
                  
                  /*
                  
                  void printPulsemeter(int meter)
                  // prints the Pulsemeter record to serial out
                  {
                    Serial.print("m:");
                    Serial.print(meter);
                    Serial.print("type:");
                    Serial.print(pulseMeters[meter].Type);
                    Serial.print(", power: ");
                    Serial.print(pulseMeters[meter].PowerW);
                    Serial.print(", usage: ");
                    Serial.print(pulseMeters[meter].UsageWh);
                    Serial.print(", day usage: ");
                    Serial.println(pulseMeters[meter].DayUsageWh );
                  //  Serial.print(", Ca: ");
                  //  Serial.println(pulseMeters[meter].UsageAccumWh);
                  }
                  */
                  
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MarkV
                    wrote on last edited by
                    #27

                    Good evening,

                    After a couple of weeks, again i'm busy with my arduino's, but now i have a rasberry with domoticz near my arduino, so i don't need to send it wireless.
                    Is there a possibility to connect the master or slave arduino directly to my rasberry and read out the pulse meters???

                    1 Reply Last reply
                    0
                    • mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #28

                      With MySensors version 1.6 (currently in development) you can connect the Arduino to the Raspberry Pi's USB port using a FTDI or CH340G. That type of connection is called a serial gateway. Before 1.6, the gateways do not support local sensors.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        MarkV
                        wrote on last edited by MarkV
                        #29

                        So with 1.6 i can install the master software and connect my arduino master directly through usb without the rf24''s? ?

                        1 Reply Last reply
                        0
                        • mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #30

                          I am not entirely sure what a master is, but yes, I think you can.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            MarkV
                            wrote on last edited by MarkV
                            #31

                            I meen the master sketch like written above.

                            I'd want to build a gateway but without the wireless RF part, just connect the master arduino directly through usb to the RasberryPi and readout the measurements.

                            So in general:

                            Kwh Meters -- cable --> Slave arduino <-- serial --> Master arduino <-- USB --> RasberryPi

                            AWIA 1 Reply Last reply
                            0
                            • M MarkV

                              I meen the master sketch like written above.

                              I'd want to build a gateway but without the wireless RF part, just connect the master arduino directly through usb to the RasberryPi and readout the measurements.

                              So in general:

                              Kwh Meters -- cable --> Slave arduino <-- serial --> Master arduino <-- USB --> RasberryPi

                              AWIA Offline
                              AWIA Offline
                              AWI
                              Hero Member
                              wrote on last edited by
                              #32

                              @MarkV If you don't want it to be MySensors enabled and not used the display etc. it's easier to readout the slave with the raspberry. The protocol is a simple Json and if you use a nano for the slave you can connect it with usb..

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                MarkV
                                wrote on last edited by MarkV
                                #33

                                Last weeks i'm trying to get it to work but without luck. Could you give a manual on how to get it working with json? What should we do? And how? On my rasberry, on the arduino and in domoticz??

                                1 Reply Last reply
                                0
                                • AWIA AWI

                                  @FotoFieber To be honest .. a left over from some experiments. Just leave it out... you won't notice the difference.

                                  M Offline
                                  M Offline
                                  MarkV
                                  wrote on last edited by MarkV
                                  #34

                                  @AWI
                                  Goodmorning,
                                  I've got a question, are you planning to re-write the script for the main and slave Arduino to the new MySensors 2.0 structuur?

                                  I've also tryed to look on github if there's a page from you, but didn't find it...

                                  AWIA 1 Reply Last reply
                                  0
                                  • M MarkV

                                    @AWI
                                    Goodmorning,
                                    I've got a question, are you planning to re-write the script for the main and slave Arduino to the new MySensors 2.0 structuur?

                                    I've also tryed to look on github if there's a page from you, but didn't find it...

                                    AWIA Offline
                                    AWIA Offline
                                    AWI
                                    Hero Member
                                    wrote on last edited by AWI
                                    #35

                                    @MarkV I updated the sketch for main a few months ago to development (pre-2.0). Also changed it a little for stability and removed the (complicated) JSON library The slave has no MySensors dependency.

                                    M 1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      MarkV
                                      wrote on last edited by
                                      #36

                                      Super.
                                      I've updated everything and it's up and running.
                                      But my Master arduino (UNO clone) gives this readout on the USB port:

                                      0;255;3;0;14;Gateway startup complete.
                                      0;255;3;0;11;AWI-12ChannelPulse
                                      0;255;3;0;12;2.0
                                      0;0;0;0;13;Groep 1
                                      0;1;0;0;13;Groep 2
                                      0;2;0;0;13;Groep 3
                                      0;3;0;0;13;Groep 4
                                      0;4;0;0;13;Groep 5
                                      0;5;0;0;13;Groep 6
                                      0;20;0;0;36;Usage meter LCD
                                      0;20;1;0;47;-
                                      0;255;3;0;1;
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;1;1;0;17;0
                                      0;1;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;2;1;0;17;0
                                      0;2;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;3;1;0;17;0
                                      0;3;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;4;1;0;17;0
                                      0;4;1;0;18;-0.001
                                      0;20;2;0;47;
                                      0;255;3;0;1;
                                      0;5;1;0;17;0
                                      0;5;1;0;18;-0.001
                                      0;255;3;0;1;
                                      0;0;1;0;17;0
                                      0;0;1;0;18;-0.001
                                      

                                      Is this correct?
                                      Because Domoticz doesn't change the values.
                                      Also this is not the format, wich is past through in the JSON code from the slave to master duino??

                                      1 Reply Last reply
                                      0
                                      • AWIA AWI

                                        @MarkV I updated the sketch for main a few months ago to development (pre-2.0). Also changed it a little for stability and removed the (complicated) JSON library The slave has no MySensors dependency.

                                        M Offline
                                        M Offline
                                        MarkV
                                        wrote on last edited by
                                        #37

                                        @AWI
                                        How is it that i get the readings like above? And after a while the sensor also stops with sending data, last connection stays on that time and date.

                                        I've uploaded your github sketch and done a serial readout of the measuring arduino and that one functions proberbly. No faulty low voltage errors etc.

                                        AWIA 1 Reply Last reply
                                        0
                                        • M MarkV

                                          @AWI
                                          How is it that i get the readings like above? And after a while the sensor also stops with sending data, last connection stays on that time and date.

                                          I've uploaded your github sketch and done a serial readout of the measuring arduino and that one functions proberbly. No faulty low voltage errors etc.

                                          AWIA Offline
                                          AWIA Offline
                                          AWI
                                          Hero Member
                                          wrote on last edited by
                                          #38

                                          @MarkV Ok, one step at a time.. the output looks like the output of your (serial) gateway. Have you tried to switch on the "Master node" debug Serial.print() statements?

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


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 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
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular