Output to react change in analog signal voltage drop

Hello,

Im quite a noobie in this arduino world and have problem figuring out how to get the output to turn on for set time if signal voltage drop speed is fast enough, for example from 5v to 2.5v in 500ms and then output would turn on for 1000ms.

Also this only needs to happen if the voltage drops, not if it comes up from 2.5v to 5v in 500ms.

Is this possible to be made with arduino?
Im completely lost how this could be achieved.

I hope someone understands and is able to give little help :slight_smile:

-OJ

Using the millis() (and micros()) functions to control timing is shown in the blink without delay example (in the IDE, File, Examples, Digital) and the several things at a time post by Robin2.

OssQ:
Is this possible to be made with arduino?

Yes, it looks as if an Arduino like UNO can do the job easily.

An UNO can sample an analog voltage signal by using the analogRead() function in roughly 120 microseconds, which results in something like 8 voltage samples within one millisecond you are able to take.
Sof if your timings are in the hundreds of milliseconds, it's surely possible to react on voltage changes as you want it.

One technique for writing code is to put the sequence of events in the form of comments. When that all looks correct then add the code in front and leave the comments in place.

// if something wrong
// { 
// raise red flag
// yell fire
// }
// else if something right
// {
// raise green flag
// open a beer
// }
// else
// {
// i'm confused, try again
// }

Differentiate and then low-pass filter?

Thanks a lot guys for these :smiley:
I will start working on this and I think I can now make this work!

-OJ