Analog Input Totaliser

Topics about the Software of Revolution Pi
Post Reply
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Analog Input Totaliser

Post by f.fallon »

Hi,
We have the Revolution PI Digital and Analog input/output modules. We want to take an analog value from a device and totalise its value over time, is this possible?

Kind Regards,
Frank
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Analog Input Totaliser

Post by volker »

hi Frank,
what exactly do you mean by "totalize" an analog value? Would you like to integrate it over the time (e.g. getting the energy by integrating the power over the time)? This will work fine in an application program (python, C, Node.Red) as long as the signal variation is slow compared to your integration loop cycle time. The PiBridge will give you a chance to get a value about every 10 ms. The Analog input circuit and ADC can be configured to be much faster. Your application software loop should have no problem to cycle with 100 Hz (10 ms). So if the signal contains frequencies higher than 50 Hz (-> Nyquist theorem, 1/2 sample frequency) you might end up with complete wrong values. But if your signal frequency's spectrum contains only slower values you could configure the ADC to clock slow and us e a low pass filter with frequencies well below your cycle time (like 10 Hz?) this would result in a very precise measurement every 10 or 20 ms and if you use a clock source with enough precision your time integral then should also be precise. Just let me know your exact use case and what kind of signals you want to analyze and i could possibly add more ideas.
Unser RevPi Motto: Don't just claim it - make it!
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Re: Analog Input Totaliser

Post by f.fallon »

Hi Volker,

Thanks for your reply. I have since moved on to using a digital input instead which pulses every X times (can be set) every period so every time we read a 1 we can multiply that by what that pulse represents. Its a flow meter and we have it set to pulse every 50L, based on the flow on our testing that was most suitable. Just another question while we are talking about the Input cards. Is there a Java library to which we can make applications for or is that planned for the future?

Kind Regards,
Frank.
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Analog Input Totaliser

Post by volker »

No lib necessary as the access to the process image with all values is done by using Linux file access commands which are available in all programming languages:
open, seek, read, write...
Alternatively you can also call Linux command shell execution from JAVA (which I e.g. do from Node.Red) and use the piTest command to set or retrieve any data from the process image (but that is consuming much more performance).
Unser RevPi Motto: Don't just claim it - make it!
Post Reply