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. Announcements
  3. 💬 Power Meter Pulse Sensor

💬 Power Meter Pulse Sensor

Scheduled Pinned Locked Moved Announcements
183 Posts 40 Posters 45.0k Views 37 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.
  • gohanG gohan

    @sundberg84

    Instead of the 10k resistor, do you think I could use a potentiometer to "adjust" sensitivity? I would like to avoid messing up the readings with lights entering when opening the cabinet door where the meter is located

    @flopp
    Do you mind sharing your wiring? 940nm, isn't it infrared?

    sundberg84S Offline
    sundberg84S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by
    #61

    @gohan - a potentiometer is just a variable resistor so why not? Good idea if you have one laying around.
    As i said before though, the try with the transistor is just a try - im not that good with transistors yet and dont know how they work exactly. After this i read somewhere that the base resistor should be bigger to protect the transistor... dont know how to calculate that.

    Controller: Proxmox VM - Home Assistant
    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

    1 Reply Last reply
    0
    • gohanG gohan

      @sundberg84

      Instead of the 10k resistor, do you think I could use a potentiometer to "adjust" sensitivity? I would like to avoid messing up the readings with lights entering when opening the cabinet door where the meter is located

      @flopp
      Do you mind sharing your wiring? 940nm, isn't it infrared?

      F Offline
      F Offline
      flopp
      wrote on last edited by flopp
      #62

      @gohan said in 💬 Power Meter Pulse Sensor:

      @sundberg84

      @flopp
      Do you mind sharing your wiring? 940nm, isn't it infrared?

      I connected the photo resistor directly to the LM393.
      I don't know if that is IR.

      1 Reply Last reply
      0
      • moumout31M Offline
        moumout31M Offline
        moumout31
        wrote on last edited by
        #63

        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

        mfalkviddM 1 Reply Last reply
        0
        • moumout31M moumout31

          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

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by mfalkvidd
          #64

          @moumout31 do you have void receive(const MyMessage &message) somewhere in your code or where does it come from?
          Could you post the full error message?

          Have you installed the MySensors library?

          moumout31M 1 Reply Last reply
          1
          • mfalkviddM mfalkvidd

            @moumout31 do you have void receive(const MyMessage &message) somewhere in your code or where does it come from?
            Could you post the full error message?

            Have you installed the MySensors library?

            moumout31M Offline
            moumout31M Offline
            moumout31
            wrote on last edited by moumout31
            #65

            @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

            mfalkviddM 1 Reply Last reply
            0
            • moumout31M moumout31

              @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

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #66

              @moumout31 My guess is that MyMessage is defined in your sketch, overriding the definition in the MySensors library. Could you post your sketch?

              moumout31M 1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @moumout31 My guess is that MyMessage is defined in your sketch, overriding the definition in the MySensors library. Could you post your sketch?

                moumout31M Offline
                moumout31M Offline
                moumout31
                wrote on last edited by
                #67

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

                1 Reply Last reply
                0
                • moumout31M Offline
                  moumout31M Offline
                  moumout31
                  wrote on last edited by
                  #68

                  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

                  gohanG F 2 Replies Last reply
                  0
                  • moumout31M moumout31

                    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

                    gohanG Offline
                    gohanG Offline
                    gohan
                    Mod
                    wrote on last edited by
                    #69

                    @moumout31
                    could it be getting some light from another source?

                    moumout31M 1 Reply Last reply
                    0
                    • moumout31M moumout31

                      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

                      F Offline
                      F Offline
                      flopp
                      wrote on last edited by
                      #70

                      @moumout31
                      I had same issue, check here for my solution
                      https://forum.mysensors.org/topic/4716/two-energy-meter/4

                      1 Reply Last reply
                      1
                      • Fat FlyF Offline
                        Fat FlyF Offline
                        Fat Fly
                        wrote on last edited by
                        #71

                        Hei.

                        How to connect arduino to electricity meter pulse out. Not to led.

                        1 Reply Last reply
                        0
                        • gohanG gohan

                          @moumout31
                          could it be getting some light from another source?

                          moumout31M Offline
                          moumout31M Offline
                          moumout31
                          wrote on last edited by
                          #72

                          @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

                          F 1 Reply Last reply
                          0
                          • moumout31M moumout31

                            @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

                            F Offline
                            F Offline
                            flopp
                            wrote on last edited by
                            #73

                            @moumout31
                            Yes correct.
                            When I checked with Serial Monitor and some serial.print in different places I could see that arduino registered double interrupts

                            moumout31M 3 Replies Last reply
                            0
                            • F flopp

                              @moumout31
                              Yes correct.
                              When I checked with Serial Monitor and some serial.print in different places I could see that arduino registered double interrupts

                              moumout31M Offline
                              moumout31M Offline
                              moumout31
                              wrote on last edited by
                              #74

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

                              1 Reply Last reply
                              0
                              • F flopp

                                @moumout31
                                Yes correct.
                                When I checked with Serial Monitor and some serial.print in different places I could see that arduino registered double interrupts

                                moumout31M Offline
                                moumout31M Offline
                                moumout31
                                wrote on last edited by
                                #75

                                @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 !

                                1 Reply Last reply
                                1
                                • F flopp

                                  @moumout31
                                  Yes correct.
                                  When I checked with Serial Monitor and some serial.print in different places I could see that arduino registered double interrupts

                                  moumout31M Offline
                                  moumout31M Offline
                                  moumout31
                                  wrote on last edited by
                                  #76

                                  @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 !

                                  F 1 Reply Last reply
                                  0
                                  • moumout31M moumout31

                                    @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 !

                                    F Offline
                                    F Offline
                                    flopp
                                    wrote on last edited by
                                    #77

                                    @moumout31
                                    Watt calculation is using time between two interrupts.
                                    How often do you send watt?
                                    Did you measure watt with a measurement tool How did you get 500 watts from power meter?
                                    When you send watt you need to measure exact same second otherwise it will not be correct.

                                    moumout31M 1 Reply Last reply
                                    0
                                    • F flopp

                                      @moumout31
                                      Watt calculation is using time between two interrupts.
                                      How often do you send watt?
                                      Did you measure watt with a measurement tool How did you get 500 watts from power meter?
                                      When you send watt you need to measure exact same second otherwise it will not be correct.

                                      moumout31M Offline
                                      moumout31M Offline
                                      moumout31
                                      wrote on last edited by
                                      #78

                                      @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.

                                      1 Reply Last reply
                                      0
                                      • NiklasON Offline
                                        NiklasON Offline
                                        NiklasO
                                        wrote on last edited by NiklasO
                                        #79

                                        Just changed from 1-wire counter to MySensors for logging my power consumption. Using the same LED detector as I did when using 1-wire. Also changed watt limit to 20 000 (my heat pump likes to use 9-10kW sometimes). The wires from the old 1-wire net now provide power for the new MySensors-sensor. I have 10 000 led blinks per kWh. Had som crazy counter values with 1-wire that totally messed up the graphs and haven't seen anything like that with this sketch. Let's hope it stays that way. ;) Dumping data to Domoticz. This sensor gives me higher resolution as a bonus. The 1-wire counter was read every minute, this every 20-sec. ;-)

                                        0_1490286464866_Domoticz_-_Google_Chrome_2017-03-23_17-27-32_78641890.png

                                        0_1490286540285_Domoticz_-_Google_Chrome_2017-03-23_17-28-46_94994234.png

                                        My old 1-wire counter with one crazy value messing upp all the graphs:
                                        0_1490286637201_Domoticz_-_Google_Chrome_2017-03-23_17-30-09_29365468.png
                                        I know that you can hold shift and click the value that is crazy to make the graphs show up good but you loose the data for the full day. That's not good. ;-)

                                        henninneH 1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          Samuel235
                                          Hardware Contributor
                                          wrote on last edited by
                                          #80

                                          I seem to be getting a connection to my gateway, while monitoring the two topics for the gateway i only seem to see any activity regarding this sensor on the gateway-out topic, and it keeps sending out a type 2 message (req). The serial monitor of the sensors is showing:

                                          104198 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          114199 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          124200 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          134201 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          144202 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          154203 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          164204 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          174205 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          184206 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
                                          194207 TSF:MSG:SEND,16-16-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:

                                          So it seems to be sending a request package, but i don't see it on the gateway-in topic and i see other sensors sending data to the gateway-in topic so i'm not subscribed to the wrong one. Is this a structural request message or is this the feature that requests the last known message from the gateway? Either way, there doesn't seem to be any sensor data being sent from the node to the gateway.

                                          MySensors 2.1.1
                                          Controller - OpenHAB (Virtual Machine)
                                          Gateway - Arduino Mega MQTT Gateway W5100

                                          sundberg84S 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