# Implementation of differentials

Hey guys

I am new here and I have bought a mega2560. The scenario is: I am providing voltages to some display. First I need to find the differential of the voltages with respect to time and continuously having a check on the value of dV/dt if it is near to zero. If it is near to zero then I stop supplying the voltages. Can some body provide me guidance how I can implement the dV/dt or any link highly appreciated.

Hassaan

Hassaan: Can some body provide me guidance how I can implement the dV/dt or any link highly appreciated.

Read the voltage at two points in time. Then dV is the difference between the two readings; dT is the time interval between them. The arithmetic to divide one by the other is trivial. If you plan to do this as an ongoing process then you would read the voltage at regular intervals (see blink without delay for an example of controlling the timing of this) and compare each new reading with the preceding reading. You will probably need to apply a little smoothing to the output. One way to achieve that would be to use an exponential decaying average.

Thanks a lot Peter for response. I have some question related to your reply.

see blink without delay for an example of controlling the timing of this

Are you referring to some example here which is already done. Can you exactly tell me where is that? and also this:

You will probably need to apply a little smoothing to the output

Thanks

Blink-without-delay is an example in the IDE… Go File> Examples> Digital.

It uses millis() to give you the time since reset whenever you need it. So you can take a time at event a, another at event b, and of course the difference is the elapsed time between the two events.

Must say, I’m not sure what you’re trying to achieve though… what’s proving the voltages?

Thanks again.

Yeah there is an example for that what you have mentioned.

By have a dV/dt approximately to zero will stop the supply voltages to a display. I need to calculate the dV/dt continuously until it reaches ~0. then stop the supply.

thanks

There is no reason to calculate "dv/dt", simply measure voltages sperated by a resonable time, as set by the millis command, and act when the voltage difference from the last voltage reading and the current one is as low as you want.

As pointed out, you may want to average the last two or three readings to eliminate noise.