Time to Drink Water!

Made by Xuejiao Liu

An IoT device to monitor the room temperature/humidity to let people know they should drink water if under a dry condition.

0

Problem statement

The problem is that for my old roomies they never drink water unless they feel thirsty. Even they know it is not good for health, but they always forget to drink water if no one remind them. 

Goal

My solution is to build a device to monitor the room temperature and send alert to remind them the time they should drink water if under a dry condition.

Component

Particle Board 

Temperature Sensor

5 LEDs

Resistors 

Wires 

 Process & Outcome

The original tutorial I used is https://particle.hackster.io/gusgonnet/temperature-humidity-monitor-with-blynk-7faa51?ref=search&ref_id=temperature&offset=2, which is about DH22 sensor to monitor room temperature/humidity via Blynk. Blynk is an app where can connect different hardware such as particle or arduino that user can build their own controls and dashboard to show data they need. However, after I finished my code and set up my dashboard on Blynk, my photon was breathing green. I googled the solution of this issue, and some users think that it has to do with using Blynk. They suggest using system threading or safe mode. In order to save time I restarted my photon and used safe mode, and finally, it was fixed. 

Then I gave up using this app and found another online tutorial https://www.youtube.com/watch?v=KmeGk1A59pE, which has LEDs whose level of brightness is dependent on a temperature sensor connected in the circuit.

However, this is an Arduino Project which is kind of different with Particle, so I modified some code such as equation to adapt to Particle Photon. Based on the research that the range of comfort room temperature is 18°C-24°C, so I set the temperature baseline is 18°C. When the room temperature is below 18°C, all the LEDs are off. When the room temperature is above 24°C, 3 LEDs will light up and I will get an email via IFTTT to remind me that it is time to drink water. The code, circuit diagram, and video will show up later. 

Reflection: 

During this process, I learned that doing IoT you must have enough patience and be careful. You never know what is wrong with either code or circuit unless you check and ask again and again. For this project, I already reached my goal, but I still would like to go deeper. IFTTT is a good app, but sometimes it does not work well for my project that I still need to figure it out.  

0
int sensorPin = A0;
int sensorVal = 0;
int baselineTemp = 18;
int number = 5;
int LedPin [5] = {D0, D1, D2, D3, D4};

void setup(){

 Serial.begin(9600);
 for (int x=2; x<5; x++){
   pinMode(x, OUTPUT);
   digitalWrite(x, LOW);
 }
}



void loop()
{

 sensorVal = analogRead(sensorPin);
 Serial.print (sensorVal);
 Serial.print ("ADC");

double Voltage = (sensorVal/4096.0)*3.3;

 Serial.print (Voltage);
 Serial.print ("Volts,");
 double temperature = (Voltage - .5)*100;

 Serial.print (temperature);
 Serial.print ("degrees C");
 Serial.println();


 if (temperature < baselineTemp){
   digitalWrite(2, LOW);
   digitalWrite(3, LOW);
   digitalWrite(4, LOW);
 }
  else if (temperature >= baselineTemp+2 && temperature < baselineTemp+4){
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }
  else if (temperature >= baselineTemp+4 && temperature < baselineTemp+6){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  }
  else if (temperature >= baselineTemp+6){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
    Particle.publish("temperature","Yo");
  }

  delay(1000);

 }
Click to Expand
0
Video
0

x
Share this Project


About

An IoT device to monitor the room temperature/humidity to let people know they should drink water if under a dry condition.

Created

January 26th, 2017