Things used in this project

Hardware components:
12v battery charger
×1
Photon new
Particle Photon
×2
Relay (generic)
×1
11026 02
Jumper wires (generic)
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
×2
12002 04
Breadboard (generic)
×2
DC 12V micropump
×1
12V battery charger (generic)
×1
food grade hose
×1
Software apps and online services:
Mobicle 1024
ControlEverything.com Mobicle
Google sheets
Google Sheets
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service

Schematics

Drink Dispenser
Particle project iskxudugis

Code

Publish CodeC/C++
This code publishes the event to the cloud.
 //      +----------| USB |----------+
// *                          |          +-----+       *  |
 //*                          | [ ] VIN           3V3 [ ] |
 //*                          | [ ] GND           RST [ ] |
 //*                          | [ ] TX           VBAT [ ] |
 //*                          | [ ] RX  [S]   [R] GND [ ] |
 //*                          | [ ] WKP            D7 [*] |<-LED triggers jumpered to pin D0 (digital write)
 //*                          | [ ] DAC +-------+  D6 [ ] |
 //*                          | [ ] A5  |   *   |  D5 [ ] |
 //*                          | [ ] A4  |Photon |  D4 [ ] |
 //*                          | [ ] A3  |       |  D3 [ ] |
 //*                          | [ ] A2  +-------+  D2 [ ] |
 //*                          | [ ] A1             D1 [ ] |
 //*                          | [ ] A0             D0 [*] |<-This pin reads the signal from the D7 pin (digital read)
 //*                          |                           |
 //*                           \    []         [______]  /
 //*                            \_______________________/
 //*
//The D7 pin is jumpered to the D0 pin.  





int led = D7;
int lightsensor = D0;
int val = 1;

void setup() 
{
pinMode(led, OUTPUT);
pinMode(lightsensor, INPUT_PULLDOWN);


digitalWrite(led, HIGH);
digitalWrite(led, LOW);

Particle.function("togglelights", togglelights);

}

int togglelights(String command){
    if(command == "On" || command == "on" || command == "ON"){
        digitalWrite(led,LOW);
        return 1;
    }
 else if (command=="off") {
        digitalWrite(led,HIGH);
    
        return 0;
}
else {
    return -1;
}
}

void loop() {
    
    val = digitalRead(lightsensor);
    digitalWrite(led, val);

 
    if(digitalRead(lightsensor) == 1){
        Particle.publish("drink_maker44","flowin",60);
    }
   else 
   {delay(3000);
   }
}
Subscribe CodeC/C++
This is the code for the photon that subscribes to the event.
//      +----------| USB |----------+
 //*                                          |          +-----+       *  |
 //*  This connects to the vcc on the relay ->| [*] VIN           3V3 [ ] |
 //*                connects to GND on relay->| [*] GND           RST [ ] |
 //*                                          | [ ] TX           VBAT [ ] |
 //*                                          | [ ] RX  [S]   [R] GND [ ] |
 //*                                          | [ ] WKP            D7 [*] |<-connects to the IN1 on the relay
 //*                                          | [ ] DAC +-------+  D6 [ ] |
 //*                                          | [ ] A5  |   *   |  D5 [ ] |
 //*                                          | [ ] A4  |Photon |  D4 [ ] |
 //*                                          | [ ] A3  |       |  D3 [ ] |
 //*                                          | [ ] A2  +-------+  D2 [ ] |
 //*                                          | [ ] A1             D1 [ ] |
 //*                                          | [ ] A0             D0 [ ] |
 //*                                          |                           |
 //*                                           \    []         [______]  /
 //*                                            \_______________________/
 //*

int led = D7;


void setup() {

    pinMode(led, OUTPUT);
    digitalWrite(led, HIGH);

    Particle.subscribe("drink_maker44", pumpOn, "420029001147353138383138");

}



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

digitalWrite(led, LOW);

  // We'll leave it on for 1.7 second...
  delay(1700);


  // Then we'll turn it off...
  digitalWrite(led, HIGH);
  
  delay (-1700);
  // the negative cuts off the loop


}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

2-Way Particle Photon Communication
Easy
  • 132
  • 4

Make two Particle Photons "talk" via the usage of webhooks!

E-Paper Weather Display with Photon and IFTTT
Easy
  • 749
  • 9

Full instructions

Create a beautiful medium for weather information using Particle's cloud services and IFTTT.

IFTTT - Enabled Sensors with Particle Photon
Easy
  • 660
  • 11

Full instructions

Connect any sensor to Particle Photon and use it to trigger an IFTTT action with just a few lines of code.

Light Detecting Email Sender
Easy
  • 208
  • 4

Full instructions

Receive an email about when the light is too strong on your device; nobody wants a heated device left directly under the sun. Photon + IFTTT

WiFi Strength Meter
Easy
  • 4
  • 0

A meter that indicates the Wi-Fi signal strength in an intuitive way, using the parts I had on hand.

Internet-Connected Popcorn Popper
Easy
  • 141
  • 1

Full instructions

A hot air popcorn popper triggered via the Internet! (Built for the Bellingham Codes May event.)

Add projectSign up / Login