Skip to main content

I'm building a control system for three sump pumps using a single Arduino and a set of relays. I have float sensors for each one, and need the Arduino to trigger the relays when the float sensors are triggered. Sensor 1 triggers pump 1, sensor 2 triggers pump 2, etc.

Simple enough, but I also need each pump to remain on for 30 seconds after its float sensor returns to normal. This throws me for a loop since I need the other pumps and sensors to function during this delay time. I quickly found that the blocking delay() function is no longer feasible.

How can I trigger the relays, keep them on for 30 seconds after the sensors return to normal, but all the while still monitor and control the other sensors/relays? Would a non-blocking timer solution work? Would I have to delve into interrupts?

Thanks in advance!

I'm building a control system for three sump pumps using a single Arduino and a set of relays. I have float sensors for each one, and need the Arduino to trigger the relays when the float sensors are triggered. Sensor 1 triggers pump 1, sensor 2 triggers pump 2, etc.

Simple enough, but I also need each pump to remain on for 30 seconds after its float sensor returns to normal. This throws me for a loop since I need the other pumps and sensors to function during this delay time. I quickly found that the blocking delay() function is no longer feasible.

How can I trigger the relays, keep them on for 30 seconds after the sensors return to normal, but all the while still monitor and control the other sensors/relays? Would a non-blocking timer solution work? Would I have to delve into interrupts?

Thanks in advance!

I'm building a control system for three sump pumps using a single Arduino and a set of relays. I have float sensors for each one, and need the Arduino to trigger the relays when the float sensors are triggered. Sensor 1 triggers pump 1, sensor 2 triggers pump 2, etc.

Simple enough, but I also need each pump to remain on for 30 seconds after its float sensor returns to normal. This throws me for a loop since I need the other pumps and sensors to function during this delay time. I quickly found that the blocking delay() function is no longer feasible.

How can I trigger the relays, keep them on for 30 seconds after the sensors return to normal, but all the while still monitor and control the other sensors/relays? Would a non-blocking timer solution work? Would I have to delve into interrupts?

Tweeted twitter.com/StackArduino/status/700897971689418752
Source Link
Darkhand
  • 21
  • 1
  • 2

Multiple non-blocking countdown timers?

I'm building a control system for three sump pumps using a single Arduino and a set of relays. I have float sensors for each one, and need the Arduino to trigger the relays when the float sensors are triggered. Sensor 1 triggers pump 1, sensor 2 triggers pump 2, etc.

Simple enough, but I also need each pump to remain on for 30 seconds after its float sensor returns to normal. This throws me for a loop since I need the other pumps and sensors to function during this delay time. I quickly found that the blocking delay() function is no longer feasible.

How can I trigger the relays, keep them on for 30 seconds after the sensors return to normal, but all the while still monitor and control the other sensors/relays? Would a non-blocking timer solution work? Would I have to delve into interrupts?

Thanks in advance!