🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Accurate timesource / loop execution time?

    UIFlow
    1
    1
    270
    Loading More Posts
    • 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.
    • H
      honkkis
      last edited by

      Hi,
      I'm developing (UiFLow2, Core2) powermeter/energy counter for wood fired boiler. So far, I've been able to create required hardware, read the sensors using ADC and digital input, but because it's powermeter, it needs exact timekeeping to count generated energy and power accurately. My software has five conditions in main loop for different states of boiler and only one of them is energy generating, other are warming up, cooling down etc...

      I think there are two options for calculating energy and power:

      1. loop that lasts exactly known time, preferably one second (1000ms) or

      2. loop lasting artificial time and time period is measured (this can be below one second, or slightly more, even variable)

      For the accuracy requirement, for option one it's not catastrophic to have, say 3590...3010 measurements in hour, but for example 2972 would be terrible accuracywise. For option two, still hoping to get measurement about every second. There are three purely analog temp sensors and two digital inputs, conversion times shouldn't be problem.

      Is 1000ms timer (UiFlow2 Timer) right tool for this, or timedelta (UiFLow2 Time / ticks)? This should be very easy, if loop execution time is known. Doucmentation for UiFlow2 still need improvements (compared to UiFlow1). I know this ain't running on RTOS, but still want it to be as accurate as possible.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post