HomeHack: A Smart Tea Kettle

Made by xinm

My HomeHack project is for tea lovers to know when the water is within the best range of temperature to steep tea.

Created: February 2nd, 2017

0

Problem Statement:

My parents are tea lovers. They always desired a perfect water temperature to steep tea. They would benefit from a IoT kettle that knows when the water is ready and is able to alert them. I want to solve this problem because the appliance serves as an alert that could satisfy a lot of tea lovers.


0

GOAL:

My goal is to connect a waterproof temperature sensor, three buttons and three LED lights onto a photon breadboard. Three buttons and three LED lights refer to the tea kinds the users need to input. Users input their choice by pressing a button and they can change their choice at anytime. When the water is ready, users get a LED alert if the water is boiled / cooled down to the right temperature for a certain kind of tea. The three tea options are 1. White/Green, 2. Olong, 3. Black/Herbal Tea.  

0

Process:

  •  Components used: Photon board, jumper wires, waterproof temperature sensors, 3 buttons, 3 different LED lights, resistors.

  • Assembling Circuits:

Build basic circuits based on Online Tutorial (http://diotlabs.daraghbyrne.me/3-working-with-sensors/DS18B20/)

1 Wiring Circuit based on temperature Sensor Tutorial.JPG

Build basic circuits based on Online Tutorial (http://diotlabs.daraghbyrne.me/3-working-with-sensors/DS18B20/)

2 Trying one LED.JPG

Trying one LED light.

3 Wiring.JPG

Wiring.

4 Three LED wired and Jesse helped me organize my breadboard.JPG

Fixing mistakes and Organizing the board with Jesse’s help. 


 5 Soldering jumper wire to temperature sensor.JPG

Soldering jumper wires onto the temperature sensor. 

6 Wiring WaterProof Temperature Sensor .JPG

Waterproof temperature sensor

6 wiring waterproof temperature sensor.JPG

Wiring temperature sensor onto board.

  • Coding process:

I downloaded library codes and tested the temperature sensor based on the online tutorial. (http://diotlabs.daraghbyrne.me/3-working-with-sensors/DS18B20/)

First I planned my pseudocode with the help of Professor Brockmeyer.

Pseudocode.JPG

Based on the plan, I transferred the algorithm into actual codes. I did not change the library codes for reading temperature.



Testings:

7 LED 1 For White & Green Tea Alert.JPG

Testing LED 1: White/Green Tea

LED 2 for Olong TEa.JPG

Testing LED 2: Olong Tea

9 LED 3 Black/herbal Tea Alert.JPG

Testing LED 3: Black/Herbal Tea

Testing button use as variable state.png

Testing buttons(as variable state 1,2,3)

Check the accuracy of Sensor .png

Testing the accuracy of the temperature Sensor.

Use Cloud function to fake temperatureF for testing purpose.png

Using setTemp to simulate a real temperature of boiled water.

After setTemp(180).png

After setTemp(180), temperatureF is changed to 180. The corresponding LED is lit.


0

Code:

-1
// This #include statement was automatically added by the Spark IDE.
#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;
double fakeTemp = 0.0;
#include <math.h>

int LedPin1 = D2;
int LedPin2 = D3;
int LedPin3 = D4;

int Button1 = D5;
int Button2 = D6;
int Button3 = D7;
int state = 0;

int button1State = HIGH;
int button2State = HIGH;
int button3State = HIGH;

long frameCount = 0;

void setup()
{
  // Register a Particle Core variable here
  Particle.variable("temperature", &temperature, DOUBLE);
  Particle.variable("temperatureF", &temperatureF, DOUBLE);
  Particle.variable("state", state);

  Particle.function("setTemp", setTemp);

  pinMode(LedPin1, OUTPUT);
  pinMode(LedPin2, OUTPUT);
  pinMode(LedPin3, OUTPUT);
  pinMode(Button1, INPUT_PULLUP);
  pinMode(Button2, INPUT_PULLUP);
  pinMode(Button3, INPUT_PULLUP);

  // setup the library
  dallas.begin();

  Serial.begin(9600);

}


void loop()
{
  frameCount++;

  if(frameCount%3000 == 0)  {
    // Request temperature conversion (traditional)
    dallas.requestTemperatures();

    sin( 23423 );

    // 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;

    //USE FOR TESTING
    temperatureF = fakeTemp;

    /*// Print out
    Serial.print( "Temp in C = ");
    Serial.print( tempC );
    Serial.print( "\t\t F = ");
    Serial.println( tempF );*/
  }

  button1State = digitalRead(Button1);
  button2State = digitalRead(Button2);
  button3State = digitalRead(Button3);

  if(button1State == LOW) {
    state = 1;
  }
  if(button2State == LOW) {
    state = 2;
  }
  if(button3State == LOW) {
    state = 3;
  }

  /*Serial.println(state);*/


//White/Green Tea
if (state ==1 ) {
  turnLedOff();
  if (temperatureF >= 170 && temperatureF <= 185) {
    digitalWrite(LedPin1, HIGH);
    digitalWrite(LedPin2, LOW);
    digitalWrite(LedPin3, LOW);
  }
 else {
   digitalWrite(LedPin1, LOW);
 }
}

//Olong
if (state ==2){
  turnLedOff();
  if(temperatureF >= 180 && temperatureF <= 190){
    digitalWrite(LedPin2, HIGH);}

    else{
      digitalWrite(LedPin2, LOW);}}

//Black/Herbal
if (state ==3){
   turnLedOff();
   if(temperatureF >= 208 && temperatureF <= 212){
     digitalWrite(LedPin3, HIGH);
     digitalWrite(LedPin2, LOW);
     digitalWrite(LedPin1, LOW);}
    else{
      digitalWrite(LedPin3, LOW);}}

/*delay(5000);*/
}

void turnLedOff(){
  digitalWrite(LedPin3, LOW);
  digitalWrite(LedPin2, LOW);
  digitalWrite(LedPin1, LOW);

}

int setTemp(String input) {

  fakeTemp = atoi(input);
  return 0;
}

/*
The API request will look something like this:
GET /v1/devices/{DEVICE_ID}/temperature

# EXAMPLE REQUEST IN TERMINAL
# Core 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
0

Challenges and Help Received:

I did not have any experience with circuits. So when I had the plan to connect the sensors and buttons onto the board. I did not know how they are supposed to connect to each other. I even broke a sensor due to erroneous circuiting. Jesse was very helpful that he taught me how basic circuit work and other things like organizing board. When I first wired the circuits myself, there was a short circuit issue. Jesse also helped me to pinpoint the problem in order to correct it. 

For the programming part, although had experience in programming, I did not know how to use cloud functions, variables, and translate algorithm that would work correctly on a photon board. Through the learning process, I learned those skills.  

0

Outcome & Reflection

Outcome:

The projected satisfied my original goal that LED lights would inform the user whether the water is ready or not. Things I want to implement are:1. LED lights that can inform the water is too hot or too cold. 2. Alert message sent to phones / sound alert. 

Reflection:

I learned a lot from this project. I learned the basics of a circuit, soldering, basic coding on Particle Dev, organizing board and so on. I am satisfied about what I have learned; however, I wish I had practiced with the tutorials more before building on my own. In order to implement more advanced features, I need to learn how to connect this appliance to other IoT such as computers and phones, or other cookwares. I also need to know different components better in order to program them in a correct and concise manner. 



x
Share this Project


Focused on
About

My HomeHack project is for tea lovers to know when the water is within the best range of temperature to steep tea.