Measure analog Voltage drop on a pin while timing that V-drop and trigger action


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.

Kind Thanks,

F28 Driver
North Carolina

That’s not an objective, that’s what you’re doing. Most importantly, you told us absolutely nothing about what you’re trying to achieve. What’s the end result you’re looking for? The BIG picture, please, not the microscopic bits and pieces.

Another issue with your post is that you’re not asking for anything specific in the way of help - which will get you the same in return, nothing specific. If you have questions about code, you [u]always[/u] post your code. Posting an explainion about your code without the actual code is well, pointless.

You also need to explain how you’re reading 3.5 to 4.5 volts on a Teensy 3.6 without it blowing up.

BTW, this should probably be in Project Guidance as it is more appropriate and receives more views. If you want it there, you have to ask a mod to do that. Click on the report to moderator and ask.

B) Does my description of my objective make sense?

None what so ever.

It only makes sense to you because of all the things you know in your head. Please share what you are trying to do and how you are trying to do it.

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.

It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Are you trying to measure time constants in a capacitive circuit?

If you tell us the application, then we may be able to help you better.

What model Arduino are you using?

Thanks.. Tom.. :)