berniebe
Published © MIT

Thermal camera with 0.96 oled monochrome display

Simple thermal camera with monochrome display.

IntermediateProtip777
Thermal camera with 0.96 oled monochrome display

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Adafruit AMG8833 IR Thermal Camera FeatherWing
×1
0.96 inch OLED SSD1306 Display I2C 128 x 64 pixels
×1

Hand tools and fabrication machines

Breadboard, 830 Tie Points
Breadboard, 830 Tie Points
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Schematics

AGM8833_Thermal_camera

Code

AGM8833_OLED0.98 poc

Arduino
#include <Arduino.h>

#include <U8g2lib.h>

#include <Adafruit_AMG88xx.h>

#ifdef U8X8_HAVE_HW_SPI#include <SPI.h>

#endif
#ifdef U8X8_HAVE_HW_I2C#include <Wire.h>

#endif

// Function to determine to which bin temp reading belongs.
// Used further down the road to decide what character to display.

int getDisplayValueOfTemp(float temp, int range_start, int range_end) {
  float step_size;
  int return_value = 1;
  step_size = (range_end - range_start) / 8.00; // 8 is number of possible values on displa
  if (temp > range_end) {
    return 8;
  }
  do {
    if (temp <= (return_value * step_size + range_start)) {
      return return_value;
    }
    return_value = return_value + 1;
  } while (return_value <= 8);
}


Adafruit_AMG88xx amg;
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8( /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the Display 


float ir_camera_pixels[64];

void setup() {
  Serial.begin(9600);
  u8x8.begin();

  bool status;
  status = amg.begin();
  if (!status) {
    Serial.println("Could not find a valid AMG88xx sensor, check wiring!");
    while (1);
  }
  u8x8.begin();
  u8x8.setPowerSave(0);
  Serial.println(F("Hardware init is done !"));

}

void loop() {
  int row_num = 0;
  int col_num = 0;
  amg.readPixels(ir_camera_pixels);
  u8x8.setFont(u8x8_font_chroma48medium8_r);
  // Picture Main Loop 
  for (int i = 0; i < 64; i++) {
    float temp = ir_camera_pixels[i];
    int character_to_display = getDisplayValueOfTemp(temp, 20, 35); // change last two values to change temp range
    if ((i % 8) == 0) {
      row_num = row_num + 1;
      col_num = 0;
    }

    switch (character_to_display) {
    case 1:
      u8x8.drawString(col_num, row_num, ".");
      break;
    case 2:
      u8x8.drawString(col_num, row_num, ":");
      break;
    case 3:
      u8x8.drawString(col_num, row_num, "-");
      break;
    case 4:
      u8x8.drawString(col_num, row_num, "=");
      break;
    case 5:
      u8x8.drawString(col_num, row_num, "+");
      break;
    case 6:
      u8x8.drawString(col_num, row_num, "*");
      break;
    case 7:
      u8x8.drawString(col_num, row_num, "#");
      break;
    case 8:
      u8x8.drawString(col_num, row_num, "@");
      break;
    }

    col_num = col_num + 1;
  }

}

Credits

berniebe

berniebe

0 projects • 0 followers

Comments