Aedan McHughAlex Sumida
Published © GPL3+

Bionic Bartender

The perfect cocktail at the push of a button!

EasyShowcase (no instructions)4 hours1,365
Bionic Bartender

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
LED (generic)
LED (generic)
×1
9V battery (generic)
9V battery (generic)
×2
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
DC motor (generic)
×2

Story

Read more

Schematics

Bionic Bartender Circuitry

This circuit schematic shows the basic wiring layout for our Bionic Bartender. The first photon has a push button and an LED light. When the button is pushed the LED illuminates and the event is published. The second photon then subscribes to this event and sends power to the relays from D0 and D7 allowing the pumps to run and your beverage to be created.
Bb2 2uye6rekzi

Code

Publish Code

C/C++
This code will publish an event when the button is pushed. This event will cause the other photon to begin pouring your beverage.
int ledPin = D1;
int buttonPin = D0;
void setup()
{
  pinMode( buttonPin , INPUT_PULLUP); 
  pinMode( ledPin , OUTPUT ); 
}
void loop()
{
  if( buttonState == LOW )
  {
    digitalWrite( ledPin, HIGH);
  }else{
  
    digitalWrite( ledPin, LOW);
  }
   delay(1000);
    if (digitalRead(buttonState) == HIGH){
        Particle.publish("ButtonPush","The button is pushed",PRIVATE);
    }

}

Subscribe Code

C/C++
This code controls both the pumps that will create your beverage.
int led = D7;
int pump = D5;

void setup() {

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

    Particle.subscribe("ButtonPush", pumpOn, "3e0030000f51353338363333");

}

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

digitalWrite(led, LOW);

  delay(3227);
  
digitalWrite(pump, LOW);

    delay(1613);
    
digitalWrite(led, HIGH);
    
digitalWrite(pump, HIGH);

}

Credits

Aedan McHugh

Aedan McHugh

1 project • 0 followers
Contact
Alex Sumida

Alex Sumida

1 project • 0 followers
Contact

Comments

Add projectSign up / Login