-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce DEVICE/realtime topic for better realtime reporting #1096
Comments
What about using a scripting system to force publish single large packet with all data every 0.25 seconds? |
0.25 is extremely slow... how about every 0.01 seconds? Will scripting be able to deal with that frequency? |
I'm sorry; of course, this is naturally true, and it's subject to the limitations of the hardware. What I'm getting at here, is that I don't want the device software to be the limiting factor under any circumstances. I want a deliberate and documented feature which I can rely on to report data at the highest possible sample rate, and with no resolution truncation. I wonder what chips my modbus meters are using; they update at a decent rate (~50ms, apparently limited by 9600 baud rate). I never pulled one apart... they're kind-of expensive.
Really? That Tuya chip is that slow? Can it be polled at a higher rate? What about the direct IO connected chips? Surely the software reads from the chip directly? In that case, it's subject to the maximum polling rate of the chip, which I imagines would be milliseconds, although you show it's 400-800ms in the datasheet above :( Well, it may be the case that my work doesn't map to any of these devices... but I have a whole bunch of them, and I thought I might as well attempt to use them for testing. |
Thinking on it; you know the software and the hardware, and you probably know what's best. So ignoring my suggestion, here's the goal: Can I be confident that the software is internally sampling at the maximum possible rate that the hardware supports in all cases? |
Can you please tell me what is your end goal with that? What do you want to achieve with this frequent sampling? What are you doing later with that data? WiFi in general is not recommended for that kind of applications and those chips are not optimized for that. Futhermore, no one does "report at the maximum possible frequency" because it saturates the network quickly, always only the changes are reported. |
FFT's and other time based event/feature analysis. I mean, I change what I'm doing with it every day as I work on different ideas.
You're right, and it would be ideal if the reports were accompanied with a hardware timestamp! I've been thinking about this, but I haven't made a post regarding that yet :P .. I wanted to measure the jitter in report time to determine how much noise the wifi latency introduced, or if the latency was at least fairly consistent. I felt like I need to work through the initial problem that reports are like 5-10 seconds apart at best... network jitter is irrelevant if several seconds between reports is the best I can get. I'm playing wit the tuning options now...
Sure, changes are fine... although even the maximum possible rate would definitely not saturate the network, since these devices have sample rates that barely approach kilobits per seconds let-alone megabits per second. |
Why would you want to run FFT on RMSs values that are sent over the WiFi? What is the application of that? As far as I know, in order for FFT to give any meaningful results, you would need to use high-speed ADC directly on the AC wave. |
There are loads of forms of feature detection, I have observed several devices with detectable operating signals measuring RMS fluctuation. Devices with particular duty cycles are easily visible watching RMS that way. I have seen some devices that phase between active power and reactive power; if I see the same frequency present in both signals, then I can determine that feature with decent confidence. 400ms samplerate might be too crude to measure it, but with a long enough signal, the frequencies might appear amplified. My reference device measures at 20hz. I'm just trying some other meters for experimental sake, and that lead me here. I started sticking all the meters I have laying around on all the circuits I can find just to record heaps of data. Incidentally, I've set Should I be alarmed that the config also notes powerfactor ~1.7? Something's very wrong there... I calibrated the device as best I knew how. |
I'm not looking for AC waveform features, need an oscilloscope for that! More like duty cycle features. Try it! Sample some data at a decent resolution and twiddle with it in matlab... there's lots of ways I've found visible features that I think can be refined into reliable fingerprints. RMS signal isn't steady. At very least, they're pretty noisy. In some cases, the noise itself seems to have some structure that's not immediately apparent, and I'm becoming convinced that some of that noise isn't just measurement error. It's really useful to have the reactive signal aswell... active power doesn't tell the whole story. This device I'm playing with now is BL0942, it's reporting just a little more than twice per second. Possibly the 400hz that the hardware reference mentions? I'm not sure how I'm seeing updates at that rate considering the code snippet you show here... |
I just measured it rather than guessing. It does seem to be about 1hz samplerate on average. I see a bit of jitter though, and some samples arrive closer together which made me think the samplerate must be higher. Can we consider that 1s timer a bug? |
Here's another odd behaviour; every 6th second it seems to report |
Feature suggestion
Cross posting to a new issue, since the other place I wrote this is really discussing a different issue.
For reference; I need high quality realtime monitoring of sensors. I'm writing monitoring software which can identify and isolate individual devices present on a circuit by identifying their signatures during operation. To build these signature profiles, I need high resolution raw data, otherwise the signatures are very poor. This allows pseudo-monitoring of individual devices connected to power outlets with just a single meter on the circuit.
Many classes of devices are very easy to identify by their particular waveforms of real and reactive power; things with pumps like fridges, air con, induction cookers, specific tools in the workshop, etc, relatively easy to infer with a high resolution signal.
These devices are realtime raw data sources; the software running on the device itself shouldn't limit the way it's used. The data should be accessible at the highest resolution that the device can record.
Maybe MQTT isn't the best protocol for realtime monitoring... my other modbus-based devices poll at ~20hz (report every 50ms), and I consider that slow (limited by RS232 at 9600bps, much lower than ~100mbps!). It'd be much more useful to have a connection to these devices with an active data stream which just pushed data the instant it samples it, at the same frequency that it samples.
Short of new protocol development, without changing the behaviour of these devices as they are, I can suggest a method for improving realtime usage. To achieve this within MQTT, here's what I think might work well:
DEVICE/realtime
DEVICE/realtime
more-or-less immediately for every hardware sample in realtime (or some specified rate) and include all recent raw samples. Include in the message all topic+value pairs that changed since the last report as native resolution.I reckon this could be implemented while leaving all other implementation details as they are, just an additional option to enable
DEVICE/realtime
reporting and some associated frequency config values.The text was updated successfully, but these errors were encountered: