2 ways to turn on a pump

Hello, everyone!

I'm starting a project where I need to turn on/off a water pump through the IOT Calendar and I also would like to turn it on with a switch.

But I would like to turn the pump off with the switch (using it as a emergency button).

So basically I want to be able to turn the pump "manually" with the switch, ou using the calendar and be able to turn the pump off with the same switch.

Here is my code so far:

/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/758ca0da-74e6-4361-9014-33d2deb21fff 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  CloudLight led;
  CloudSwitch switch1;
  CloudSchedule calendar;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"
#define pump 10
#define ferti 11

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 
  pinMode(10, OUTPUT);
  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  if (calendar.isActive()){
    digitalWrite(10, HIGH);
    Serial.println("Calendar activated");
    delay(500);
  } else
  {
    digitalWrite(10, LOW);
    Serial.println("Calendar deactivated");
    delay(500);
  }     
/*if (led == 1){
   digitalWrite(10, HIGH);
   Serial.println("On by button");
   delay(500);
 } else{
   digitalWrite(10, LOW);
   Serial.println("Off by button");
   delay(500);
 }*/
}
void onLedChange()  {
 if (led == 1){
   digitalWrite(10, HIGH);
   Serial.println("On by button");
   delay(500);
 } else{
   digitalWrite(10, LOW);
   Serial.println("Off by button");
   delay(500);
 }
}

void onCalendarChange()  {
  // Add your code here to act upon Calendar change
}


void onSwitch1Change()  {
  
}

Thanks in advance!

Fernando

It depends how much of an “emergency” it will be if the pump fails to turn off when required. If the consequences of that are serious, then the “emergency cutoff” shouldn’t be trusted to code written by a novice programmer that's running on a hobbyist-quality processor. The emergency function should be handled by an manual cutoff switch to the pump’s power.

Thanks! There will be a manual cut off too. Itá already there actually there. There is gonna be a physical 3 position switch (ON-OFF-MANUAL).

Have you a schematic to refer to for this effort?  Post'em if you got'em.

I think you mean Auto-Off-Manual (surely)........
On and Manual to me at least, mean the same thing.

Then in Auto-Off-Manual, your Manual stop would be the hard wired ON -OFF with the Auto selection being, say for example, power to a uC relay which would require a separate hard wired EM stop.
This latter would need to be "double pole " arrangement to cover both manual and auto operation.

A truly emergancy cuttoff switch, as pointed out, has NO dependance on any other switch. The emergency cutoffs should directly (physically) cut all power to the pump and maybe notify the processsor that an emergency has taken placce.

This can be via hard wired control circuit.
Imagine an Em Stop switch on say a 300hp 3phase pump.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.