millis() problem

Hi all,

i start playing with my arduino and im writing the simply code, where i measuring the AC current.

I will made the automatic protection for water pump. If water thank is empty the pump have less resistance and the current is lower. I will measuring current and if procesor will check that current is low enough, he sey stop the pump.

There i have the problem with millis() function. In may code i have two parameters which must be finished that my if statement is procesed :

If(my current > 4.2 && time is more than 4 seconds)
{
turn off
}

i dont know how properly use millis that will count me time if current is hire than 4.2 A.

thanks for all

i dont know how properly use millis that will count me time if current is hire than 4.2 A.

You need to record when the current becomes higher than 4.2 whatevers. Look at the state change detection example. That specifically refers to digital pins, but the concept works for analog pins.

Miha_Oblak:
I will made the automatic protection for water pump. If water thank is empty the pump have less resistance and the current is lower.

This is fine in theory. Have you done any experiments to prove that it works in practice?

I would much prefer a system based on float switches.

…R

I would much prefer a system based on float switches.

Especially if there is any priming the pump involved

Hi everyone,

first thank for all replays.
I already measure a current and it works fine. I have a test "track", where i regulate voltage with variable transformer and for resistive load i use electrical heater.
After the current is low enough my reley brake the circuit. When the reley is turn on i must press the button to restart whole proces (i will do that when the water tank will be full).

problem is that when i detect the current which must stop proces the system i wont to wait few second, if the curren in mean time go to normal value nothing is happened, but if after this time the current still on level for stop proces sistem is shut down.

the system based on float switches is fine, but more complicated if you have the water tank far from house :slight_smile:
My system you can put in a little box and plug in electrical instalation next to pump and it must work :slight_smile:
It is little primitive method but i think that it must work fine.

If anyone have some advice or solution it will be very helpful.

later i will pick some pictures to show whole projects.

best regards.

Miha_Oblak:
I already measure a current and it works fine. I have a test "track", where i regulate voltage with variable transformer and for resistive load i use electrical heater.
After the current is low enough my reley brake the circuit.

I am not an expert but I don't think that is a suitable experiment to prove that you can detect an overloaded AC motor before damage is caused. Resistive loads are very different from motors.

...R