I need to measure voltage drop on a pin as soon as the loop begins. Voltage resolution monitored is X.XX and is displayed as a 3 digit int (XXX) in the serial monitor. The voltage range is 4.50v to 3.50v. the value of 3.50 is used as a final value, and monitoring is no longer required at levels below the 3.50 volt value.
Empirical tests with a voltmeter on my loaded project now show approximately 0.20 volts (020v) per hour <0.20v per 3,600,000 millis>.
Thus, the loop (or function) starts by measuring analog voltage and begins timing. It will continue monitoring voltage (and running time) until the voltage drops by 0.01 volts (001).
At the moment that the new (stop) voltage is (001v) less than the higher (start) voltage, calculate the time between the start of timing (“start voltage”) and the the end of timing (“stop voltage”).
When the voltage has reached (start voltage - 001), I need to know the elapsed time. There can be (usually) 100 total incremental voltage drops. On occasion, starting voltage could be higher based on tolerance of components and thermal conditions. Start voltage is not as important as knowing how many (001) count increments remain before the min value of 3.50 is reached.
Therefore, (increments remaining to 350) * (elapsed time of most recent increment) will provide an int value in millis and converting that to a more recognizable value of minutes, will be used as output ultimately on a display.
A) If a moderator would review my objective, and if not posted in the correct forum, please guide me to the proper area.
B) Does my description of my objective make sense? Do I need to provide more information?
If I am in the correct forum, I will post complete code and //comments (less than 50 lines).
I am currently cleaning up the current version^16 :o …to include comments that are concise for someone looking at my code for the first time.
Thanks for letting me open the door on this issue. I have been spending hours each evening after work
trying to control this mess by calling functions, limiting variables to local, and almost countless other failed methods. While I have not learned the answer yet, I have gained invaluable knowledge (no, not about what doesn’t work), but I have gained better knowledge of “what I thought I already understood”.
I am using a Teensy 3.6 in development of my project.
I will post code and comments if this has landed in the correct forum.