nDenerserve / SmartPi

Opensource Repository of SmartPi
62 stars 37 forks source link

Sampling Frequency #117

Open BecsLutton opened 3 years ago

BecsLutton commented 3 years ago

Hi,

I need to measure power consumed at a rate of 10Hz. Before buying the SmartPi I wanted to check the documentation/specs but can't find relevant information anywhere as to how configurable the software is.

Can the SmartPi sample at a rate of 10Hz?

SuperQ commented 3 years ago

In theory, you could modify the sampling loop to skip some of the slower measurements, for example frequency. IIRC the current/voltage measurements can be done that fast.

The main problem is the chip is not configured or calibrated for watt-hour counting.

So it depends on what you really want to get out of the data.

BecsLutton commented 3 years ago

Ok thart's good to know actually. My intentions are to replicate an experiment in a journal article whereby an academic monitored the power consumption of an individual part production process. Being able to detect power consumed duing specifc processes such as facing and hole drilling etc is the goal.

Does the software offer the ablity to watch the power consumption live in a time series manner or can I only access the data via batch downloads and additional data processing?

Basically, I am asking, from what I have described as my goal, would the SmartPi be a good choice? I will be writing up the project as well so others can do the same if they so wish.

SuperQ commented 3 years ago

The software can write samples out. There are a few options for this. I use Prometheus, but I'm only doing 1hz data. For this high-res use case, I might recommend the InfluxDB output, as it's more designed for streaming.

Doing what you're thinking about will require a bunch of modifications and re-working to make the data flow better. Right now it's a bit static and hacky.

https://github.com/nDenerserve/SmartPi/pull/113 is a first attempt at making the polling frequency more dynamic. But I'm not sure it's the correct approach.

BecsLutton commented 3 years ago

I am already using influx and is one of the attractions of the SmartPi. I am using opcua to collect data from the CNC machine, pushing to a Mosquitto broker and then using telegraf to subscribe to my machine data and ingest to influx. From there I also use Grafana for dashboarding (although the recent Influx upgrade to v2 means I use this less as their API is quite nice). The fact that I could pretty much do the same thing with the SmartPi and therefore have CNC machine data like spindle speed and tool load together with the power consumption was...IS a huge attraction.

My problem is I am not a software or hardware engineer, just a manufacturing engineer who is dabbling in the IoT space means that I am a little nervous about altering code and/or hardware registers etc. Also the fact that I don't see any user manuals or guides for the software use makes me a little worried. I don't know what to expect when I receive the device. I found a manual that was in German and I translated it to English but it's only a setup guide for the hardware and where to download the software; there was no explanation of how to configure anything like MQTT or the amendment of the code to skip frequency measurements etc.

Is there anything out there that I have missed or is this Github the 'only' source of info for me?

SuperQ commented 3 years ago

Basically, what you see in GitHub is what there is. Changing the code to adjust the sampling frequency is going to take some real effort, it's not just a simple one-line code change right now.

BecsLutton commented 3 years ago

Ok that's fair enough.

Say I forego the 10Hz readings and opt instead for 1Hz. That is already the default setting? I'm just thinking about getting the SmartPi and getting it up and running asap to show my bosses what it can do and then in the meantime attempting to amend the samplig frequency. I thnk it's really cool and would very much like to give it a go but am concerned it's perhaps not intuitive to use and or doesn't have GUI experience to help noobs like me who aren't really sure what they are doing :)

SuperQ commented 3 years ago

Yup, 1hz is already the default. There is a GUI for configuration, but I haven't used it myself. I don't use much of the associated tools, just exporting the 1hz data to Prometheus.

From what I remember, Prometheus and MQTT are updated every 1hz, InfluxDB output is only updated every minute.

BecsLutton commented 3 years ago

Excellent, going to go for it. Of course this deliberation has been long enough for the SmartPi to go out of stock lol. Hopefully it comes back in soon!

Thank you very much for all your help!