Full width home advertisement

Arduino project

Raspberry project

Post Page Advertisement [Top]

On market, there is an infrared thermometer to use measuring human temperature. In this project, we will show how to make the same one with Arduino


Firstly, watch the video how to make it before read detail process to make it



1. Hardware needed
1.1. Arduino Pro Mini
1.2. OLED 128x64 screen
1.3. Infrared Thermometer GY-906
1.4. Battery 18650
Arduino Pro Mini


OLED 128x64


GY-906

battery 18650



2. Make MDF case
The case is made from MDF 3mm wood. Design is taken after the market one. Corel Draw is software to design it, then cut it by laser cnc machine





3. Circuit



4. Code works
/*
www.engineer2you.com
Last modification: 28/09/2019
Code for Infrared Temperature (MDF case)
*/
#include <Adafruit_MLX90614.h>  //for infrared thermometer
#include <Adafruit_GFX.h>       // Include core graphics library for the display
#include <Adafruit_SSD1306.h>   // Include Adafruit_SSD1306 library to drive the display
#include <Fonts/FreeMonoBold18pt7b.h>  // Add a custom font

Adafruit_SSD1306 display(128, 64);            //Create display
Adafruit_MLX90614 mlx = Adafruit_MLX90614();  //for infrared thermometer
int temp;  // Create a variable to have something dynamic to show on the display
int ledPin = 16;

void setup()
{                
  delay(100);  // This delay is needed to let the display to initialize
  pinMode(ledPin, OUTPUT);  // sets the pin as output
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // Initialize display with the I2C address of 0x3C
  display.clearDisplay();  // Clear the buffer
  display.setTextColor(WHITE);  // Set color of the text
  mlx.begin();  //start infrared thermometer
}

void loop()
{
  digitalWrite(ledPin, HIGH);
  temp++;  // Increase value for testing
  if(temp > 43)  // If temp is greater than 150
  {
    temp = 0;  // Set temp to 0
  }

  temp = mlx.readObjectTempC(); //comment this line if you want to test

  display.clearDisplay();  // Clear the display so we can refresh

  // Print text:
  display.setFont();
  display.setCursor(45,10);  // (x,y)
  display.println("TEMPERATURE");  // Text or value to print

  // Print temperature
  char string[10];  // Create a character array of 10 characters
  // Convert float to a string:
  dtostrf(temp, 3, 0, string);  // (<variable>,<amount of digits we are going to use>,<amount of decimal digits>,<string name>)
  
  display.setFont(&FreeMonoBold18pt7b);  // Set a custom font
  display.setCursor(20,50);  // (x,y)
  display.println(string);  // Text or value to print
  display.setCursor(90,50);  // (x,y)
  display.println("C");  // Text or value to print
  display.setCursor(77,32);  // (x,y)
  display.println(".");  // Text or value to print
  
  // Draw a filled circle:
  display.fillCircle(18, 55, 7, WHITE);  // Draw filled circle (x,y,radius,color). X and Y are the coordinates for the center point

  // Draw rounded rectangle:
  display.drawRoundRect(16, 3, 5, 49, 2, WHITE);  // Draw rounded rectangle (x,y,width,height,radius,color)
                                                  // It draws from the location to down-right
    // Draw ruler step
  for (int i = 6; i<=45; i=i+3){
    display.drawLine(21, i, 22, i, WHITE);  // Draw line (x0,y0,x1,y1,color)
  }
  
  //Draw temperature
  temp = temp*0.43; //ratio for show
  display.drawLine(18, 46, 18, 46-temp, WHITE);  // Draw line (x0,y0,x1,y1,color)

  display.display();  // Print everything we set previously

}
5. Test it
Before put every thing into the MDF case, we test it in breadboard firstly



6. Install it!
After the circuit run well, let put the circuit into the case, every thing will be perfect



No comments:

Post a Comment

Bottom Ad [Post Page]