陳諒昕
Published

Forehead thermometer

Make a Forehead thermometer at home!

IntermediateProtip201
Forehead thermometer

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
mlx90614
×1
Switch Actuator, Head for spring return push-button
Switch Actuator, Head for spring return push-button
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1
SSD1306 OLED
×1
Arduino Pro Mini 328 - 3.3V/8MHz
SparkFun Arduino Pro Mini 328 - 3.3V/8MHz
×1
No. 3 battery box
×1
AA Batteries
AA Batteries
×1
Development Kit Accessory, Jumper Wire Kit
Development Kit Accessory, Jumper Wire Kit
×1
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

-78_jHYu6bmkbs.jpg

Code

Forehead gun

C/C++
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include <U8glib.h>

String getSerialChar(HardwareSerial *serial) {
  String content = "";
  content += (char)serial->read();
  return content;
}


float GH;
float a = 0.0;
float b = 0.0;
float c = 0.0;
float d = 0.0;
float e = 0.0;
float f = 0.0;
float g = 0.0;
float h = 0.0;
float i = 0.0;
float j = 0.0;

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI ;
float tmax = 0.00;

void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_fur25);
u8g.setPrintPos(10, 29);
u8g.print(GH,1);
u8g.drawStr( 80, 29, "\260C");
u8g.setPrintPos(10, 63);
u8g.print(tmax,1);
u8g.drawStr( 80, 63, "\260C");
}

void setup() {
Serial.begin(9600);
Serial.println("Adafruit MLX90614 test");
mlx.begin();
pinMode(7, INPUT);//switch
pinMode(8, OUTPUT);//buzzer
pinMode(4, OUTPUT);//red
pinMode(5, OUTPUT);//green
pinMode(6, OUTPUT);//blue

digitalWrite(8, HIGH);
// flip screen, if required
// u8g.setRot180();
}

void loop() {
 if (digitalRead(7) ==LOW ) {
    while (!digitalRead(7) ==HIGH );
  }

  digitalWrite(5, HIGH);
      digitalWrite(6, HIGH);
  a = mlx.readObjectTempC();
  delay(100);
  b = mlx.readObjectTempC();
  delay(100);
  c = mlx.readObjectTempC();
  delay(100);
  d = mlx.readObjectTempC();
  delay(100);
  e = mlx.readObjectTempC();
  delay(100);
  f = mlx.readObjectTempC();
  delay(100);
  g = mlx.readObjectTempC();
  delay(100);
  h = mlx.readObjectTempC();
  delay(100);
  i = mlx.readObjectTempC();
  delay(100);
  j = mlx.readObjectTempC();
  delay(100);

   

digitalWrite(5, LOW);
digitalWrite(6, LOW);
  digitalWrite(8, LOW);
delay(100);
digitalWrite(8, HIGH);
GH = (a + b + c+ d + e + f+ g + h + i + j) / 10;
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
 Serial.print(GH); Serial.println("*C");

Serial.println();
if (tmax<mlx.readObjectTempC()){
tmax = mlx.readObjectTempC();
}
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
 if (GH > 37.5) {
    digitalWrite(4, HIGH);
    delay(1000);
    digitalWrite(4, LOW);
  } else if (GH < 37.0) {
    digitalWrite(6, HIGH);
    delay(1000);
    digitalWrite(6, LOW);
  }
 
delay(1000);
 
}

Credits

陳諒昕

陳諒昕

1 project • 0 followers

Comments