Smart Thermometer

Made by marcgut8712

A thermometer that only measures temperature when it is placed in a dark environment (e.g. your mouth). Fever will be displayed with a red LED, normal temperatures with a green LED.

Created: January 27th, 2015

0

The smart thermometer has a photosensitive temperature sensor that only gets activated when a certain darkness threshold has been reached. Then, the temperature sensor measures the temperature and shares it through the cloud variables. It also decides whether to light up the red light (fever, >37  Celsius) or the green light (all ok, <37 Celsius). I've solved this with an if (Temperature) within an if (Brightness).

The temperature sensor was very unreliable and even after a calibrating phase produced not very consistent results.


BOM:

- Temperature Sensor

- Photocell

- 1 x Green Led, 1x Red Led

-3 x 1kΩ Resistor

- Breadboard, Wifi Spark & Jumper wires

0
0
const int tempPin = A0;
const int photoCell = A1;
const int ledPinG = D0;
const int ledPinR = D1;
const int photoCellReading = 0;
const int tempPinon = 0;
int lightlevel, high = 0, low = 4095;

double temperature = 0.0;
double temperatureF = 0.0;

void setup()
{
  pinMode(tempPin, INPUT);
  pinMode(ledPinG, OUTPUT);
  pinMode(ledPinR, OUTPUT);
// Register a Spark variable here
Spark.variable("temperature", &temperature, DOUBLE);
Spark.variable("temperatureF", &temperatureF, DOUBLE);
Spark.variable("light", &lightlevel, INT);


}


void loop() {
// Use analogRead to read the photo cell reading
// This gives us a value from 0 to 4095
lightlevel = analogRead(photoCell);

  if (lightlevel < 50)
  {
    // Keep reading the sensor value so when we make an API
  // call to read its value, we have the latest one
  int reading = analogRead(tempPin);
  // The returned value from the Core is going to be in the range from 0 to 4095
  // Calculate the voltage from the sensor reading
  double voltage = (reading * 3.3) / 4095.0;
  // Calculate the temperature and update our static variable
  temperature = (voltage - 0.25) * 100;
  // Now convert to Farenheight
  temperatureF = ((temperature * 9.0) / 5.0) + 32.0;

  // -----------------
  // Read temperature
  // -----------------
  // Define the Pin the Temperature sensor is on
  // Create a cloud variable of type integer
  // called 'light' mapped to photoCellReading
  if (temperature < 37)
    {digitalWrite(ledPinG, HIGH);
      delay (5000);
    digitalWrite(ledPinG, LOW); }
  if (temperature > 37)
    {digitalWrite(ledPinR, HIGH);
      digitalWrite(ledPinG,LOW);
      delay (5000);
      digitalWrite(ledPinR, LOW);
      }
  }
Click to Expand
x
Share this Project


About

A thermometer that only measures temperature when it is placed in a dark environment (e.g. your mouth). Fever will be displayed with a red LED, normal temperatures with a green LED.