Shahariar
Published © GPL3+

IR Thermometer, Stopwatch, Cooking Timer, Inactivity Tracker

USB LiPo battery powered, Arduino-based non-contact IR thermometer, stopwatch, inactivity tracker, cooking timer with alarm & 7-Seg Display.

IntermediateFull instructions provided5 hours5,629
IR Thermometer, Stopwatch, Cooking Timer, Inactivity Tracker

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Adafruit MLX90614
×1
Microchip AVR for Arduino
328P/168P/8A
×1
SparkFun 7-Segment Serial Display - Red
SparkFun 7-Segment Serial Display - Red
3 digit display used
×1
Breadboard (generic)
Breadboard (generic)
8x2 cm
×2
16 MHz Crystal
16 MHz Crystal
×1
Slide Switch
Slide Switch
×1
30 mm Red Push Switch
any big red push switch
×1
22 mm White Push Switch
×1
Buzzer
Buzzer
×1
Colored pin header (generic)
×1
MLX90614 IR Temperature Sensor
×1
LED Dot Laser (generic)
×1
USB A Connector
×1
AMS1117 3.3V Voltage Regulator
×1
150 mAH 3.7V LiPo battery
cylindrical
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Ckt

Circuit

https://circuits.io/circuits/3636001-the-unnamed-circuit

Code

Test Code Ver 0.1

C/C++
Beta
// Thanks to Lady Ada and Read for MLX90614 and Sevseg library !

#include "SevSeg.h"
#include <Wire.h>
#include <Adafruit_MLX90614.h>


#define PIN_PWR_SENESOR 13
#define PIN_PWR_LASER A0
#define PIN_PRESS_SWITCH1 2
#define PIN_PRESS_SWITCH2 3
#define PIN_BUZZER_ALERM 4

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
SevSeg sevseg; //Instantiate a seven segment controller object


volatile int test =0;
volatile int test2 = 0;
float T_amb;
float T_obj;



void setup() {
   pinMode(PIN_PRESS_SWITCH1, INPUT_PULLUP);
  attachInterrupt(0, SW1, FALLING);// Interrupt for Swithc 1

  pinMode(PIN_PRESS_SWITCH2, INPUT_PULLUP);
  attachInterrupt(1, SW2, FALLING);// Interrupt for Swithc 2
  pinMode(PIN_PWR_SENESOR, OUTPUT);
    pinMode(PIN_PWR_LASER, OUTPUT);
       pinMode(PIN_BUZZER_ALERM, OUTPUT);
    digitalWrite(PIN_PWR_SENESOR,HIGH); // powers the regulator + IR sensor
    digitalWrite(PIN_PWR_LASER,LOW);
       digitalWrite(PIN_BUZZER_ALERM,LOW);
  
  byte numDigits = 3;   
  byte digitPins[] = {A1, A2, A3};
  byte segmentPins[] = {11, 9, 7, 6, 5, 10, 8, 12};
  bool resistorsOnSegments = false; // Use 'true' if on digit pins
  byte hardwareConfig = COMMON_ANODE; // See README.md for options
     
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments);
  sevseg.setBrightness(100);
   mlx.begin();
}

void loop() {
  static unsigned long timer = millis();
  static int seconds = 0;
  
  if (millis() >= timer) {
    seconds++; // 100 milliSeconds is equal to 1 deciSecond
    timer += 1000; 
    if (seconds == 100000) { // Reset to 0 after counting for 1000 seconds.
      seconds=0;
      
    }
    sevseg.setNumber(T_obj, 1);
  }
  if(test==0)
  {
// T_amb = mlx.readAmbientTempC();
 T_obj = mlx.readObjectTempC(); 
sevseg.setNumber(T_obj, 0);
  sevseg.refreshDisplay(); 
   sevseg.refreshDisplay(); 
    sevseg.refreshDisplay(); 
     sevseg.refreshDisplay(); // Must run repeatedly
  }
if (test==1)
{
  T_amb = mlx.readAmbientTempC();
//  T_amb=T_amb*10;
  sevseg.setNumber(T_amb, 1);
  sevseg.refreshDisplay(); 
   sevseg.refreshDisplay();
    sevseg.refreshDisplay(); 
     sevseg.refreshDisplay(); // Must run repeatedly
     
}
}

void SW1()
{
  
  test=1;
  digitalWrite(PIN_PWR_Laser,HIGH);
}
void SW2()
{
  test=0;
  digitalWrite(PIN_PWR_Laser,HIGH);}

Credits

Shahariar

Shahariar

74 projects • 264 followers
"What Kills a 'Great life' is a 'Good Life', which is Living a Life Inside While Loop"

Comments