Roberto GallettiAlex Sududewage
Published © TAPR-OHL

DooUcoffee Machine

Internet of things in the world of coffee with Udoo - coffee machine 3.0 entirely managed by µController.

AdvancedWork in progressOver 20 days2,876
DooUcoffee Machine

Things used in this project

Hardware components

UDOO QUAD
UDOO QUAD
brain of dooUcoffee
×1
7" Touch LCD for UDOO NEO, DUAL and QUAD
7" Touch LCD for UDOO NEO, DUAL and QUAD
×1

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

Operating Summary

DooUcoffee basic operating

Thompson Wafer dispenser

This simple diagram explains the operation of the distributor waffles,

Motor Board

board to control the milk and chocolate despenser engines

Relays Board

board to control the relays for the mechanical organs

Code

Demo!

C/C++
udoo demo code for Dooucoffee
#include "variant.h"
#include <stdio.h>
#include <adk.h>

// pompe 
int pompa1 = 8;
int pompa2 = 9;

//motori
int motoreLatte = 5;
int motoreMixer = 4;
int motoreCacao = 3;

//elettrovalvole
int elettrovalvolaBianca = 6;
int elettrovalvolaNera = 7; 

char descriptionName[] = "ArduinoADK_2"; // Accessory descriptor. It's how Arduino identifies itself to Android.
char modelName[] = "UDOO_ADK";           // your Arduino Accessory name (Need to be the same defined in the Android App)
char manufacturerName[] = "Aidilab";     // manufacturer (Need to be the same defined in the Android App)

// Make up anything you want for these
char versionNumber[] = "1.0";            // version (Need to be the same defined in the Android App)
char serialNumber[] = "1";
char url[] = "http://www.udoo.org";      // If there isn't any compatible app installed, Android suggest to visit this url

USBHost Usb;
ADK adk(&Usb, manufacturerName, modelName, descriptionName, versionNumber, url, serialNumber);

#define RCVSIZE 128
uint8_t buf[RCVSIZE];
uint32_t bytesRead = 0;

void setup()
{
    Serial.begin(115200);   

    //motori
    pinMode(motoreLatte,OUTPUT);
    pinMode(motoreMixer,OUTPUT);
    pinMode(motoreCacao,OUTPUT);
    
    //pompe
    pinMode(pompa1,OUTPUT);
    pinMode(pompa2,OUTPUT);
    
    //elettrovalvole
    pinMode(elettrovalvolaBianca,OUTPUT);
    pinMode(elettrovalvolaNera,OUTPUT);
    delay(500);
    
    Serial.println("UDOO ADK demo start...");
    
}

