Hello Arduino forum,
I am trying to use an arduino to measure a input voltage and integrate it with respect to time to get the behavior of an integrator. I would like to specify a RC time constant that would mimic the behavior as it charges. Eventually I would also like to have it decay as well, but this is for later.
I am having trouble figuring out an intelligent way to keep track of the voltage at a specific time. The arduino I am using has a maximum resolution of 1 kilo-Samples per second. My first thought was that after each voltage measurement there is some sort of counter that adds to a time variable, however I am not sure how to couple the voltage sampling rate with updating some time variable. Once I have the voltage associated with a specific time, I then have to find an intelligent way to integrate it with respect to said time.
Any suggestions and/or sample code would be greatly appreciated!
I am using: Arduino nano input voltage to analog pin A0 Windows 7