Navigation

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

    Posts made by moumout31

    • RE: 💬 Power Meter Pulse Sensor

      @flopp Watt is sent every 20 seconds (as done in the original sketch).
      500 watts is the power indicated on the screen of the power meter.

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      @flopp After a few days, I confirm you that the index is consistent with power meter index.
      However, instant power in watt is not correcly calculated.
      For example, when power meter indicates 550W, about 1500W is calculated by the sketch. Do you know how I can resolve this problem please ?

      Thanks a lot !

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      @flopp It seems to work, index on Domoticz is still consistent with the real index... I will see in a few days if it's still the case.
      Thanks a lot for your help !

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      @flopp Thanks a lot, I will try this solution and check if it's better !

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      @gohan No, the light is always switched off in this room and I tried, when I switch on the light, there is no pulse from the sensor.

      @flopp Thanks for your help. What I see in your topic is that you increase from 10000µs to 40000µs the interval to avoid corrupted interrupts, is that correct ?

      Thank you

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      Hello,

      I don't understand why, but my power meter sensor gives a higher index than the real power meter index after 2 days.
      I think that it counts more pulses than pulses provided by the power meter...
      Does anybody encounter this problem ?
      Can it be cause to bounce for example ?

      Thank you

      posted in Announcements
      moumout31
      moumout31
    • RE: Send value from Domoticz to MySensor node

      Thanks a lot, it works using V_TEXT instead of V_KWH !

      posted in Domoticz
      moumout31
      moumout31
    • RE: Send value from Domoticz to MySensor node

      @AWI Thanks a lot for yout answer ! I will try this !

      posted in Domoticz
      moumout31
      moumout31
    • RE: Send value from Domoticz to MySensor node

      @moumout31 Nobody knows how to help me please ?

      Thanks

      posted in Domoticz
      moumout31
      moumout31
    • RE: Send value from Domoticz to MySensor node

      I tried to debug my sketch but when I request the last know value from gateway request(CHILD_ID_PMPINIT, V_KWH);, I have no answer from the gateway.

      Contrary to the MySensors example Power Meter Pulse, after several tries, I've created a new Child in order to store the init value of meter and to be able to update it via json.

      You can see the sketch here below.

      Thanks for your help.

      Baptiste

      #include "_04_Headers.h"
      #include "Arduino.h"
      #include <SPI.h>
      #include <SoftwareSerial.h>
      
      //**********Init MySensors**********
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_RFM69
      
      #define MY_RFM69_FREQUENCY RF69_433MHZ
      
      #define MY_RF69_IRQ_PIN 3
      #define MY_RF69_IRQ_NUM 1
      
      // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
      #if F_CPU == 8000000L
      #define MY_BAUD_RATE 38400
      #endif
      
      #include <MySensors.h>
      
      //**********Init téléinfo**********
      unsigned long loopCounter = 0L;
      unsigned long BASET=0;
      unsigned long BASETt=0; //BASET temporaire
      unsigned long PAPPT=0;
      unsigned long IINSTT=0;
      unsigned long Pcalc=0;
      unsigned long Conso=0;
      
      int j=1;
      int z=1;
      
      TeleInfo* myTeleInfo;
      
      #define CHILD_ID_COMPTEURPV 0
      #define CHILD_ID_COMPTEURPVVA 2
      #define CHILD_ID_COMPTEURPVI 3
      
      MyMessage kWhPVmsg(CHILD_ID_COMPTEURPV, V_KWH);
      MyMessage WPVmsg(CHILD_ID_COMPTEURPV, V_WATT);
      MyMessage VAPVmsg(CHILD_ID_COMPTEURPVVA, V_VA);
      MyMessage IPVmsg(CHILD_ID_COMPTEURPVI, V_CURRENT);
      
      unsigned long SENDstartTeleInfo=0;
      
      //**********Init température**********
      #include <OneWire.h>
      
      #define CHILD_ID_TEMP 1
      
      MyMessage TEMPmsg(CHILD_ID_TEMP, V_TEMP);
      
      unsigned long SENDstartTemp=0;
      
      const int DS18S20_Pin = 5; //DS18S20 Signal pin on digital 5
      const int DS18B20_ID = 0x28;
      OneWire ds(DS18S20_Pin);  // on digital pin 5
      
      //***********Init POWER METER PULSE**********
      #define DIGITAL_INPUT_SENSOR 2  // The digital input you attached your light sensor.  (Only 2 and 3 generates interrupt!)
      #define PULSE_FACTOR 1000       // Nummber of blinks per KWH of your meeter
      #define SLEEP_MODE false        // Watt-value can only be reported when sleep mode is false.
      #define MAX_WATT 10000          // Max watt value to report. This filetrs outliers.
      #define CHILD_ID_PMP 4             // Id of the sensor child
      #define CHILD_ID_PMPINIT 5
      
      unsigned long SEND_FREQUENCY = 20000; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.
      double ppwh = ((double)PULSE_FACTOR)/1000; // Pulses per watt hour
      bool pcReceived = false;
      volatile unsigned long pulseCount = 0;
      volatile unsigned long lastBlink = 0;
      volatile unsigned long watt = 0;
      unsigned long oldPulseCount = 0;
      unsigned long oldWatt = 0;
      double oldKwh;
      unsigned long lastSend;
      
      MyMessage wattMsg(CHILD_ID_PMP,V_WATT);
      MyMessage kwhMsg(CHILD_ID_PMP,V_KWH);
      MyMessage pcMsg(CHILD_ID_PMPINIT,V_KWH);
      
      void onPulse() {
          if (!SLEEP_MODE) {
              unsigned long newBlink = micros();
              unsigned long interval = newBlink-lastBlink;
              if (interval<10000L) { // Sometimes we get interrupt on RISING
                  return;
              }
              watt = (3600000000.0 /interval) / ppwh;
              lastBlink = newBlink;
          }
          pulseCount++;
      }
      
      float getTemp() {
      }
      
      void setup() 
      {
        //Serial.begin(57600);
        //Serial.println(F("\nStarting ..."));
        delay(300);
        // starting TeleInfo capture
        myTeleInfo = new TeleInfo(version);
      
        // Fetch last known pulse count value from gw
        request(CHILD_ID_PMPINIT, V_KWH);
      
        // Use the internal pullup to be able to hook up this sketch directly to an energy meter with S0 output
        // If no pullup is used, the reported usage will be too high because of the floating pin
        pinMode(DIGITAL_INPUT_SENSOR,INPUT_PULLUP);
        attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);
        lastSend=millis();
      }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Tableau electrique", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_COMPTEURPV, S_POWER);
        present(CHILD_ID_COMPTEURPVVA, S_POWER);
        present(CHILD_ID_COMPTEURPVI, S_MULTIMETER);
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_PMP, S_POWER);
        present(CHILD_ID_PMPINIT, S_POWER);
      }
      
      void receive(const MyMessage &message)
      {
          if (message.type==V_KWH) {
              pulseCount = oldPulseCount = message.getLong();
              Serial.print("Received last pulse count from gw:");
              Serial.println(pulseCount);
              pcReceived = true;
          }
      }
      
      void loop() 
      {
      //**********1er cycle de calcul**********
        float temp;
        boolean teleInfoReceived;
        if (j==1) {
          temp = getTemp(); //acquisition température
          temp = getTemp();
          send(TEMPmsg.set(temp,1));
          while(z==1) //tant qu'on n'acquiert pas de téléinfo
          {
            teleInfoReceived = myTeleInfo->readTeleInfo();
            if(teleInfoReceived)
            {
              BASET=myTeleInfo->BASET;
              PAPPT=myTeleInfo->PAPPT;
              IINSTT=myTeleInfo->IINSTT;
              z=2;
            }
          }
          j=2;
        }
        
      //**********Téléinfo**********
      
        // we parse the teleInfo frame
        teleInfoReceived = myTeleInfo->readTeleInfo();
      
        if(teleInfoReceived)
        {
          BASETt=myTeleInfo->BASET;
          PAPPT=myTeleInfo->PAPPT;
          IINSTT=myTeleInfo->IINSTT;
      
          if((BASETt>BASET) && (BASETt-BASET<1000) && (BASETt<500000)) {
            BASET=BASETt;
          }
      
          //Calcul des informations
          //Puissance efficace instantannée en Watt
          Pcalc=IINSTT*(float)230;
          
          // Envoi des donnees
          if((millis() - SENDstartTeleInfo > 3000))
          {
            SENDstartTeleInfo=millis();
           
            send(kWhPVmsg.set(BASET/(float)1000,3));
            send(VAPVmsg.set(PAPPT));
            send(IPVmsg.set(IINSTT)); 
            send(WPVmsg.set(Pcalc)); 
          }
        }
      
        //**********Consommation électrique*********
        unsigned long now = millis();
        // Only send values at a maximum frequency or woken up from sleep
        bool sendTime = now - lastSend > SEND_FREQUENCY;
        if (pcReceived && (SLEEP_MODE || sendTime)) {
            // New watt value has been calculated
            if (!SLEEP_MODE && watt != oldWatt) {
                // Check that we dont get unresonable large watt value.
                // could hapen when long wraps or false interrupt triggered
                if (watt<((unsigned long)MAX_WATT)) {
                    send(wattMsg.set(watt));  // Send watt value to gw
                }
                Serial.print("Watt:");
                Serial.println(watt);
                oldWatt = watt;
            }
      
            // Pulse cout has changed
            if (pulseCount != oldPulseCount) {
                send(pcMsg.set(pulseCount));  // Send pulse count value to gw
                double kwh = ((double)pulseCount/((double)PULSE_FACTOR));
                oldPulseCount = pulseCount;
                if (kwh != oldKwh) {
                    send(kwhMsg.set(kwh, 4));  // Send kwh value to gw
                    oldKwh = kwh;
                }
            }
            lastSend = now;
        } else if (sendTime && !pcReceived) {
            // No count received. Try requesting it again
            request(CHILD_ID_PMPINIT, V_KWH);
            lastSend=now;
        }
      
        if (SLEEP_MODE) {
            sleep(SEND_FREQUENCY);
        }
        
        //**********Température**********
        float temp1 = getTemp(); //acquisition température
      
        if((millis() - SENDstartTemp > 30000) && (temp1 > (float)5))
          {
            temp=temp1;
            Serial.print("Temperature : ");
            Serial.println(temp);
            send(TEMPmsg.set(temp,1));
            SENDstartTemp=millis();
          }
      }```
      posted in Domoticz
      moumout31
      moumout31
    • RE: Send value from Domoticz to MySensor node

      @sundberg84 Thanks for your help.
      It seems to answer my problem, I will try what is done on this topic.

      posted in Domoticz
      moumout31
      moumout31
    • Send value from Domoticz to MySensor node

      Hello,

      I've tried to use the Power Meter Pulse example of MySensors website, but I can't initialize the first kwh value with the current meter index.
      Thus, I would like to send the index manually via Domoticz to initialize a variable in the Arduino sketch of the node.

      Do you know how I can set a value in Domoticz and send it to a MySensors node to store it in a variable please ?

      Thanks in advance for your help.

      Baptiste

      posted in Domoticz
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      @mfalkvidd It's strange... It works with an older version of Arduino software... Thus, the problem is solved ! Thanks

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      @mfalkvidd void receive(const MyMessage &message) is in the code.
      MySensors library is installed, I already use it in other nodes.
      It's strange because it works in another computer...

      The full error messages, in french beacause I'm french are :

      Arduino : 1.8.0 (Windows 7), Carte : "Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"
      
      _02_Main_loop:271: error: 'MyMessage' does not name a type
      
      In file included from C:\Users\Anne-Laure\Documents\Arduino\libraries\arduino_759467/MySensors.h:257:0,
      
                       from C:\Users\Anne-Laure\Dropbox\Maison\A récupérer sur OneDrive\my_teleinfo_light\_02_Main_loop.ino:118:
      
      C:\Users\Anne-Laure\Documents\Arduino\libraries\arduino_759467/core/MyTransport.cpp: In function 'void transportProcessMessage()':
      
      C:\Users\Anne-Laure\Documents\Arduino\libraries\arduino_759467/core/MyTransport.cpp:745:14: error: cannot resolve overloaded function 'receive' based on conversion to type 'bool'
      
         if (receive) {
      
                    ^
      
      C:\Users\Anne-Laure\Documents\Arduino\libraries\arduino_759467/core/MyTransport.cpp:811:15: error: cannot resolve overloaded function 'receive' based on conversion to type 'bool'
      
          if (receive) {
      
                     ^
      
      exit status 1
      'MyMessage' does not name a type
      
      Bibliothèque non valide trouvée dans C:\Users\Anne-Laure\Documents\Arduino\libraries\MySensors : C:\Users\Anne-Laure\Documents\Arduino\libraries\MySensors
      
      Ce rapport pourrait être plus détaillé avec
      l'option "Afficher les résultats détaillés de la compilation"
      activée dans Fichier -> Préférences.
      

      Thanks for your help

      posted in Announcements
      moumout31
      moumout31
    • RE: 💬 Power Meter Pulse Sensor

      Hello,

      First, thanks for this tutorial !
      I used the code defined in tutorial but I have the following message for "void receive(const MyMessage &message)" :

      'MyMessage' does not name a type
      

      Do you know what can be the cause of this error please ?

      Thanks in advance for your help

      posted in Announcements
      moumout31
      moumout31
    • RE: Problem with Serial Gateway equipped with RFM69W and 1st sensor

      Hello,

      I also precise that first I didn't use a level shifter to reduce 5V Arduino to 3,3V for RFM69W pins. Thus when I tried again, I used new RFM69W chips.

      posted in Hardware
      moumout31
      moumout31
    • RE: Problem with Serial Gateway equipped with RFM69W and 1st sensor

      Thanks for your answer. For tests the sensor and the gateway are separated by nearly 4m... I tried to move them but it doesn't work.

      posted in Hardware
      moumout31
      moumout31
    • Problem with Serial Gateway equipped with RFM69W and 1st sensor

      Hello,

      I'm french, so my english might be strange sometimes...

      I use RFM69W to communicate between Arduino Nano Serial Gateway and prototype sensor, based on Arduino Duemilanove.
      As it's written in the title it doesn't work.

      You can see here below the gateway log:

      0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGA--,VER=2.1.1
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSF:WUR:MS=0
      0;255;3;0;9;TSM:INIT:TSP OK
      0;255;3;0;9;TSM:INIT:GW MODE
      0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.1.1
      0;255;3;0;11;Thermostat Meuble NAS-Box
      0;255;3;0;12;1.0
      0;0;0;0;6;
      0;1;0;0;3;
      0;2;0;0;6;
      0;3;0;0;6;
      0;255;3;0;9;MCO:BGN:STP
      0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
      

      And herebelow, the sensor log:

      0 MCO:BGN:INIT REPEATER,CP=RRNRA--,VER=2.1.1
      3 MCO:BGN:BFR
      5 TSM:INIT
      6 TSF:WUR:MS=0
      8 TSM:INIT:TSP OK
      9 TSM:FPAR
      139 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2146 !TSM:FPAR:NO REPLY
      2148 TSM:FPAR
      2278 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4285 !TSM:FPAR:NO REPLY
      4287 TSM:FPAR
      4417 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6424 !TSM:FPAR:NO REPLY
      6426 TSM:FPAR
      6556 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8563 !TSM:FPAR:FAIL
      8564 TSM:FAIL:CNT=1
      8566 TSM:FAIL:PDT
      

      Of course, both have the same MySensors library version (2.1.1, also tested with 2.1.0 and 2.0.0).
      47uF capacitor has been added between 3.3V and GND in sensor and gateway.
      3.3V is provided by Arduino Nano in gateway and Arduino Duemilanove in sensor.
      In order to adapt arduino voltage, an "8 Channel I2C IIC Logic Level Converter Module Bi-Directional for Arduino" bought on eBay is used to convert 5V <=> 3.3V for RFM69W I/O.

      I've browsed forum topics find on Google, but nothing works.
      Of course, I've started by following the page "Debugging Sensors and the Gateway"

      I've just made a strange observation, when I connect the sensor and the gateway on my computer USB, if I connect or disconnect the gateway USB from my computer, the LED "L" on my arduino duemilanove (sensor) blinks several times before recovering its initial state.

      Could you help me please ?

      If I can give you more informations, do not hesitate.

      Thanks in advance for your help !

      posted in Hardware
      moumout31
      moumout31