Tea time | Homehack
Made by Roisin Pearson
Made by Roisin Pearson
A simple solution for all the scalded tongues and dissatisfied mouthfuls. Tea time lets you know when is the perfect time to drink your tea, and reminds you not to forget to drink it!
Created: February 1st, 2017
Who hasn’t taken the first sip of their tea at night and scalded their mouth, or forgotten all about it leaving it to get cold? These are daily frustrations that affect my housemates, in particular, causing bitter moods and sore tongues. I wanted to create a solution to a simple but wide problem that many of us also face. After all, what's better than the perfect cup of tea?
Tea-time aims to solve these problems my household faces and provide a simple solution that lets my housemates know when to be drinking their tea at the perfect temperature. It will monitor when the temperature drops below a certain drinkable temperature that my housemates have agreed is bearable for them. Tea time will also calculate when the temperature drops even further from this first point to where it is distasteful to drink. A notification will be sent out to the user when these changes occur so that they do not have to test the waters themselves.
Input: Button to trigger the temperature sensor. This lets the user control when to turn the circuit on.
Output: signal connecting to IFTTT that sends a text to your phone when Particle publishes a certain event.
Sensor: Waterproof temperature sensor
Tea Time has two separate functions, ‘ready to drink’ and ‘getting cold’. A text saying ‘Your tea is now ready to drink’ is sent to your phone when the sensor reads temperatures ranging from 155 to 145F. Similarly a text saying ‘Your tea is getting cold’ is sent when the temperature drops below 120F. The particle connects to the IFTTT website that sends out the text message based on boolean events in the code. The events ‘readytodrink’ and ‘gettingcold’ can either be true or false, when these are triggered the text is then sent notifying the user of the situation. A button is pressed which powers the sensor and turns the circuit on.
The idea is to turn on the temperature sensor via the button on the circuit and place the temperature sensor in your tea. The user can then go off and do other activities until they receive a text saying that their tea is ready.
#include "OneWire.h"
// This #include statement was automatically added by the Spark IDE.
#include "spark-dallas-temperature.h"
// -----------------
// Read temperature
// -----------------
// Data wire is plugged into port 0 on the Arduino
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(D0 );
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature dallas(&oneWire);
// Create a variable that will store the temperature value
double temperature = 0.0;
double temperatureF = 0.0;
bool readytodrink = false;
bool gettingcold = false;
int buttonPin = D1;
bool sensetemp = false;
long framerate = 0;
void setup()
{
// Register a Particle variable here
/*Particle.variable("temperature", &temperature, DOUBLE);*/
Particle.variable("temperatureF", &temperatureF, DOUBLE);
Particle.variable("readytodrink", readytodrink );
Particle.variable("gettingcold", gettingcold );
pinMode( buttonPin , INPUT_PULLUP);
// setup the library
dallas.begin();
}
void loop()
{
framerate++;
int buttonState = digitalRead( buttonPin );
if( buttonState == LOW ) {
sensetemp = true;
}
// Request temperature conversion
if (sensetemp == true && framerate%3000 == 0) {
dallas.requestTemperatures();
// get the temperature in Celcius
float tempC = dallas.getTempCByIndex(0);
// convert to double
temperature = (double)tempC;
// convert to Fahrenheit
float tempF = DallasTemperature::toFahrenheit( tempC );
// convert to double
temperatureF = (double)tempF;
if (temperatureF < 155 && temperatureF > 145 && !readytodrink) {
bool success;
success = Particle.publish("readytodrink");
if (success) {
readytodrink = true;
}
}
if (temperatureF < 122 && !gettingcold) {
bool success;
success = Particle.publish("gettingcold");
if (success) {
gettingcold = true;
}
}
/*if (temperatureF < 122) {
gettingcold = true;
}*/
}
/*delay(5000);*/
}
/*
The API request will look something like this:
GET /v1/devices/{DEVICE_ID}/temperature
# EXAMPLE REQUEST IN TERMINAL
# Device ID is 0123456789abcdef
# Your access token is 123412341234
curl -G https://api.particle.io/v1/devices/0123456789abcdef/temperature \
-d access_token=123412341234
*/
Click to Expand
This project is so far just a prototype and not a finalised version. I would like to design a solid form for this object instead of dipping just a waterproof temperature sensor in a cup of tea. It would be nice if there was some design to the object and if the circuitry was smaller and not shown through. Other iterations could be added into this project for brewing the perfect cup of tea. For example, the milk to water ratio could be analysed as well as telling you when to remove the tea bag.
This project taught me a lot about connecting Particle to online applications and reading data through these. The “If This Then That” website taught me how easy it was to read incoming data from Particle or any other transmitting device and create alerts through other devices. Having the option to send Tweets, FB posts, texts and emails through allowed for so many options for this project as well as an easy way to create if statements.
I think I did achieve everything I wanted to do with this project in the technical terms although it is too bad that I didn't have enough time to make it a polished product.
Code used for the temperature sensor:
http://diotlabs.daraghbyrne.me/3-working-with-sensors/DS18B20/
Button input code:
http://diotlabs.daraghbyrne.me/5-getting-input/buttons/
IFTTT website used for the sms messaging:
A simple solution for all the scalded tongues and dissatisfied mouthfuls. Tea time lets you know when is the perfect time to drink your tea, and reminds you not to forget to drink it!