Hello everybody,

Today I would like to show you how to implement an IR thermometer with our GY-906 module, a Nano V3 and an OLED with a few lines of code. The structure is well suited for contactless monitoring of temperatures, e.g. on machines or similar

So we need:

1x Nano V3
1x OLED 0.96 "
1x GY-906
1x mini breadboard w. Jumper wire
1x 9V battery holder

Optionally, you can send the project by one Laser diode or a Button module  expand.

The wiring:

Nano GY-906 Oled Battery clip
3.3V VCC


The necessary libraries:

Install both libraries as usual through your library manager in the Arduino IDE. If you want to use the latest version, you can get it from GitHub and include it as a * .zip, but this has the disadvantage of having to maintain the new version yourself.

If you use the library manager for installation, you will be notified by the IDE as soon as a new version is available and can update it with a click. The two libraries are shown in the screenshot below:

- GY-906 -on github

Today we use the Adafruit library to display the values ​​on the display:

Here is the code:


#include <Wire.H>
#include <Adafruit_MLX90614.H>
#include <Adafruit_SSD1306.H>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void set up() {      Serial.begin(9600);   Serial.println("Adafruit MLX90614 test");    if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {     Serial.println(F("SSD1306 init failed"));     for(;;);   }      display.clearDisplay();   display.setRotation(0);   display.setTextSize(1);   display.setTextColor(WHITE);   display.setCursor(0, 35);   display.println("Init ...");   display.display();   delay(500);   display.clearDisplay();   mlx.begin();     }

void loop() {     display.clearDisplay();     display.setTextSize(2);     display.setCursor(25, 10);     display.print(mlx.readAmbientTempC()); // ambient temperature     display.setCursor(95, 10);     display.print("C");     display.setTextSize(2);     display.setCursor(25, 36);     display.print(mlx.readObjectTempC()); // IR temperature     display.setCursor(95, 36);     display.print("C");     display.display();   Serial.println();   delay(1000);

After initializing the hardware in void setup, the ambient temperature and then the IR temperature are displayed in the loop.

Until next time :)

DisplaysFor arduinoProjects for beginners


Peter Mauß

Peter Mauß

Verwende dieses Setup allerdings mit einem 1.3"OLed mit der U8G2 Lib. Als Temparatur wird mir allerdings 1037.55 °C ausgegeben. Wenn ich die U8G2 auskommentiere und über Serial ausgebe, scheint alles zu passen (23,93 und 27,23).
Mit der U8G2 funktionierts dann, wenn ich am Beginn des loop einen mlx.begin() setze und dann die Temperaturen auslese.
Wer pfuscht da wem in den Registern herum?

Achim Pellmann

Achim Pellmann

Der Upload wird abgebrochen mit der Fehlermeldung:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0×0f
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0×0f
avrdude: stk500_recv(): programmer is not responding
Ich bin begeistert von Ihren Beispielvorstellungen und habe auch schon einiges nach gebaut. Daher wäre es schön, wenn Sie mir weiterhelfen könnten.
MfG Achhim Pellmann

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN