Technical Specs

Picture
       An LM35 Precision Temperature Sensor is attached to an Arduino microcontroller. The sensor takes 8 readings per second and reports  their average, in both Celsius and Farenheit, to the Arduino software’s serial monitor. Also attached to the Arduino are a series of lights that receive input from the serial monitor and light up depending on the temperature reported.
           Temperatures reported in the pre-determined normal range mean green lights, while slightly elevated temperatures (possibly caused by the weather or some exertion on the part of the wearer) make the Sensi-Safe® glow yellow. Temperatures more than two degrees above normal make the Sensi-Safe® go red. The Arduino counts  the number of readings that are more than two degrees above normal, and if they are consistently high for more than a pre-determined number of counts, the red lights will begin to flash.


 


Picture
int pin = 0; // analog pin
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;
int LED = 13;
int LED2 = 12;
int LED3 = 11;
int count=0;

void setup()
{
  Serial.begin(9600); // start serial communication
  pinMode(LED, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
}

void loop()
{
 
 
for(i = 0;i<=7;i++){ // gets 8 samples of temperature
 
  samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
  tempc = tempc + samples[i];
  delay(200);

}

tempc = tempc/8.0; // better precision
tempf = (tempc * 9)/ 5 + 32; // converts to fahrenheit

if(tempc > maxi) {maxi = tempc;} // set max temperature
if(tempc < mini) {mini = tempc;} // set min temperature

Serial.print(tempc,DEC);
Serial.print(" Celsius, ");

Serial.print(tempf,DEC);
Serial.print(" fahrenheit -> ");

Serial.print(maxi,DEC);
Serial.print(" Max, ");
Serial.print(mini,DEC);
Serial.println(" Min");
Serial.print("count is:");
Serial.println(count);

if (tempc > 33) {
digitalWrite(LED, HIGH);
count=count+1;
if (count >2) {
for(int i=0;i<20; i++) {
  digitalWrite(LED, HIGH);   // set the LED on
delay(200);                  // wait for a second
digitalWrite(LED, LOW);    // set the LED off
delay(200);
}
}
}

if (tempc < 34) {
count=0;
}

if (tempc > 26) {
digitalWrite(LED2, HIGH);
}
else digitalWrite(LED2, LOW);

if (tempc > 1)
{
  digitalWrite(LED3, HIGH);
}
else digitalWrite(LED3, LOW);

}