David DohenyWill Green
Published

MEGR 3171 PC Temperature Sensor

This project involves utilizing two Particle Argons to sense PC Temperature and notify the user through the use of LEDs

BeginnerShowcase (no instructions)101
MEGR 3171 PC Temperature Sensor

Things used in this project

Hardware components

Argon
Particle Argon
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Anker Power Supply
×1
Temperature Sensor
Temperature Sensor
×1
LED (generic)
LED (generic)
×3
Capacitor 10 nF
Capacitor 10 nF
×1
Resistor 220 ohm
Resistor 220 ohm
×3

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service

Story

Read more

Schematics

Temperature Sensor

Temperature Receiver

Temperature Vs Time Graph Utilizing IFTTT Program

Temperature Sensor Circuit

Temperature Receiver Circuit

Code

Temperature Sensor

C/C++
This code converts the TMP36 sensor reading into a useable temperature and sends the value to the data receiving argon
int TMP36 = A3;
int Vo;
int reading;
int Temp;
int LedOn;
double temperature = 0.0;
void setup() {
    pinMode(D7, OUTPUT);
    Particle.variable("temperature", &temperature, DOUBLE);
    Particle.subscribe ("Led", abc);
    pinMode (TMP36, INPUT);
}
void loop() {
//converts TMP36 reading into a useable temperature value
  Vo = analogRead(TMP36);
  Temp = (TMP36);
  int reading = analogRead(TMP36);
  double voltage = (reading * 3.3) / 4095.0;
  temperature = (voltage - 0.5) * 100;
//sends data to other argon
  Particle.publish("Celcius", String(temperature), PRIVATE);
  delay(2000);
}
void abc(const char *eventName, const char *data)
{ 
//lights up D7 pin to confirm that the other argon has recieved the data
    digitalWrite(D7, HIGH);
 } 

Temperature Receiver

C/C++
This code tells the data receiving argon which LED to light up depending on the temperature value.
float V=1;
int Led;
int temperature;
void setup() {
    pinMode(D3, OUTPUT);
    pinMode(D2, OUTPUT);
    pinMode(D4, OUTPUT);
    Particle.subscribe ("Celcius", Light, MY_DEVICES);
}
 // Turns on the lights depending on the temperature range specified
void Light(const char *event, String data) {
    temperature=data.toInt();
    if (temperature<=35){
        digitalWrite(D2, HIGH);
        digitalWrite(D3, LOW);
        digitalWrite(D4, LOW);
    }
    else if (temperature>=35 && temperature<= 50){
        digitalWrite(D3, HIGH);
        digitalWrite(D2, LOW);
        digitalWrite(D4, LOW);  
    
    }
    else if (temperature>= 50){
        digitalWrite(D4, HIGH);
        digitalWrite(D2, LOW);
        digitalWrite(D3, LOW);   
    }
    else {
        digitalWrite(D2, LOW);
        digitalWrite(D3, LOW);
        digitalWrite(D4, LOW);
    }
    String connect = String(V);
Particle.publish("Led");
}

Credits

David Doheny

David Doheny

1 project • 0 followers
Will Green

Will Green

1 project • 0 followers
Thanks to Connor Rice, Alexa Caldwell, and Diot Labs.

Comments

Add projectSign up / Login