H20 Monitor

Water at the perfect temperature

Made by jhjenkin

Created: January 27th, 2015

0

Scenario

H2O monitor is a connected device that both measures the volume of liquid within a container, as well as the liquid’s temperature.

A force sensor measures the weight of the liquid and displays the information via two LEDs. If no pitcher is present on the force sensor, neither LED will light. If a half full pitcher is placed on the force sensor, the red LED will light. Finally, if a full pitcher is place on the force sensor, the green LED will light.

A temperature sensor measure the liquid temperature. This information is also visualized through two LEDs. A warm temperature elicits a red LED, while a cool liquid creates a green LED.

Both the liquid temperature and liquid weight can be accessed via Spark cloud variables.

Process

I began by individually coding in each sensor and verifying that they functioned correctly. While I was checking for sensor operation, I documented the minimum and maximum analogRead() values so that I could set the thresholds in my code later. Once all the components were working correctly, I coded in the status LEDs and finished the wiring. The components are listed below:

(2x) red LED

(2x) green LED

(1x) resistive force sensor

(1x) temperature sensor

(1x) 10KΩ resistor

(4x) 1kΩ resistor

(1x) 103 µf capacitor

various jumpers

0

Circuit Pictures


0

Video

0
0

Spark.variables()

0

Code

0
int temp = A4;
int force = A0;
int tempG = D5;
int tempR = D4;
int forceG = D1;
int forceR = D0;
int forceReading = 0;
int tempReading = 0;
int thresh = 850;

void setup() {

pinMode(tempG, OUTPUT);
pinMode(tempR, OUTPUT);
pinMode(forceR, OUTPUT);
pinMode(forceG, OUTPUT);
  Spark.variable("Force", &forceReading, INT);
  Spark.variable("Temperature", &tempReading, INT);
}

void loop() {

forceReading = analogRead(force);
tempReading = analogRead(temp);

  if (forceReading >= 10 && forceReading < 1000) {
    digitalWrite(forceR, HIGH);
    digitalWrite(forceG, LOW);
  }

    else if (forceReading >=1000) {
    digitalWrite(forceR, LOW);
    digitalWrite(forceG, HIGH);
  }

      else if (forceReading <10) {
    digitalWrite(forceR, LOW);
    digitalWrite(forceG, LOW);
  }


      if (tempReading < thresh) {
    digitalWrite(tempG, HIGH);
    digitalWrite(tempR, LOW);
    }

    else if (tempReading >= thresh) {
    digitalWrite(tempG, LOW);
    digitalWrite(tempR, HIGH);
    }

    delay(100);
}
Click to Expand
x