Project tutorial
Coffee

Coffee © MIT

A Keurig coffee maker controlled by a Node Lua ESP 8266 , Cayenne myDevices, Arduino Pro Mini and a stepper motor with driver.

  • 2,320 views
  • 0 comments
  • 6 respects

Components and supplies

Necessary tools and machines

screwdriver

Apps and online services

About this project

In essence, a hot cup of coffee made at 7:00 each morning.

Use self taping screws to attach your stepper motor.

Use super glue and a popcicle stick to extend the stepper motor shaft. (I used a piece of a broken propeller).

Code

CoffeePressArduino
Connect Pin D2 from the Node Mcu Esp8266 to Pin 2 on your Arduino.
Connect pins 5,6,10,11 to your stepper driver board.
#define IN1  5
#define IN2  6
#define IN3  10
#define IN4  11
int Steps = 0;
boolean Direction = true;// gre
unsigned long last_time;
unsigned long currentMillis ;
int steps_left=4095;
long time;
const byte IOTpressed = 1;

// Interrupt Service Routine (ISR)
void switchPressed ()
{
 if (IOTpressed==HIGH){
    while(steps_left>0){
  currentMillis = micros();
  if(currentMillis-last_time>=1000){
  press(1); 
  time=time+micros()-last_time;
  last_time=micros();
  steps_left--;
   }
  }
  Direction=!Direction;
  steps_left=4095;
}
else {
 IOTpressed==LOW;
 }
}


void setup ()
{
  pinMode(IN1, OUTPUT); 
  pinMode(IN2, OUTPUT); 
   pinMode(IN3, OUTPUT); 
    pinMode(IN4, OUTPUT); 
 pinMode(IOTpressed, INPUT);
  attachInterrupt (0, switchPressed, CHANGE);  // attach interrupt handler
}  // end of setup

void loop ()
{
  // loop doing nothing 
} 
void press(int xw){
  for (int x=0;x<xw;x++){
switch(Steps){
   case 0:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
   break; 
   case 1:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, HIGH);
   break; 
   case 2:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
   break; 
   case 3:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
   break; 
   case 4:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
   case 5:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
     case 6:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
   case 7:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
   break; 
   default:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
}
SetDirection();
}
} 
void SetDirection(){
if(Direction==1){ Steps++;}
if(Direction==0){ Steps--; }
if(Steps>7){Steps=0;}
if(Steps<0){Steps=7; }
}
CaffeeStartArduino
Connect Pin D2 from the Node Mcu Esp8266 to Pin 2 on your Arduino.
#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneDefines.h>
#include <BlynkSimpleEsp8266.h>
#include <CayenneWifiClient.h>
#include <Arduino.h>
#include <SoftwareSerial.h>
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = ""; //device code
char ssid[] = ""; //your ssid
char password[] = ""; // network password
void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
}
void loop()
{
  Cayenne.run(); 
}

Comments

Similar projects you might like

Coffee Bird!

Project tutorial by mim

  • 1,086 views
  • 0 comments
  • 4 respects

Amazon DRS Promise: Never Miss Coffee Break Again!

Project tutorial by Team coffee-drinkers

  • 712 views
  • 0 comments
  • 3 respects

Automatic Coffee Machine

Project tutorial by Thomas sxt

  • 19,221 views
  • 7 comments
  • 18 respects

IoT Thermometer Using Python

Project tutorial by Luigi Francesco Cerfeda

  • 7,719 views
  • 6 comments
  • 22 respects

Secure Package Delivery Trunk for Your Front Porch

Project tutorial by Team Castle Locker

  • 2,515 views
  • 1 comment
  • 15 respects

Coffee Machine Water Auto-Refill Upgrade

by FelixAdiy

  • 1,769 views
  • 0 comments
  • 2 respects
Add projectSign up / Login