Eric Bryan and Patrick Whitley
Created March 23, 2018

Coffee Button

This is a button that triggers a coffee machine to turn on, and will flash an LED, and send temperature readings when the coffee is done.

IntermediateWork in progress3 hours26
Coffee Button

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×1
Photon
Particle Photon
×2
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
LED (generic)
LED (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×2
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
9V Battery Clip
9V Battery Clip
×1
9V battery (generic)
9V battery (generic)
×1
Coffee Machine
×1

Software apps and online services

Particle Pi
Particle Pi

Hand tools and fabrication machines

Drill
Screwdriver
Soldering iron (generic)
Soldering iron (generic)
Tape

Story

Read more

Schematics

Push Button Photon

This is the circuit diagram for the button

Coffee Machine Circuit Diagram

The Circuit diagram for the coffee maker

Code

Controller Particle Photon

C/C++
Takes push button and activates second Particle Photon
// We will be using D1 to control our LED
int ledPin = D1;
// Our button wired to D0
int buttonPin = D0;
//Particle.publish(int start);
//Particle.subscribe();

void setup()
{
    pinMode(buttonPin ,INPUT_PULLUP); // sets pin as input
    pinMode(ledPin ,OUTPUT ); // sets pin as output
}

void loop()
{
    int buttonState = digitalRead(buttonPin);


    if( buttonState == LOW )
    {
    // turn the LED On
    digitalWrite(ledPin, HIGH);
    Particle.publish("startcoffee");
    }
    else
    {
    // otherwise
    // turn the LED Off
    digitalWrite(ledPin, LOW);
    //start = 0;
    }
}

Machine Starter Code

C/C++
Receives signal from First Particle Photon and starts the coffee maker
int led1 = D7;

void setup() 
{
    pinMode(led1, OUTPUT);
    Particle.subscribe("startcoffee", startCoffee ,"540046000751353530373132");
}

void startCoffee(const char *event, const char *data)
{
    
    
    // To blink the LED, first we'll turn it on...
    digitalWrite(led1, HIGH);
    Particle.publish("started");
    // We'll leave it on for 1 second...
    delay(1500);

    // Then we'll turn it off...
    digitalWrite(led1, LOW);


    // Wait 1 second...
    delay(1500);
    

} 

void loop() 
{
    
}

Credits

Eric Bryan and Patrick Whitley

Eric Bryan and Patrick Whitley

1 project • 0 followers
Group design project for Mechanical Engineering

Comments