Jonathan ButtonTy Polsgrove
Published

Let Them Brew Coffee

Automatically control your coffee maker by simply turning on a light switch, setting an alarm, or pushing a button on your mobile device.

BeginnerFull instructions provided2 hours964
Let Them Brew Coffee

Things used in this project

Hardware components

Photon
Particle Photon
included with the photon are all the necessary components for a photoresistor circuit
×2
HS-311 servo
×1
Cuisinart DCC 4 cup coffeemaker
×1
Wood-cased #2 HB Pencils
×1

Software apps and online services

Maker service
IFTTT Maker service
Mobicle
ControlEverything.com Mobicle

Story

Read more

Schematics

photoresistor Schematic

Servo Schematic

Code

Photoresistor Code

Arduino
This is the code used to record and publish the photoresistor data, and should be placed in the room where light will be detected.
int led = D0; 

int photoresistor = A0; 

int power = A5; 

int analogvalue; 


void setup() {

    
    pinMode(led,OUTPUT);
    pinMode(photoresistor,INPUT);  
    pinMode(power,OUTPUT); 
   
    digitalWrite(power,HIGH);

    
    Particle.variable("analogvalue", &analogvalue, INT);
    

}




void loop() {

    
    analogvalue = analogRead(photoresistor);
    delay(100);
    if (analogvalue>=200)
        Particle.publish("800853132_lights_on", "coffee_time", 1001);
    

}

Servo Photon Code

Arduino
This is the code for the photon connected to the servo. It also receives the commands to brew.
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
int led2 = D7;
int pos = 0;    // variable to store the servo position
int servo = D0;
void setup()
{
  myservo.attach(D0);  // attaches the servo on the D0 pin to the servo object
  // Only supported on pins that have PWM
  Particle.function("Coffee",servo1);
  pinMode(led2, OUTPUT);    
  Particle.subscribe("800853132_lights_on",loop, "270035001847343338333633");
}

void loop(const char *event, const char *data)
{
 
 
                                 
          myservo.write(pos = -1);              
          delay(2000);                       
        
              
          myservo.write(pos = 80);
          
          Particle.publish("800854853_Coffee_Is_Ready", "Brew_Started_Light/Alarm");
          delay(600000);
        
     Particle.publish("800854853_Coffee_Is_Ready", "Brew_Executed_Light/Alarm");
    
     
         
          
}     

int servo1(String command) {

    if (command=="on") {
        myservo.write(pos = -1);
        delay(2000);                       
        myservo.write(pos = 80);
        Particle.publish("800854853_Coffee_Is_Ready", "Brew_Started_Phone");
        return 1;
    }
    else if (command=="off") {
        myservo.write(pos = -1);              
        delay(2000);                       
        myservo.write(pos = 80);
        Particle.publish("800854853_Coffee_Is_Ready", "Coffee_Off_Phone");
        return 0;
    }
    else {
        return -1;
    }
    
    delay(600000);
        
     Particle.publish("800854853_Coffee_Is_Ready", "Brew_Executed_Phone");

}

Credits

Jonathan Button

Jonathan Button

1 project • 1 follower
UNC Charlotte mechanical engineering student concentrating in motorsports, minor in military science. I am originally from Arizona
Ty Polsgrove

Ty Polsgrove

1 project • 0 followers

Comments