Cory Thomasmike goetz
Published

MEGR 3171 Photon Controlled Water Transfer Prototype

In the hydroponic farming industry, a method of growing is referred to as ebb and flow. Our project automates this task.

EasyFull instructions provided18
MEGR 3171 Photon Controlled Water Transfer Prototype

Things used in this project

Hardware components

Photon
Particle Photon
×2
Float Switch, Vertical
Float Switch, Vertical
×2
LED (generic)
LED (generic)
×2
Resistor 220 ohm
Resistor 220 ohm
×5
Pushbutton Switch, Momentary
Pushbutton Switch, Momentary
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
5V 2.5A Switching Power Supply
Digilent 5V 2.5A Switching Power Supply
×1
Relay Shield for Particle Photon I²C 8-Channel SPDT 10-Amp
ControlEverything.com Relay Shield for Particle Photon I²C 8-Channel SPDT 10-Amp
×1
In-Line Water Pump
×2

Software apps and online services

Google Sheets
Google Sheets
Maker service
IFTTT Maker service
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Drill / Driver, Cordless
Drill / Driver, Cordless
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Sensor Control Unit

Photon 1 wiring diagram mr2ldhkk6v

Pump Control Unit

Photon 2 wiring diagram avcwi3ofbn

Code

Pump Control Unit

C/C++
The code for the photon controlling the pumps.
int pump1 = D3;
int pump2 = D4;

void setup() {

pinMode(pump1, OUTPUT);
pinMode(pump2, OUTPUT);

Particle.subscribe("MEGR3171F18/teamcormik/pumpstatus", pumpcmd);

digitalWrite(pump1, LOW);
digitalWrite(pump2, LOW);

}

void loop() {

}

void pumpcmd(const char *event, const char *data) {

    if (strcmp(data,"on")==0) {
        digitalWrite(pump1,HIGH);
        digitalWrite(pump2,LOW);
        Particle.publish("MEGR3171F18/teamcormik/pumpstatus", "pump1 on", PUBLIC);
    }
    else if (strcmp(data,"switch")==0) {
        digitalWrite(pump1,LOW);
        digitalWrite(pump2,HIGH);
        Particle.publish("MEGR3171F18/teamcormik/pumpstatus", "pump switch", PUBLIC);
    }
    else if (strcmp(data,"off")==0) {
        digitalWrite(pump2,LOW);
        digitalWrite(pump2,LOW);
        Particle.publish("MEGR3171F18/teamcormik/pumpstatus", "pumps off", PUBLIC);
    }
    else {
    }
}

Sensor Control Unit

C/C++
int SysPower = A2;
int LedPump1 = D5;
int LedPump2 = D4;
int Floatlow = A0;
int Floathigh = A1;
int Status = 0;



void setup() {
    pinMode(Floatlow, INPUT_PULLUP);
    pinMode(Floathigh, INPUT_PULLUP);
    pinMode(SysPower, INPUT_PULLUP);
    pinMode(LedPump1, OUTPUT);
    pinMode(LedPump2, OUTPUT);
    
    digitalWrite(LedPump1, LOW);
    digitalWrite(LedPump2, LOW);
}
    
    
    
void loop() {
    

    if (Status = 0, SysPower == TRUE) {
        Particle.publish("megr3171/teamcormik/iotproj1", "on", PUBLIC);
        Status = 1;
    }
    
    if (Status = 1, Floatlow == TRUE, FLoathigh == FALSE) {
        Particle.publish("megr3171/teamcormik/iotproj1", "switch", PUBLIC);
        Status = 2
    }
    else if (Status =2, Floatlow == FALSE, FLoathigh == TRUE) {
        Particle.publish("megr3171/teamcormik/iotproj1", "off", PUBLIC);
        Status = 0
    }
}

Credits

Cory Thomas

Cory Thomas

1 project • 0 followers
mike goetz

mike goetz

1 project • 0 followers

Comments

Add projectSign up / Login