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. Development
  3. Pulse Sensor for electricity sketch question

Pulse Sensor for electricity sketch question

Scheduled Pinned Locked Moved Development
3 Posts 2 Posters 722 Views 2 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.
  • Bert BroekB Offline
    Bert BroekB Offline
    Bert Broek
    wrote on last edited by
    #1

    Hi,
    i have a question about the example sketch Power meter Pulse sensor.
    I hav it all working now but the KWH total count is off.
    I have figured out that my meter has a pulse count of 187,5 blinks/kwh.
    so i changed the value of #define PULSE_FACTOR 1000 to 187.5.

    but it seems the arduino is rounding this number to 187, so my total kwh will be off.
    i think it is because of a float/int messup.
    how can i correct this?

    i was thinking of counting every pulse twice and then set the pulsefactor at 375.
    Maybe there is a other easy way around??

    Kind regards,
    Bert.

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

      The example sketch uses double for kwh so it shouldn't have problems with 187.5. Are you sure that's the problem?

      1 Reply Last reply
      0
      • Bert BroekB Offline
        Bert BroekB Offline
        Bert Broek
        wrote on last edited by
        #3

        I think the result is a floating point number but the divider isn't. I'm going to rewrite the formula so it matches my old sketch which was working correctly.

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


        18

        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