Document toolboxDocument toolbox

Measuring analog data with the RevPi AIO module

If you want to measure analogue data using a RevPi AIO Module quick and easy, this article is right for you.

Background

You need a PiCtory configuration, take a look at this useful checklist.
https://kunbus-gmbh.atlassian.net/wiki/spaces/KS/pages/2696544359

Sampling

  • In general, the Nyquist-Shannon sampling theorem should be considered. In short, you need at least twice the sampling rate to recalculate your original signal.

  • RevPi AIO Module: According to the datasheet of the RevPi AIO Module …

… fastest input conversion time is 8 ms – but you also have the PiBridge cycle.

  • PiBridge: So what’s behind the suspicious 1 PiBridge cycle?

This is the amount of time needed to collect and transfer all data from the IO modules to the process image.

You may read this value out in milliseconds, not rounded like so:

pi@RevPi39627:~ $ piTest -1 -r RevPiIOCycle 1 Byte-Value of RevPiIOCycle: 3 dez (=03 hex)

My system is configured using a RevPi Connect 4 and an AIO Module, so it is a 3.

So the worst case, the cycle time equals 3.9 ms.

But another thing to have in mind is that you might lose one cycle. Thus, the worst case is 2·4ms = 8ms.

So, as it is equal to the 8 ms conversion time, the latency of the PiBridge does not influence the AD conversion.

Please check this value on your system configuration.

Measurement

Why don't you try it simply via "piTest"? I.e. my variable is called I_1 you have to adapt this:

pi@RevPi39627:~ $ piTest -1 -q -r "I_1" 0

You can do this as fast as possible with a loop – you may cancel the execution via [STRG] + [C].

pi@RevPi39627:~ $ while true; do date -Ins; piTest -1 -q -r "I_1" ; sleep 0.001; done 2023-07-09T13:46:33,154724429+02:00 0 2023-07-09T13:46:33,171606479+02:00 0 [...]

Verwandte Artikel