You are here

Experiments with high resolution sampling

1 post / 0 new
Last seen: 1 year 6 months ago
Joined: 2021-06-14 08:52
Posts: 3
Experiments with high resolution sampling


I've been looking into ways to extract more accurate measurements from the VESC 6 MkV, for experimentation purpose. The idea is to establish a timer interrupt for this new sampler. Setting it to run with for example 1ms or 10us intervals. Where the experiment is conducted with a duration between 5 to 30 seconds, or more. (30000 to 3000000 samples for 10us sample time). Storing the values in each their predefined array of static length (more efficient with static length). Where one value we store is the time difference of when experiment started and at the point of sample. At the end of the experiment we either dump the data to "Experiment"-plot in VESC Tool or print the data to the VESC terminal (in .csv-file style) which is copied and pasted. Let's say I want to store 10 different values as floats (4 byte). For 3 million samples this would yield a total need of 120Kb of memory, which isn't much for the STM32.


This seems to be a better solution for experimentation on the bench, than the already existing sampling with "Experiment" plotter. Which has a dynamic sample time of between 1ms to 10 ms as it is implemented with threads (maybe good solution to implement with a time interrupt). And the "Log" plotter, which plots to a .csv-file (and not easily customizable) uses the computer as a time stamp. Which is not ideal as the sample time is affected by the communication delay over USB.


The only problems I see needed to be investigated are the limit of number of samples which can be stored, before dumping the data to an external computer. And how fast can we sample without affecting the other threads and interrupts in the system.