Cameron BaileyEric CatalanoWilliam Miller
Published

MEGR 3171 Environment and Food Temperature Device

Remotely measure the internal temperature of food and the outside temperature without the hassle of checking.

BeginnerShowcase (no instructions)8 hours13
MEGR 3171 Environment and Food Temperature Device

Things used in this project

Hardware components

Argon
Particle Argon
×3
Breadboard (generic)
Breadboard (generic)
×3
Jumper wires (generic)
Jumper wires (generic)
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
Slide Switch
Slide Switch
×1
Resistor 100k ohm
Resistor 100k ohm
×1
Thermopro Thermistor
×1
LED (generic)
LED (generic)
×5
2.5 mm Female Headphone Jack (Two Pole)
×1

Software apps and online services

ThingSpeak API
ThingSpeak API

Story

Read more

Schematics

Particle Argon (Switch and LED Panel)

This is the Particle schematic for the switch and LED system that is responsible for sending communications to the two other argons notifying the system is ready to run. It is also responsible for receiving and communicating to the user if the temperature of the meat is safe to eat and if the temperature outside is appropriate for grilling.

Particle Argon Thermopro Thermistor

This is the Particle schematic used for the Thermopro thermistor which is responsible for measuring the internal temperature of the food being grilled.

Particle Argon (DHT 11 Element)

This is the Particle schematic used for the DHT 11 Sensor, which is responsible for measuring the outside ambient temp.

Code

DHT 11 Element code

C/C++
This is the code flashed to the Particle argon to measure the ambient temperature data from the DHT 11 sensor. This data also contains the appropriate particle subscribe and publish data to achieve bidirectional communication data through the other argon as well as code to publish data to Thingspeak for live graphs.
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>

// This example assumes the sensor to be plugged into CONN2
#define DHTPIN 2     // what pin we're connected to

// Here we define the type of sensor used
#define DHTTYPE DHT11        // DHT 11 


DHT dht(DHTPIN, DHTTYPE);

bool humid = false;

TCPClient client;


unsigned long myChannelNumber = 1937937;
const char * myWriteAPIKey = "M7BVR2MU0NMF1XPM";

int LEDpin = D7;

void setup() {
    
    ThingSpeak.begin(client);
    
        pinMode(D2, OUTPUT);
        pinMode(LEDpin, OUTPUT);
        
        dht.begin();
        Particle.subscribe("connectiontest", good);
      
}

void good(const char *event, const char *data){
  //  digitalWrite(LEDpin, HIGH);
    digitalWrite(LEDpin, HIGH);
    
}

void loop() {
    // Wait a few seconds between measurements.
    delay(1000);

    // Sensor readings may also be up to 2 seconds 
    // Read temperature as Celsius
    float t = dht.getTempCelcius();
    // Read temperature as Farenheit
    float f = dht.getTempFarenheit();

    ThingSpeak.setField(1,f);
    Serial.print(dht.getTempFarenheit());
    Serial.println("f");
    ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);  
    delay(5000); // ThingSpeak will only accept updates every 15 seconds. 
    
    if (f>=40){     // when the temperature that is obtained from this sensor is greater than the listed 
                    // numerical value it will notify the other argon 
        Particle.publish("ambientTempGood");
        delay(1000);
    }   
   
}

    void l(const char *event, const char *data) {
        
            digitalWrite(D2, HIGH);
            delay(2000);
            digitalWrite(D2, LOW);
            delay(2000);

    }

Thermopro Thermistor Element Code

C/C++
This is the code flashed to the Particle Argon for the Thermopro thermistor sensor to measure the food's internal temperature. This code uses the Steinhart-hart equation to convert counts to change in resistance and change in resistance to the appropriate temperature. Additionally, this code contains the appropriate particle publish and subscribe functions to achieve bidirectional communication with multiple argons and live graphs via Thingspeak.
// This #include statement was automatically added by the Particle IDE.
#include <math.h>

// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>


TCPClient client;

unsigned long myChannelNumber = 1938102;		// Thingspeak channel id*/
const char * myWriteAPIKey = "AQ55Q7SOHHQ3B236";// Channel's write API key*/


const int thermistor_output = A2;

int LEDpin = D7;

void setup() {
    pinMode(LEDpin, OUTPUT);
    Particle.subscribe("connectiontest", good);
    ThingSpeak.begin(client);
double temperature;
}

void good(const char *event, const char *data){
    digitalWrite(LEDpin, HIGH);
}

void loop() {
int thermistor_adc_val;
double output_voltage, thermistor_resistance, therm_res_ln, temperature;
thermistor_adc_val = analogRead(thermistor_output);
output_voltage = ((thermistor_adc_val * 3.3)/ 4095.0);
thermistor_resistance = ((3.3 * (10/output_voltage))-10);
thermistor_resistance = thermistor_resistance * 1000;
therm_res_ln = log(thermistor_resistance);
temperature = (1/(0.001129148 + (0.000234125 * therm_res_ln)+( 0.0000000876741 * therm_res_ln * therm_res_ln))); // solving for temp
temperature = temperature - 273.15;
temperature = ((temperature*1.8) + 32)-15;
ThingSpeak.setField(1,(float)temperature);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
delay(2000);

Particle.publish("Thermistor", String(temperature), ALL_DEVICES);
delay(2000);

if (float(temperature) >145){    // once the data obtained is grater than the number listed, it will notify the other argon
    Particle.publish("grillTempGood", String(temperature));
    delay(1000);
}
else {
}

}

Switch and Notification Panel Code

C/C++
This is the code flashed to the Particle Argon that allows the switch to communicate to the other particle argons and the user that the system is ready to be used. This code also receives temperature data published by the other argons to the cloud and informs the user when it is safe to grill and pull the food off of the grill.
int outsideBad = D6;
int outsideGood = D5;
int foodBad = D3;
int foodGood = D2;
int switchReading = A2;

void setup(){

    pinMode(outsideBad, OUTPUT);
    pinMode(foodBad, OUTPUT);
    pinMode(outsideGood, OUTPUT);
    pinMode(foodGood, OUTPUT);

    digitalWrite(outsideBad, HIGH);
    digitalWrite(foodBad, HIGH);
    Particle.subscribe("ambientTempGood", ambientGood); // ambient temp data
    Particle.subscribe("grillTempGood", grillTemp);    // food internal temp data
    
}


void loop(){
    
      if (analogRead(switchReading) > 2500){
        Particle.publish("connectiontest");
        delay(5000);
      }
        

}

void grillTemp(const char *event, const char *data)
{
    digitalWrite(foodGood, HIGH);
    digitalWrite(foodBad, LOW);

} 

void ambientGood(const char *event, const char *data)
{
    digitalWrite(outsideGood, HIGH);
    digitalWrite(outsideBad, LOW);
    
}

Credits

Cameron Bailey

Cameron Bailey

0 projects • 0 followers
Eric Catalano

Eric Catalano

0 projects • 0 followers
William Miller

William Miller

0 projects • 0 followers

Comments

Add projectSign up / Login