void loop()
{
    // preparazione scheda relè e motori  
    digitalWrite(elettrovalvolaBianca,HIGH);
    digitalWrite(elettrovalvolaNera,HIGH);                
   
    digitalWrite(pompa1,HIGH);
    digitalWrite(pompa2,HIGH);

    digitalWrite(motoreLatte,HIGH);
    digitalWrite(motoreCacao,HIGH);
    digitalWrite(motoreMixer,HIGH);
    
    // inizio programma      
    Usb.Task();
     
    if (adk.isReady()) {
      adk.read(&bytesRead, RCVSIZE, buf);// read data into buf variable
      if (bytesRead > 0) {
        switch(parseCommand(buf[0])){
          
            case 1:  // CAFFE
            
                //controllo elettrovalvole
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,HIGH);
            
                //controllo pompe
                digitalWrite(pompa1,LOW);
                digitalWrite(pompa2,LOW);
                delay(20000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);
                break;
                
            case 2: // CAFFE_LUNGO
            
                //controllo elettrovalvole
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,HIGH);
            
                //controllo pompe
                digitalWrite(pompa1,LOW);
                digitalWrite(pompa2,LOW);
                delay(30000);
                digitalWrite(pompa1,HIGH);                 
                digitalWrite(pompa2,HIGH);
                break;
                
            case 3: // CAPPUCCINO
            
                //controllo elettrovalvole per parte di caffè
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,HIGH);
            
                //controllo pompe per parte di caffè
                digitalWrite(pompa1,LOW);
                digitalWrite(pompa2,LOW);
                delay(20000);
                digitalWrite(pompa1,HIGH);                 
                digitalWrite(pompa2,HIGH);

                //controllo elettrovalvola per parte di latte 
                digitalWrite(elettrovalvolaNera,LOW);
                digitalWrite(elettrovalvolaBianca,HIGH);
                
                //accenzione motori per parte di latte 
                digitalWrite(motoreLatte,LOW);
                //delay(2000); 
                digitalWrite(motoreMixer,LOW);

                //controllo pompa per parte di latte               
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);                
                delay(5000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spegnimento motori per parte di latte                                                 
                digitalWrite(motoreLatte,HIGH);
                digitalWrite(motoreMixer,HIGH);
                
                break;
                
            case 4: // LATTE
            
                //controllo elettrovalvole
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,LOW);

                //accenzione motori
                digitalWrite(motoreLatte,LOW);                 
                digitalWrite(motoreMixer,LOW);
            
                //controllo pompe
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(5000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spegnimento motori per parte di latte                                                 
                digitalWrite(motoreLatte,HIGH);
                digitalWrite(motoreMixer,HIGH);
                
                break;
                
            case 5: // CIOCCOLATO
            
                //controllo elettrovalvole
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,LOW);

                //accenzione motori
                digitalWrite(motoreCacao,LOW);
                delay(2000); 
                digitalWrite(motoreMixer,LOW);
            
                //controllo pompe
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(5000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spegnimento motori per parte di latte                                                 
                digitalWrite(motoreCacao,HIGH);
                digitalWrite(motoreMixer,HIGH);
                
                break;
                
            case 6: // CIOCCOLATO_LATTE
            
                //controllo elettrovalvole
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,LOW);

                //accenzione motori parte cacao
                digitalWrite(motoreCacao,LOW);
                delay(2000); 
                digitalWrite(motoreMixer,LOW);
            
                //controllo pompe parte cacao
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(4000);                
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spengimento motore parte cacao
                digitalWrite(motoreCacao, HIGH);

                //accenzioine motore parte latte
                digitalWrite(motoreLatte,LOW);
                delay(2000);

                //controllo pompe parte latte
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(5000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spegnimento motori per parte di latte                                                 
                digitalWrite(motoreLatte,HIGH);
                digitalWrite(motoreMixer,HIGH);
                
                break;
                
            case 7: // MOCACCINO
                //controllo elettrovalvole parte caffè
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,HIGH);
            
                //controllo pompe parte caffè
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(20000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //controllo elettrovalvole parte latte e cacao
                digitalWrite(elettrovalvolaBianca,HIGH);
                digitalWrite(elettrovalvolaNera,LOW);

                //accenzione motori parte cacao
                digitalWrite(motoreCacao,LOW);
                delay(2000); 
                digitalWrite(motoreMixer,LOW);
            
                //controllo pompe parte cacao
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(4000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spengimento motore parte cacao
                digitalWrite(motoreCacao, HIGH);

                //accenzioine motore parte latte
                digitalWrite(motoreLatte,LOW);
                delay(2000);

                //controllo pompe parte latte
                digitalWrite(pompa1,LOW);                 
                digitalWrite(pompa2,LOW);
                delay(5000);
                digitalWrite(pompa1,HIGH);
                digitalWrite(pompa2,HIGH);

                //spegnimento motori per parte di latte                                                 
                digitalWrite(motoreLatte,HIGH);
                digitalWrite(motoreMixer,HIGH);
               
                break;
                
            default:
                break;
        }
      }
    } else {
      
      //controllo elettrovalvole      
      digitalWrite(elettrovalvolaBianca,HIGH);
      digitalWrite(elettrovalvolaNera,HIGH);    
            
      //controllo pompe
      digitalWrite(pompa1,HIGH);
      digitalWrite(pompa2,HIGH);

      //spegnimento motori
      digitalWrite(motoreLatte,HIGH);
      digitalWrite(motoreCacao,HIGH);
      digitalWrite(motoreMixer,HIGH);
     
    }  
    
    delay(10);
}

// the characters sent to Arduino are interpreted as ASCII, we decrease 48 to return to ASCII range.
uint8_t parseCommand(uint8_t received) {
  return received - 48;
}

Credits

Roberto Galletti

Roberto Galletti

1 project • 2 followers
Roberto 2oyears Students, Elettronics e Robotics at Sarrocchi in Siena :)
Alex Sududewage

Alex Sududewage

1 project • 2 followers

Comments