Medical Emergency

Dear Forum Members,
Thank you for your attention. I need some help with programming.
I have a relative who is in the final stages of suffering from motor neurone disease and who is now physically unable to operate conventional switches.
The requirement is for him to be able to operate a medical suction pump from the single press of a special ‘soft-button’ which is large and requires very little operating force. The pump will then run and turn off after one minute. If the button remains pressed, the cycle will repeat until the button is released.

The main complication to using a simple interval timer is that the power to the pump is to be provided by a wireless controlled mains socket which requires separate ON and OFF commands (currently via two discrete pushbuttons on the supplied commander).
I have modified the commander to accept the switch closures from two discrete relays, so the solution can be condensed to the following scenario.

Mechanical components - Power supply, Arduino UNO, a single momentary pushbutton and two relays.

Operating conditions - Pushing the ‘soft button’ provides a 2 second pulse to relay #1 : After (circa) one minute delay a 2 second pulse is sent to relay #2 : System resets to await next command from push button at which point the above process is again activated.
If the pushbutton remains pressed the cycle repeats until it is released.

The relays will operate the commander and hence the wireless controlled mains socket.

In short:
push hardwired button / socket turns on for one minute / socket turns off until next button push / cycle repeats if button remains pressed.

I’ve done a bit of initial research and realise the button input will need to be ‘de-bounced’ and then the two outputs initiated and a delay inserted. However I am daunted by the time it may take me to assimilate sufficient knowledge in programming the Arduino in order to achieve the end result. Consequently any immediate help would be most appreciated!

P.S. The eventual intention is to have the Arduino, relays and commander unit in an enclosure with operating power supplied by a battery. In this case the current consumption of an Arduino Micro with the unit in ‘standby’ mode could be an issue that I may need to address in the future.

The shortest time you describe is two seconds long. No switch will bounce that long. No de-bounce needed.


Have a look at capacitive touch buttons rather than mechanical buttons. Those require no force at all, just touching them is enough.

const byte SoftButtonPin = 2;
const byte OnRelayPin = 3;
const byte OffRelayPin = 4;

void setup()
  pinMode(SoftButtonPin, INPUT_PULLUP);  // Wire button between pin an Ground.  Active LOW.
  pinMode(OnRelayPin, OUTPUT);
  pinMode(OffRelayPin, OUTPUT);

void loop() 
  if (digitlRead(SoftButtonPin) == LOW)
    digitalWrite(OnRelayPin, LOW);  // Turn relay on (active low)
    delay(2000UL);  // Two seconds
    digitalWrite(OnRelayPin, HIGH);  // Turn relay on (active low)

    delay(60000UL - 2000UL);  // One minute minus the two seconds.

    digitalWrite(OffRelayPin, LOW);  // Turn relay on (active low)
    delay(2000UL);  // Two seconds
    digitalWrite(OffRelayPin, HIGH);  // Turn relay off (active low)

Hi John,

Thank you very much for your time and the trouble taken in preparing this for me, it is most appreciated!
I'm awaiting final delivery of parts for this project and will keep you posted on the results.
Meanwhile thanks to you and all other members who took the trouble to read my post!
Best wishes to all,