Welcome to THE SOLDER-BLOB.com

Automating a Coffee Maker

Using only junk parts.

Why I Built It

To be quite honest, I just didn't want to get out of bed in the morning to turn it on. This way it turns on 15 minutes or so before I get up, and I wake up to the smell of hot coffee.

What You'll Need

Steps to Take

(In an order that makes sense but can be modified as you see fit.)

First, open up your alarm clock!

Next... it's time to... COOOOODE  (NNNOOOOooooo.....)

For some of you, this means fear, but it's really isn't bad. Just monitor the input pin, when the coffee maker meeds to be on, turn on the pin you're using to control it, otherwise, turn it off. Here's what I came up with-

int alarm = A0; // select the input pin for the alarm
int coffeeMaker = 12;// select the pin for the mosfet
int light = 13; // select the pin for LED
int sensorValue = 0; // variable to store the value coming from the sensor
float voltage; // variable to store voltage

void setup() {
  // declare the coffeeMaker pin as an OUTPUT
  // declare the light as an OUTPUT
  // write the coffeeMaker LOW initially
  pinMode(coffeeMaker, OUTPUT);
  pinMode(light, OUTPUT);
  digitalWrite(coffeeMaker, LOW);

void loop() {
  // read the value from the clock:
  sensorValue = analogRead(alarm);

  // convert it to a voltage
  float voltage = sensorValue * (5.0 / 1023);

  if (voltage > 1) // if alarm is on
    digitalWrite(coffeeMaker, HIGH);
    digitalWrite(light, HIGH);
  else if (voltage < 1) //if alarm is off
    digitalWrite(coffeeMaker, LOW);
    digitalWrite(light, LOW);


Once that's out of the way, just wire the relay in parallel with the current switch in your coffee maker, that way you can still use the current switch when you're not setting an alarm. Since my relay was double-throw, I also wired in a neon indicator.

The final step is to wire the relay to the arduino. I connected one side of the relay coil to the +10V the arduino was powered on, and the connected the other side to a MOSFET as a low side switch that pulled it to ground.

You're Done!!

Now to put it all in a nice case (I used a totally legit cardboard box), and enjoy your coffee!


But wait theres more!!!!

I decided that I wanted more control over this, so that I could command it to start brewing while I was at class and have hot coffee when I got back. The easiest and most reliable way to do this seemed like using an SMS message. I used the fact that cellphones can send an sms message to an email address, and wrote a python script to run on my raspberry pi computer that checked it's emial address every few seconds for new commands, code below-

import RPi.GPIO as GPIO, feedparser, time
import imaplib

mail = imaplib.IMAP4('HOSTING.SITE.COM','PORT')#if using gmail, change to IMAP4_SSL

status, NEWMAIL_OFFSET = mail.select('Inbox') #sets the current number of emails
MAIL_CHECK_FREQ = 10 # check mail every 10 seconds

coffeeMaker = 18

GPIO.setup(coffeeMaker, GPIO.OUT)

while True:

   mail.recent()#refreshes the server
   status, newmails = mail.select('Inbox')#gets the number of emails

   if newmails > NEWMAIL_OFFSET:
     result, data = mail.search(None, "ALL")
     ids = data[0] # data is a list.
     id_list = ids.split() # ids is a space separated string
     latest_email_id = id_list[-1] # get the latest
     result, data = mail.fetch(latest_email_id, "(RFC822)") # fetch the email body (RFC882) for the given ID
     raw_email = data[0][1]#this is the raw email content

   if 'ON' in raw_email or 'On' in raw_email:
     GPIO.output(coffeeMaker, True)
     print "You recieved an _ON_ email!"

   if 'OFF' in raw_email or 'Off' in raw_email:
     GPIO.output(coffeeMaker, False)
     print "You recieved an _OFF_ email!"

   NEWMAIL_OFFSET = newmails

Back To Top

Back Home