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

Well House Temperature Manager
Easy
  • 282
  • 6

Full instructions

Monitors the temperature of the well house to prevent the well from freezing.

Drink Alert!!! (Beverage Can Monitor)
Easy
  • 342
  • 4

Full instructions

Tired of going to grab a soda only to find they're all gone!? Well now you have an alert system to let you know when you need to refill.

The Food Thief Catcher
Easy
  • 155
  • 4

Work in progress

Are you tired of all of your pesky roommates stealing your food? Me too, thats why we have the Food Thief Catcher!

Happy Wife =  Happy Life
Easy
  • 259
  • 3

Full instructions

Wife not a morning person? Improve your life by improving your wife's temperament in the morning. Fresh coffee makes wife happy!

Happy Wife = Happy Life

Team We Are Not Coders

Temperature Sensor
Easy
  • 397
  • 5

Full instructions

A photon that measures the temperature and humididty with a DHT 22 sensor and communicates the temperature data to another photon.

Motion Activated Room Light
Easy
  • 158
  • 4

Full instructions

With this project, you'll never have to search for the light switch in the dark again.

Add projectSign up / Login
Respect project