Internet of Coffee!

Monitoring the morning brew with the internet of things.

Hot Coffee (sped up 40 times)

Do you want to know when your coffee is done brewing but are too lazy to walk over to see for yourself?  Do you need to monitor your coffee pot when you are out of town?  Probably not, but here is one solution to the non-problem.  CLICK HERE to see if the coffee is hot, or keep reading to see how to make your own.

Idea

The coffee pot has a timer so you know when it starts brewing, but when is it done?  I used a contactless infrared thermometer to measure the temperature of the coffee pot.  The temperature sensor is connected to a ESP8266 microcontroller that uploads the measurements over wifi to adafruit.io’s online data service.  Once the data is there, you can see it on your smartphone, set an alarm using IFTTT, or it can be monitored by other smart devices (an idea for the future.)  I put the whole thing into a 3D printed case with some magnets and it sticks to the coffee pot and doesn’t look too bad.  Adafruit has excellent tutorials so the software (using the Arduino IDE with ESP8266 Library) is just a combo of the temperature sensor demo and IOT demo.

Sensor held on with magnets

Temperature seen from Phone

Parts & Build

I used Adafruit’s TMP007 module, based on a TI thermopile sensor.  It seems to read about 10 degrees F too high (at room temperature) but as I’m just looking to see if the coffee is hot or not I haven’t debugged this.

The sensor reading and internet-of-things is handled by a ESP8266 NodeMCU v1.0 board from ebay.  Adafruit’s ESP8266 Huzzah would be a great choice too.

Wiring is simple- the sensor gets 3.3V and Ground from the ESP board, SDA goes to ESP GPIO4 , and SCL goes to ESP GPIO5 (following the arduino ESP8266 library documentation).

I designed an enclosure and 3D printed it.  Two little magnets fit inside to hold the coffee sensor to the coffee pot.  The STL files are linked below; or go to the GitHub repo.


Code

The code is a mash-up of two examples from Adafruit:

The code is below.  Note you also need the config.h file from the adafruitio_00_publish example (I didn’t include it because it has my wifi password and adafruit.io key).

// Adafruit IO Publish Example
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.
// Modified by Mike Holden 2017 for coffee monitor project
// Connects to adafruit TMP007 sensor module, puts temp on IOT
// Compiled for NodeMCU 1.0 board using ESP8266 libraries.
/************************** Configuration ***********************************/
// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"
/************************ Example Starts Here *******************************/
#include <Wire.h>
#include "Adafruit_TMP007.h"
// TMP 007 connections:
// Connect VCC to +3V
// Gnd -> Gnd
// SCL connects to the I2C clock pin. ESP8266 GPIO5
// SDA connects to the I2C data pin. ESP8266 GPIO4
Adafruit_TMP007 tmp007;
// this int will hold the current count for our sketch
float temperature = 0;
// set up the 'myfeed' feed
AdafruitIO_Feed *myfeed = io.feed("coffeetemp");
void setup() {
// start the serial connection
Serial.begin(115200);
Serial.println("\r\n");
Serial.println("hello temperature");
// wait for serial monitor to open
while(! Serial);
Serial.println("\r\n");
Serial.print("Connecting to Adafruit IO");
// connect to io.adafruit.com
io.connect();
// wait for a connection
while(io.status() < AIO_CONNECTED) {
Serial.print(".");
delay(500);
}
// we are connected
Serial.println();
Serial.println(io.statusText());
Serial.println("IO stream Connected");
// you can also use tmp007.begin(TMP007_CFG_1SAMPLE) or 2SAMPLE/4SAMPLE/8SAMPLE to have
// lower precision, higher rate sampling. default is TMP007_CFG_16SAMPLE which takes
// 4 seconds per reading (16 samples)
// Try a few times to connect then give up
int iiuu;
for (iiuu=0;iiuu<5;iiuu++) {
if (! tmp007.begin()) {
Serial.print(iiuu);
Serial.println(" No sensor found");
delay(1000);
} else {
Serial.println("Sensor connected.");
break;
}
}
}
void loop() {
// io.run(); is required for all sketches.
// it should always be present at the top of your loop
// function. it keeps the client connected to
// io.adafruit.com, and processes any incoming data.
io.run();
temperature = tmp007.readObjTempC();
Serial.print("Object Temperature: "); Serial.print(temperature); Serial.println("*C");
//float diet = tmp007.readDieTempC();
//Serial.print("Die Temperature: "); Serial.print(diet); Serial.println("*C");
// save to the feed on Adafruit IO
Serial.print("sending -> ");
Serial.println(temperature*1.8 +32.0);
myfeed->save(temperature*1.8 +32.0);
// wait
delay(4000);
}

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *