Smart Kettle – Prototype


The idea:


1 = User blows into straw 1 which is fed into Flow sensor 1 in order to mimic water being poured into the kettle.

2 = User blows into straw 2 which is fed into Flow sensor 2 in order to mimic water being poured out the kettle.

This prototype deliberately uses no water. This is because i did not want to risk the potential of water damaging the components while it is out on display for people to use.

Substituting Air for Water still allows the flow sensors to collect data and can be used to show that the LCD, buzzer and LEDs all function as they should.








Smart Kettle – Blog 7 – Adding Buzzer & LEDs


There is the code i added in order to set up the 5 LEDs

LED-PIN13 = >300ML = White LED ON

LED-PIN12 = >600ML = Green LED ON

LED-PIN11 = >900ML = Yellow LED ON

LED-PIN10 = >1200ML = Orange LED ON

LED-PIN9 = >1500ML = Red LED ON


I did not have the correct colour types of LEDs, so i improvised and use the ones i had available.


2018-04-19 (4)

2018-04-19 (5)

2018-04-19 (6)

2018-04-19 (7)


It works!

Flow sensor 1 >300ML = White LED ON

 Flow sensor 1 >600ML = Green LED ON

Flow sensor 1  >900ML = Yellow LED ON

Flow sensor 1 >1200ML = Orange LED ON

Flow sensor 1 >1500ML = Red LED ON


Next Step: Add in the buzzer and thresholds 



NEW CODE to allow the LEDs to turn off when water contain of kettle decreases:

#include <LiquidCrystal_I2C.h>
#include <Wire.h>

#define WATER_IN 0
#define WATER_OUT 1

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

int statusLedWhite = 13;
int statusLedGreen = 12;
int statusLedYellow = 11;
int statusLedOrange = 10;
int statusLedRed = 9;

const int buzzer = 7; //buzzer to arduino pin 7


int sensorInterrupt[2] = { 0, 1 };
int sensorPin[2] = { 2, 3 };


float calibrationFactor = 4.5;

volatile int pulseCount[2];

float totalLitres[2];

unsigned long oldTime;

* Interrupt Service Routine 0
void pulseCounter0()
// Increment the pulse counter

* Interrupt Service Routine 1
void pulseCounter1()
// Increment the pulse counter

void calc_flowrate(int index, void (*func)())
float flowRate = 0;
float duration = millis() – oldTime;

// Disable the interrupt while calculating flow rate and sending the value to
// the host

// Because this loop may not complete in exactly 1 second intervals we calculate
// the number of milliseconds that have passed since the last execution and use
// that to scale the output. We also apply the calibrationFactor to scale the output
// based on the number of pulses per second per units of measure (litres/minute in
// this case) coming from the sensor.
flowRate = ((1000.0 / duration) * pulseCount[index]) / calibrationFactor;

// Divide the flow rate in litres/minute by 60 to determine how many litres have
// passed through the sensor in this 1 second interval, then multiply by 1000 to
// convert to millilitres.
flowRate = (flowRate/60 * 1000);

// Add the millilitres passed in this second to the cumulative total
totalLitres[index] += flowRate;


// Reset the pulse counter so we can start incrementing again
pulseCount[index] = 0;

// Enable the interrupt again now that we’ve finished sending output
attachInterrupt(sensorInterrupt[index], func, FALLING);

void setup() {

// put your setup code here, to run once:


// Setup sensor 0
pinMode(sensorPin[WATER_IN], INPUT);
digitalWrite(sensorPin[WATER_IN], HIGH);

// Setup sensor 1
pinMode(sensorPin[WATER_OUT], INPUT);
digitalWrite(sensorPin[WATER_OUT], HIGH);

pulseCount[0] = pulseCount[1] = 0;
totalLitres[0] = totalLitres[1] = 0;
oldTime = 0;

lcd.print(” ml/S”);

lcd.print(” ml/S”);

Serial.begin(9600); //Start Serial

pinMode(statusLedWhite, OUTPUT);
digitalWrite(statusLedWhite, LOW);

pinMode(statusLedGreen, OUTPUT);
digitalWrite(statusLedGreen, LOW);

pinMode(statusLedYellow, OUTPUT);
digitalWrite(statusLedYellow, LOW);

pinMode(statusLedOrange, OUTPUT);
digitalWrite(statusLedOrange, LOW);

pinMode(statusLedRed, OUTPUT);
digitalWrite(statusLedRed, LOW);

pinMode(buzzer, OUTPUT); // Set buzzer – pin 7 as an output


void sound_buzzer()
if (totalLitres[WATER_IN] >= 300 ) // Buzzer on over 300ml
tone(buzzer, 1000); // Send 1KHz sound signal…
delay(1000); // …for 1 sec
noTone(buzzer); // Stop sound…

void loop()
if ((millis() – oldTime) > 500) // Only process counters once per second
calc_flowrate(WATER_IN, pulseCounter0);
calc_flowrate(WATER_OUT, pulseCounter1);

float waterLeft = totalLitres[WATER_IN] – totalLitres[WATER_OUT];

lcd.print(” ml/S”);

lcd.print(” ml/S”);

// Note the time this processing pass was executed. Note that because we’ve
// disabled interrupts the millis() function won’t actually be incrementing right
// at this point, but it will still return the value it was set to just before
// interrupts went away.
oldTime = millis();

digitalWrite(statusLedWhite, (waterLeft >= 300 ? LOW : HIGH));
digitalWrite(statusLedGreen, (waterLeft >= 600 ? LOW : HIGH));
digitalWrite(statusLedYellow, (waterLeft >= 900 ? LOW : HIGH));
digitalWrite(statusLedOrange, (waterLeft >= 1200 ? LOW : HIGH));
digitalWrite(statusLedRed, (waterLeft >= 1500 ? LOW : HIGH));

Smart Kettle – Blog 4 – Buzzer

KEPO Piezo buzzer




What is a Buzzer?

An electrical device that makes a buzzing noise and is used for signalling.

Buzzer Set Up:


Required Components:

  • Arduino Uno
  • Breadboard
  • Buzzer / piezo speaker
  • 3 Wires
  • 100 Ohm resistor (optional, protects Buzzer and Arduino board)


3 Wires:

Red – Power

Black – GND

Orange – Link between Buzzer and Arduino Board





Test Code:

2018-04-17 (4)




Next step, link buzzer with a data level threshold. e.g. when data reaches 300ml, 600ml, 900ml etc.

Smart Kettle – Blog 3 – 2×16 LCD


Liquid Crystal Display 16×2:

The parallel interface consists of the following pins:

  • Power Supply pins (Vss/Vcc): Power the LCD
  • Contrast pin (Vo): Control the display contrast
  • Register Select (RS) pin: Controls where in the LCD’s memory you’re writing data to
  • Read/Write (R/W): Selects reading mode or writing mode
  • Enable pin: Enables writing to the registers
  • 8 data pins (D0 -D7): The states of these pins (high or low) are the bits that you’re writing to a register when you write, or the values you’re reading when you read.
  • Backlight (Bklt+ and BKlt-) pins: Turn on/off the LED backlight




This LCD is fitted with a jumper i2c unit.



This jumper kit allows us to reduce the wiring to just 4 connection:

  1. GND on i2c jumper – BLACK WIRE – GND on Arduino Board
  2. VCC on i2c jumper – RED WIRE – 5V on Arduino Board
  3. SDA on i2c jumper – Any colour – A4 on Arduino Board
  4. SCL on i2c jumper – Any colour – A5 on Arduino Board


Fritzing for LCD:



Required Components:

  • Arduino Uno
  • Breadboard
  • LCD 16×2
  • 4 wires




2018-04-17 (3)




This test simply Displays the words “Hello world” on the LCD to show they it works.


I then showed that the printed text could be changed.


Next Step

Using the LCDs 16×2 capability.



Cursors can be moved using commands.

Line 1 = Row 0

Line 2 = Row 1



Line 2 = “(x)Water stored in kettle/ml”


Functions being used:

  1. The lcd.begin(16,2) command set up the LCD number of columns and rows. For example, if you have an LCD with 20 columns and 4 rows (20×4) you will have to change this to lcd.begin(20×4).


  1. The lcd.print(“–message–“) command print a message to first column and row of lcd display. The “message” must have maximum length equal to lcd columns number. For example, for 16 columns display max length is equal with 16 and for 20 columns display max length is equal with 20.


  1. The lcd.setCursor(0,1) command will set cursor to first column of second row. If you have an LCD 20×4 and you want to print a message to column five and third row you have to use: lcd.setCursor(4,2).



2018-04-17 (5)


I added code so that i could utilize the second row of the LCD.


Next Step:

Keeping the “mls” as a constant on the second row and only having the numeric data update.









Smart Kettle – Blog 2 – Water Flow Sensor


Water Flow Sensor

What do we need to know?


How does it work?

YF-S201 Hall-Effect Water Flow Sensor:

  • The Arduino flow meter works on the principle of the Hall Effect.
  • According to the Hall Effect, a voltage difference is induced in a conductor transverse to the electric current and the magnetic field perpendicular to it.
  • The Hall Effect is utilized in the flow meter using a small fan/propeller-shaped rotor, which is placed in the path of the liquid flowing. dfsfg

  1. The liquid pushes against the fins of the rotor, causing it to rotate.
  2. The shaft of the rotor is connected to a Hall Effect sensor.
  3. It is an arrangement of a current flowing coil and a magnet connected to the shaft of the rotor, thus a voltage/pulse is induced as this rotor rotates.


Arrows will indicate the flow direction of the sensor…


  • In this flow meter, for every litre of liquid passing through it per minute, it outputs about 4.5 pulses.
  • This is due to the changing magnetic field caused by the magnet attached to the rotor shaft as seen in the picture below.
  • We measure the number of pulses using an Arduino and then calculate the flow rate in litres per hour (L/hr) using a simple conversion formula explained in step 2.


  • This sensor sits in line with the water line and contains a pinwheel sensor to measure how much water has moved through it.
  • There is an integrated magnetic Hall-Effect sensor that outputs an electrical pulse with every revolution.

A Few Considerations:

  • These are not able to monitor a flow of less than 1 litre per minute or in excess of 30 litres per minute.
  • The sensor is rated to a Maximum of 2.0MPa (290 PSI)
  • This type of sensor can be found on different diameters, water pressure (MPa) and flow rate (L/m) ranges.
  • Make sure to select one that will cover your needs.
  • The sensor that I have it has 20mm diameter, <1.75Mpa water pressure and ~30 L/m flow rate range.


3 Wires: Red/VCC (5-24V DC Input), Black/GND (0V) and Yellow/OUT (Pulse Output).

Connecting the Arduino to the Flow Rate Sensor:

3 wires required:

  1. The 5V VCC (red wire)
  2. The GND (black wire)
  3. The signal/pulse (usually yellow) line.


  • Connect the VCC and GND of the flow meter to the Arduino’s VCC and GND.
  • The pulse line of the flow rate sensor is connected to the Arduino’s digital pin 2.
  • The Arduino’s digital pin 2 serves as an external interrupt pin (interrupt pin 0).


Uploading the Flow Meter Code to the Arduino and Measuring Water Flow Rate:


  • The code uses an external interrupt on the Arduino’s digital pin 2.
  • (This is used to read the pulses coming from the flow meter)
  • When the Arduino detects the pulse, it immediately triggers the pulse Counter () function. This function then counts the total number of pulses.


Maths Calculations:

  • 1L of Liquid = 4.5 Pulses (Output)
  • Divide the output pulse by 4.5 = quantity of liquid passing through the sensor per minute.
  • Quantity of Liquid Flowing through sensor ÷ 60 (Per hour) = Total amount of liquid passing through the sensor.

10K OHM Pull UP Resistor is required to prevent input data floating (Brown, Black, and Orange)

(Forces the output to be an ON or an OFF)

Relationships for Calculations:

Q = Flowrate.

V = Velocity liquid is travelling at.

A = Cross sectional Area of flow sensor pipe.


  • Q = V*A
  • Pulse frequency (Hz) = 7.5Q, Q is flow rate in Litres/minute
  • Flow Rate (Litres/hour) = (Pulse frequency x 60 min) / 7.5Q
  • Sensor Frequency (Hz) = 7.5 * Q (Litres/min)
  • Litres = Q * time elapsed (seconds) / 60 (seconds/minute)
  • Litres = (Frequency (Pulses/second) / 7.5) * time elapsed (seconds) / 60
  • Litres = Pulses / (7.5 * 60)

Purchasing the Component:

YF-S201 Hall Effect Water Flow Meter / Sensor


  • Model: YF-S201
  • Sensor Type: Hall effect
  • Working Voltage: 5 to 18V DC (min tested working voltage 4.5V)
  • Max current draw: 15mA @ 5V
  • Output Type: 5V TTL
  • Working Flow Rate: 1 to 30 Liters/Minute
  • Working Temperature range: -25 to +80℃
  • Working Humidity Range: 35%-80% RH
  • Accuracy: ±10%
  • Maximum water pressure: 2.0 MPa
  • Output duty cycle: 50% +-10%
  • Output rise time: 0.04us
  • Output fall time: 0.18us
  • Flow rate pulse characteristics: Frequency (Hz) = 7.5 * Flow rate (L/min)
  • Pulses per Liter: 450
  • Durability: minimum 300,000 cycles
  • Cable length: 15cm
  • 1/2″ nominal pipe connections, 0.78″ outer diameter, 1/2″ of thread
  • Size: 2.5″ x 1.4″ x 1.4″

Connection details:

  • Red wire : +5V
  • Black wire : GND
  • Yellow wire: PWM output.


Data Sheet: YF-S201 Hall Effect Water Flow Meter / Sensor


How does Arduino interpret this Data?

  1. The Arduino Sketch (code) uses the external interrupt (int 0) on Arduino’s digital pin 2 (D2).
  2. This is used to read the output pulses coming from the water flow sensor.
  3. When Arduino detects the pulse, it immediately triggers the pulse Counter () function.
  4. This function then counts the total number of pulses detected


Some Code to Test:

Code Help and Very Clear breakdown of coding:


Lets Test!





3 wires required:

  1. The 5V VCC (red wire)
  2. The GND (black wire)
  3. The signal/pulse (usually yellow) line.
  • Connect the VCC and GND of the flow meter to the Arduino’s VCC and GND.
  • The pulse line of the flow rate sensor is connected to the Arduino’s digital pin 2.
  • The Arduino’s digital pin 2 serves as an external interrupt pin (interrupt pin 0).


Code Created:

2018-04-17 (2)

Video Test:

The turbine inside the flow sensor reacts to air flow as well as water, so i tested the sensor by blowing into the input opening.

The serial port data which came back is presented in Litres per min.

Smart Kettle – Blog 1 – Sustainable computing

Encouraging water reduction through awareness in water levels

Physical Computing for Sustainable Living


With the busy lives we lead in the current day, we rarely take the time to monitor our use of resources; whether it be power consumption, water consumption, gas etc.

With the help of sensors we can now collect data on how much of certain resources we use, visually show the data on highly accessible platforms such as apps and interactive displays. Thus making it more accessible for people to monitoring how much of certain resources they use and be more aware of when they waste resources.


Project Concept:

Problem Area:  overfilling kettle with more water than required.

Resources to reduce usage of: Water, Electricity required to heat water.



  • You are making 1 cup of coffee.
  • This requires 1 cups worth of hot water.
  • The kettle is empty.
  • You go to the tap and fill up the kettle.
  • You have the tap on full speed because you are impatient.
  • You aren’t aware of how much water is in the kettle and you over fill by 1.5 cups.
  • You then turn on the kettle and heat up 2.5 cups worth of water.
  • You then proceed to only use 1 cups worth of water.
  • The remaining 1.5 cups worth of water is left to get cold.
  • Why did you heat up the extra water? Why did you waste energy?
  • Because you are not aware of how much water is in the kettle and you aren’t aware of when to stop.



So what’s my proposition?

 Smart Kettle

Kettle which beeps when each mug (300ml) level of water is reached.

Kettle Labelled

Kettle cross section



  1. Pour water in kettle
  2. Water passes through flow sensor 1 located at water input hole
  3. Data is collected and Stored
  4. When 300ml of water have passed through the flow sensor; Buzzer actives. LED 1 Activates.
  5. Reset Flow Sensor. (0ml)
  6. Kettle is turned on.
  7. Water is heated.
  8. Water Exits kettle through flow sensor 2 located at water exit hole.
  9. Data on water passing out of flow sensor 2 is collected and presented visually – LEDs, LCD showing ml’s left in kettle.


Components required:

  • Arduino Uno
  • Water Container or Kettle
  • Water Flow Sensor x2?
  • Buzzer/Beeper
  • Water Level Sensor?
  • Resistors?


Input Sensors:

  • Water Flow Sensors x2 (water input, water exit)


Output Components:

  • Buzzer/Beeper
  • LEDs
  • LCD Display?


How much water does an average coffee mug hold?


Mid Figure = 300ml



Maths for Working out mass from Flow rate:

  • Water to Mass Ratio = 1:1 (1 litre = 1kg)
  • Volumetric Flow Rate = Standard Cubic Centimetres per Minute (cm3/m)
  • Or
  • Cubic Meters per Second (m3/s)
  • 1 Cubic Metre = 1,000,000ml (1000 Litres




 Flow Rate Readings > Convert to ml > Display on LCD

  • 300ml = 1 Mug = 0.0003 Cubic Meters > White LED
  • 600ml = 2 Mug = 0.0006 Cubic Meters > Green LED