Dale ParsonsTeodor Sacuiu
Published

Remote Temperature Sensing System with Alarm

Senses internal temp of fridge as well as when your preferred drink is at the optimum temperature. Alarm is triggered if door is opened.

BeginnerFull instructions provided3 hours789
Remote Temperature Sensing System with Alarm

Things used in this project

Hardware components

Photon
Particle Photon
--1 photon incorporates 2 thermistors and 1 photoresitor to sense the internal temp of fridge, as well as preferred drink and when its at a optimal temp to drink --1 photon used with a buzzer alarm system to trigger if the fridge door is open as well as signaling when the drink is a the proper temperature. This photon also has a button to turn off the alarm as well as to send the signal to initiate the data collection of the thermistors.
×2
uxcell 10K Ohm 0.05W 3435B NTC Thermistors Resistor MF52-103
--1 thermistor is used to record the general temperature of the fridge --1 thermistors used to record a specific drink temperature and when it is ready for you to drink
×2
Resistor 10k ohm
Resistor 10k ohm
×3
Photo resistor
Photo resistor
will sense the fridge light turning on if the door is opened and will send a signal to the alarm on the other photon
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
--1 button will send the signal to the fridge photon to tell it to start collecting data for the drink temperature publish event.
×1
Buzzer
Buzzer
Buzzer will trigger an alarm if the fridge is open so that you know if someone is stealing your drink, the buzzer also will trigger a different sound when the drink of your choice is at the preferred temperature to drink
×1

Software apps and online services

Maker service
IFTTT Maker service

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Wire Stripper & Cutter, 30-20 AWG / 0.25-0.81mm Capacity Wires
Wire Stripper & Cutter, 30-20 AWG / 0.25-0.81mm Capacity Wires

Story

Read more

Schematics

Photon 2 picture

Schematic

Circuit Diagram

Fritzing Schematic and Circuit Diagram File

Photon 1 Picture

Code

Photon 1

C/C++
Used for Remotely Sensing the temperature of the fridge as well as a specific drink. Also sends an alarm if the door is opened and also sends a separate longer toned alarm for when the drink has reached the optimal temperature
#include <math.h>  //photon 01 code

 

float Therm1;
float Therm2;
float Photo;
double Resistance1;
double Resistance2;
double Temp1;
double Temp2;
double TempF1;
double TempF2;
const char* door = "Closed";
int count=0;
int count2 =0;
int Button_pressed = 0;



void setup() {

    pinMode(A0,INPUT);
    pinMode(A1,INPUT);
    pinMode(A2,INPUT);
    Particle.subscribe("Button_Ini2", Button);
             }

void Button(const char *event, const char *data)

{
            Button_pressed = 1;
            
          
}


void loop()
{

    Therm1 = analogRead(A0);
    Therm2 = analogRead(A2);
    Photo  = analogRead(A1);
    

    Resistance1 = 9900.0*Therm1/((-Therm1)+4095.0);                                        //Resitace calulation fron ADC
    Resistance2 = 9900.0*Therm2/((-Therm2)+4095.0);                                        //Resitace calulation fron ADC
    Temp1=1.0/(1.0/297.15+1/3950.0*log(Resistance1/10030.0));                               //Temperature Coversion From Resitance In Kelvin
    Temp2=1.0/(1.0/297.15+1/3950.0*log(Resistance2/10030.0));                               //Temperature Coversion From Resitance In Kelvin
    TempF1=(Temp1-273.15) *9.0/5.0 +32.0;                                                   //Temperature Coversion From Kelvin to Farenheit 
    TempF2=(Temp2-273.15) *9.0/5.0 +32.0;                                                   //Temperature Coversion From Kelvin to Farenheit

        
        
        
        if (Photo <= 1500.0 and door=="Closed")                                     // Photoresitor detectect door opening
            {door="Open";                                                           // Door is now open
           Particle.publish("DoorOn", door);}                                          //pubilsh the event 1 time
                
                       
    
        if (Photo >= 1510.0 and door=="Open" )                                      // Photoresitor detectect door closing
            {door="Closed";                                                         // Door is not closed
            Particle.publish("DoorOff", door);}                                        // Publish the event 1 time



        if (millis() >= (count + 300000))                                           // If statment that occuring every 5 min (300000milseconds)
                {count = millis();                                                  // Reset the value of count
                Particle.publish("Temperature_T1", String(TempF1));}                   // publish temeperature1
                        

            
        if ( (TempF2 <= 40.0) and (Button_pressed == 1))                         // If statemnt that says when the temperature of the sensor 2 has a good temeprature
            {
            Particle.publish("Beverage", "Ready");                                     // Publish the envent that says that the sesor has now a cold temperaure
            delay(10);
            Button_pressed = 0;                                                 // Reset the cycle for the button
            }        
            
  
        if ((Button_pressed == 1) and (millis() >= (count2 + 60000)))            // When button was presed, publish the temperautre of the sensor.
        { count2 = millis();
          Particle.publish("Temperature_T2", String(TempF2)); }
}

Photon 2

C/C++
Buzzer alarm that receives a signal if the door is opened and outputs a higher tone. Buzzer also receives and outputs a lower tone alarm for when the drink reaches the optimal temperature. Button sends the initiation signal to photon 1 to start collecting data in real time for the specific drink you want to measure.
//FOR THE ALARM photon 02

 

int Alarm = D0;


 

 

 

void setup() {

 
pinMode(D4,INPUT_PULLUP);
pinMode(Alarm,OUTPUT);
digitalWrite(Alarm,LOW);

Particle.subscribe("DoorOn", soundalarm);
Particle.subscribe("Beverage", beverage);

}


void soundalarm(const char *event, const char *data){


digitalWrite(Alarm,HIGH);
delay(200);
digitalWrite(Alarm,LOW);
delay(200);
digitalWrite(Alarm,HIGH);
delay(200);
digitalWrite(Alarm,LOW);
delay(200);
digitalWrite(Alarm,HIGH);
delay(200);
digitalWrite(Alarm,LOW);
delay(200);

}


void beverage(const char *event, const char *data){
    

digitalWrite(Alarm,HIGH);
delay(600);
digitalWrite(Alarm,LOW);
delay(600);
digitalWrite(Alarm,HIGH);
delay(600);
digitalWrite(Alarm,LOW);
delay(600);
digitalWrite(Alarm,HIGH);
delay(600);
digitalWrite(Alarm,LOW);
delay(600);
digitalWrite(Alarm,HIGH);
delay(600);
digitalWrite(Alarm,LOW);
delay(600);

}





void loop(){
    
    if (digitalRead(D4) == LOW){
    
    Particle.publish("Button_Ini2");
    delay(1000);
    
}
}

Credits

Dale Parsons

Dale Parsons

1 project • 0 followers
Teodor Sacuiu

Teodor Sacuiu

1 project • 0 followers

Comments