Josh BussiereSawyer Lankford
Published © GPL3+

The Daily Grind

An IoT Coffee maker that allows you to brew coffee remotely and monitor the status of the coffee machine.

BeginnerFull instructions provided2.5 hours737
The Daily Grind

Things used in this project

Hardware components

Photon
Particle Photon
×2
2 Channel Relay
×1
LED (generic)
LED (generic)
One red, one green
×2
Resistor 221 ohm
Resistor 221 ohm
×2
Adafruit IN4004 Diode
×3
Kitchen Smith 12 Cup Coffee Maker
Any coffee maker with a rocker to control power is fine, this one was nearby and cheap
×1

Software apps and online services

ThingSpeak API
ThingSpeak API
Maker service
IFTTT Maker service

Hand tools and fabrication machines

Wire Cutter (Generic)
Wire Stripper (Generic)

Story

Read more

Schematics

Real Time Coffee

This is the circuit set-up for the relay connected to the coffee machine so that it can be activated. The black wires coming out of the relay represent the two ends of the positive wire on the coffee machine.

Coffee Notification

This is the circuit set-up for the LED lights that sit on your night stand. It is not required for the coffee machine to work, but does notify you when your coffee is brewing and ready.

Code

BreweyMcBreweyFace

C/C++
This is the firmware of the main Photon, which controls the coffee maker. The delay in line 26 is the time it takes the coffee maker to brew your daily amount of coffee, in our case 4 cups. You'll have ti time your machine and change the delay, which is in milliseconds.
// ----------------------------------------------------------------------
// This is the code that activates the relay controlling the coffee maker
// ----------------------------------------------------------------------

// First, the pin configuration must be set up.
int brew = D7;
int Coffee = 0; // This is the variable published to ThingSpeak


// Next comes the setup function.
void setup() {

    pinMode(brew,OUTPUT); // sets the signal pin as an output.
    
    Particle.function("brewToggle",brewToggle); // This creates the function that controls the pin output.
    
}

// this is where the function is defined
int brewToggle(String command) {

    if (command=="on") { // string that turns the relay on.
        digitalWrite(brew,HIGH);
        Coffee = 1;
        Particle.publish("Status","Brewing");
        delay(270000);
        Particle.publish("Status","Ready");
        
        return 0;
    }
    else if (command=="off") { //string that turns the relay off.
        digitalWrite(brew,LOW);
        Particle.publish("Status","Off");
        Coffee = 0;
        return 0;
    }
    else {
        return -1;
    }

}

      
// This void loop is what activated the integration with ThingSpeak and
// publishes the machine status
void loop() {
  // Get the Coffee data
  String data = String(Coffee);
  // Trigger the integration
  Particle.publish("Coffee", data, PRIVATE);
  // Wait 60 seconds
  delay(60000);
}
      

CaffeineMcCaffieneFace

C/C++
This is the firmware code run by the second Photon, which controls the LED display.
int red = D7; // Assigns pin D7 to the red LED
int green = D6; // Assigns pin D6 to the green LED



void setup() {

    pinMode(red,OUTPUT); // sets the pin as an output
    pinMode(green,OUTPUT); // sets the pin as an output
    
    Particle.subscribe("Status", ledToggle); // This subscribes our photon to the "Status" event published by our other photon
    
    
    
}

void ledToggle(const char *event, const char *data) // this is our function that handles the event data
{
    
    if (strcmp(data,"Brewing")==0) {
    // if the coffee is brewing, the red LED is on
    digitalWrite(red,HIGH);
  }
    
  else if (strcmp(data,"Ready")==0) {
    // if the coffee is ready, both LED's are on
    digitalWrite(red,HIGH);
    digitalWrite(green,HIGH);
  }
    
    else if (strcmp(data,"Off")==0) {
    // if the machine is off, both LED's are off
    digitalWrite(red,LOW);
    digitalWrite(green,LOW);
  }
  
  else {
    // if the data is something else, don't do anything.
  }
}

Credits

Josh Bussiere

Josh Bussiere

1 project • 0 followers
Sawyer Lankford

Sawyer Lankford

1 project • 0 followers

Comments