Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Christian Wilhelm
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Christian Wilhelm

    @Christian Wilhelm

    0
    Reputation
    4
    Posts
    358
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Christian Wilhelm Follow

    Best posts made by Christian Wilhelm

    This user hasn't posted anything yet.

    Latest posts made by Christian Wilhelm

    • RE: Error compiling for Arduino / Energy Monitor Shield

      Hi,

      Thanks for the sketch 🙂

      I managed to find the time library but seem to have a problem with settime I don't understand:

      It says 'setTime' was not declared in this scope

      : In function 'void receiveTime(long unsigned int)':
      New_powermonitor:132: error: 'setTime' was not declared in this scope
      setTime(time);
      ^
      : In function 'void loop()':
      New_powermonitor:156: error: 'hour' was not declared in this scope
      int HH = hour();
      ^
      New_powermonitor:157: error: 'minute' was not declared in this scope
      int MM = minute();
      ^
      New_powermonitor:158: error: 'second' was not declared in this scope
      int SS = second();
      ^
      : In function 'void displayUpdate()':
      277:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
      myGLCD.print("PWR:", 0, 0); //от края, высота
      ^
      :282:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
      myGLCD.print("IRM:", 0, 10); //от края, высота
      ^
      :287:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
      myGLCD.print("MiN:", 0, 20); //от края, высота
      ^
      :292:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
      myGLCD.print("MaX:", 0, 30); //от края, высота
      ^
      :297:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
      myGLCD.print("flt:", 0, 40); //от края, высота
      ^
      exit status 1
      'setTime' was not declared in this scope

      posted in Troubleshooting
      Christian Wilhelm
      Christian Wilhelm
    • RE: Error compiling for Arduino / Energy Monitor Shield

      Yes the sketch was written using MySensors 1.5, but these don't seem to work anymore with the new IDE. I assume to code needs to look quite a bit differently.

      posted in Troubleshooting
      Christian Wilhelm
      Christian Wilhelm
    • RE: Error compiling for Arduino / Energy Monitor Shield

      Hi,

      Thanks for your help, still struggling to make it work. I have amended the sketch to that:

      /*
       This example code is in the public domain. 
       */
       
      #include <SPI.h>
      
      #include "EmonLib.h" // Include Emon Library
      #include <LCD5110_Graph_SPI.h> // Include NOKIA5110 Library
       
      #define CHILD_ID_POWER 0
       
      EnergyMonitor emon;
       
      LCD5110 myGLCD(5,6,3);
      extern unsigned char SmallFont[];
       
      MyTransportNRF24 transport(7, 8); //for EMv1
      MySensors gw(transport);
       
      unsigned long lastSend;
      unsigned long SEND_FREQUENCY = 20000; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.
       
      float Irms;
      float lastIrms = -99;
       
      char tbuf[8];
      char sbuf[12];
       
      MyMessage IrmsMsg(CHILD_ID_POWER, V_KWH);
       
      void setup()  
      { 
        myGLCD.InitLCD();
        myGLCD.setFont(SmallFont);
        myGLCD.update();
       
        // The third argument enables repeater mode.
        begin(NULL, AUTO, true),
        sendSketchInfo("Energy Monitor v1", "1.0");
       
      //  emon.current(0, 111.1);             // Current: input pin, calibration.
         emon.current(0, 66.5); 
       
      
       
      void loop()      
      {      
        process(); 
        unsigned long now = millis();
       
        double Irms = emon.calcIrms(1480);  // Calculate Irms only
        float realIrms  = emon.Irms*220;        //extract Real Power into variable
       
       if (realIrms != lastIrms) {
            gw.send(IrmsMsg.set(realIrms, 1)); //send to gateway
       
        lastIrms=realIrms;
        }
       
         dtostrf(realIrms,5,2,tbuf);
          sprintf(sbuf, "  %s kWt", tbuf);
          myGLCD.print(sbuf, 20, 0);   
          myGLCD.print("Powr:", 0, 0);  
       
          dtostrf(Irms,5,2,tbuf);
          sprintf(sbuf, "  %s Amp", tbuf);
          myGLCD.print(sbuf, 20, 10);   
          myGLCD.print("Irms:", 0, 10);  
       
          myGLCD.update(); 
       
            Serial.print("Power: ");
            Serial.println(realIrms);
       
        sleep(SEND_FREQUENCY);
        }
        #include <MySensors.h>  // Include MySensors.org Library V2.0
      

      Still get this error message:

      Documents/Arduino/libraries/MySensors-master/MySensors.h:287:4: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      ^
      exit status 1
      Error compiling for board Arduino/Genuino Mega or Mega 2560.

      Thanks

      Christian

      posted in Troubleshooting
      Christian Wilhelm
      Christian Wilhelm
    • Error compiling for Arduino / Energy Monitor Shield

      Hello,

      I am trying to get the Energy Monitor Shield from Seeed to work (http://wiki.seeedstudio.com/wiki/Energy_Monitor_Shield_V0.9b) but struggling to use the provided sketch. As far as I know I need to transform the code to make it work with MySensors 2.0. I am rubbish with code (only know a little python) and have no clue where to start or decipher the error messages.

      The original code looks like this:

      /*
       This example code is in the public domain. 
       */
       
      #include <SPI.h>
      #include <MySensor.h>  // Include MySensors.org Library V1.5
      #include "EmonLib.h" // Include Emon Library
      #include <LCD5110_Graph_SPI.h> // Include NOKIA5110 Library
       
      #define CHILD_ID_POWER 0
       
      EnergyMonitor emon;
       
      LCD5110 myGLCD(5,6,3);
      extern unsigned char SmallFont[];
       
      MyTransportNRF24 transport(7, 8); //for EMv1
      MySensor gw(transport);
       
      unsigned long lastSend;
      unsigned long SEND_FREQUENCY = 20000; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.
       
      float Irms;
      float lastIrms = -99;
       
      char tbuf[8];
      char sbuf[12];
       
      MyMessage IrmsMsg(CHILD_ID_POWER, V_KWH);
       
      void setup()  
      { 
        myGLCD.InitLCD();
        myGLCD.setFont(SmallFont);
        myGLCD.update();
       
        // The third argument enables repeater mode.
        gw.begin(NULL, AUTO, true),
        gw.sendSketchInfo("Energy Monitor v1", "1.0");
       
      //  emon.current(0, 111.1);             // Current: input pin, calibration.
         emon.current(0, 66.5); 
       
        // Register all sensors to gw (they will be created as child devices)
       
        gw.present(CHILD_ID_POWER, S_POWER); 
      }
       
      void loop()      
      {      
        gw.process(); 
        unsigned long now = millis();
       
        double Irms = emon.calcIrms(1480);  // Calculate Irms only
        float realIrms  = emon.Irms*220;        //extract Real Power into variable
       
       if (realIrms != lastIrms) {
            gw.send(IrmsMsg.set(realIrms, 1)); //send to gateway
       
        lastIrms=realIrms;
        }
       
         dtostrf(realIrms,5,2,tbuf);
          sprintf(sbuf, "  %s kWt", tbuf);
          myGLCD.print(sbuf, 20, 0);   
          myGLCD.print("Powr:", 0, 0);  
       
          dtostrf(Irms,5,2,tbuf);
          sprintf(sbuf, "  %s Amp", tbuf);
          myGLCD.print(sbuf, 20, 10);   
          myGLCD.print("Irms:", 0, 10);  
       
          myGLCD.update(); 
       
            Serial.print("Power: ");
            Serial.println(realIrms);
       
        gw.sleep(SEND_FREQUENCY);
        }```
      
      
      Then I transformed it to:
      
      
      

      /*
      This example code is in the public domain.
      */

      #include <nRF24L01.h>
      #include <RF24.h>
      #include <RF24_config.h>
      #include <SPI.h>
      #include <MySensors.h> // Include MySensors.org Library V1.5
      #include "EmonLib.h" // Include Emon Library
      #include <LCD5110_Graph_SPI.h> // Include NOKIA5110 Library

      #define CHILD_ID_POWER 0
      #define MY_RADIO_NRF24

      EnergyMonitor emon;

      LCD5110 myGLCD(5,6,3);
      extern unsigned char SmallFont[];

      MyTransportNRF24 transport(7, 8); //for EMv1

      unsigned long lastSend;
      unsigned long SEND_FREQUENCY = 20000; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.

      float Irms;
      float lastIrms = -99;

      char tbuf[8];
      char sbuf[12];

      MyMessage IrmsMsg(CHILD_ID_POWER, V_KWH);

      void setup()
      {
      myGLCD.InitLCD();
      myGLCD.setFont(SmallFont);
      myGLCD.update();

      // The third argument enables repeater mode.
      begin(NULL, AUTO, true),
      sendSketchInfo("Energy Monitor v1", "1.0");

      // emon.current(0, 111.1); // Current: input pin, calibration.
      emon.current(0, 66.5);

      // Register all sensors to gw (they will be created as child devices)

      present(CHILD_ID_POWER, S_POWER);
      }

      void loop()
      {

      unsigned long now = millis();

      double Irms = emon.calcIrms(1480); // Calculate Irms only
      float realIrms = emon.Irms*220; //extract Real Power into variable

      if (realIrms != lastIrms) {
      send(IrmsMsg.set(realIrms, 1)); //send to gateway

      lastIrms=realIrms;
      }

      dtostrf(realIrms,5,2,tbuf);
      sprintf(sbuf, " %s kWt", tbuf);
      myGLCD.print(sbuf, 20, 0);
      myGLCD.print("Powr:", 0, 0);

      dtostrf(Irms,5,2,tbuf);
      sprintf(sbuf, "  %s Amp", tbuf);
      myGLCD.print(sbuf, 20, 10);   
      myGLCD.print("Irms:", 0, 10);  
      
      myGLCD.update(); 
      
        Serial.print("Power: ");
        Serial.println(realIrms);
      

      sleep(SEND_FREQUENCY);
      } ```

      But still get the same error which is:

      MySensors.h:287:4: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      ^
      exit status 1
      Error compiling for board Arduino/Genuino Mega or Mega 2560.

      I think the sketch was written some time ago, using MySensors 1.5, not sure how to change it to the updated version.

      Appreciate any help

      Regards

      Christian

      posted in Troubleshooting
      Christian Wilhelm
      Christian Wilhelm