evan walshTyler Smith
Published

Shotomatic

With the use of 2 Photons and wireless technology, you can relax while Shotomatic pours a shot of your favorite drink for you.

BeginnerFull instructions provided8 hours822
Shotomatic

Things used in this project

Hardware components

Photon
Particle Photon
×2
4-CHANNEL RELAY CONTROLLER FOR I2C
ControlEverything.com 4-CHANNEL RELAY CONTROLLER FOR I2C
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
4 AA battery holder
×2
Power bank (generic)
×2
Food grade hose
×1
DC motor 12v
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×2

Software apps and online services

Maker service
IFTTT Maker service
Mobicle
ControlEverything.com Mobicle
Google Sheets
Google Sheets
Particle Pi
Particle Pi
Fritzing

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Shotomatic Drink Dispenser

Code

Subscribe

C/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("evansphoton", pumpOn, "420029001147353138383138");

}



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

digitalWrite(led, LOW);

  // We'll leave it on for .37- second...
  delay(370);


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


}

Publish

C/C++
 //      +----------| 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"{
        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);
   }
}

Credits

evan walsh

evan walsh

1 project • 1 follower
Tyler Smith

Tyler Smith

1 project • 0 followers
Thanks to 4four .

Comments

Add projectSign up / Login