MLX90614 Arduino: Build a Non-Contact Infrared Thermometer
MLX90614 Arduino wiring and code: object vs ambient temperature, field of view and distance table, emissivity, ESP32 and Pico examples and an OLED IR gun.
Pairing the MLX90614 with an Arduino is the easiest way to measure the temperature of a surface without touching it: you point the sensor at a mug, a motor or your palm and get a reading in half a second. This small infrared thermometer from Melexis picks up the thermal radiation that objects emit and delivers the result over I2C as a ready-made Celsius value, so there are no formulas to build and no analog readings to calibrate. It's usually sold as the blue GY-906 module with the sensor in a small metal can.
In this guide you'll learn how the MLX90614 separates object and ambient temperature, how the field of view (FOV) limits the measuring distance, why shiny metals read wrong and how to set emissivity. Alongside working code for the Arduino Uno, ESP32 and Raspberry Pi Pico, you'll build an infrared thermometer gun with an OLED display, and at the end we'll talk about why taking a temperature from the forehead isn't as simple as it looks.
What is the MLX90614 and how does it work?
Every object above absolute zero emits infrared radiation, and the energy rises quickly as the object gets hotter; according to the Stefan–Boltzmann law it's proportional to the fourth power of the absolute temperature. Inside the MLX90614's can there's a thermopile (many thermocouples connected in series) that captures this radiation, plus a signal processor that handles its microvolt-level signal. The silicon window on the front only passes light at roughly 5.5–14 µm, which is exactly where room-temperature objects radiate. Because the thermopile actually sees the difference between the target and itself, the sensor also measures its own body temperature. So you get two values: To (object temperature) and Ta (ambient, meaning the sensor's own temperature).
| Feature | Value |
|---|---|
| Sensor type | Thermopile, infrared (5.5–14 µm) |
| Object temperature (To) | −70 … +380 °C |
| Ambient temperature (Ta) | −40 … +125 °C (operating range of the common ESF part: −40 … +85 °C) |
| Accuracy | ±0.5 °C (sensor and target within 0–50 °C, standard version) |
| Resolution | 0.02 °C |
| Interface | SMBus / I2C (up to 100 kHz), plus a PWM output |
| I2C address | 0x5A (can be changed in EEPROM) |
| Supply | Chip: 5 V (A version) or 3 V (B and D versions); GY-906 module 3.3–5 V |
| Current | About 1.5 mA |
The code printed on the can tells you which version you have. In a marking such as MLX90614ESF-BAA, E is the operating temperature range and SF the package type (TO-39). Of the last three letters, the first is the supply voltage (A = 5 V, B = 3 V, D = 3 V medical accuracy), the second the thermopile type (A = single zone, B = dual zone, C = compensated against changes in the sensor's own temperature) and the third the field of view. Most GY-906 modules carry a 90° AAA or BAA; it's cheap and fine for most jobs, but its wide angle means you have to get quite close to the target.
| Version | Supply | Field of view | Where is it used? |
|---|---|---|---|
| AAA | 5 V | 90° | GY-906 modules, general close-range measuring |
| BAA | 3 V | 90° | GY-906 modules, ESP32 and Pico projects |
| BCC | 3 V | 35° | Measuring from a few centimetres, gradient compensated |
| BCF | 3 V | 10° | Distant and small targets, thermometer guns |
| DCI | 3 V | 5° | Medical accuracy, very narrow spot, expensive |
Field of view (FOV) and measuring distance
This is the most misunderstood feature of an infrared thermometer. The sensor doesn't measure a single point; it measures the average temperature of everything inside a cone in front of it. The further away you go, the bigger the base of that cone, the measuring spot, becomes. The spot diameter is D = 2 × d × tan(FOV / 2), where d is the distance between the sensor and the target. For a 90° sensor tan(45°) = 1, so the spot diameter is exactly twice the distance: a GY-906 looking from 10 cm away sees a circle 20 cm across. If your target is smaller than that circle, the temperature of the wall or table behind it gets mixed into the reading, and a hot cup of tea looks cooler than it is.
| Distance | 90° (AAA/BAA) | 35° (BCC) | 10° (BCF) | 5° (DCI) |
|---|---|---|---|---|
| 1 cm | 2 cm | 0.6 cm | 0.2 cm | 0.1 cm |
| 2 cm | 4 cm | 1.3 cm | 0.35 cm | 0.17 cm |
| 5 cm | 10 cm | 3.2 cm | 0.9 cm | 0.4 cm |
| 10 cm | 20 cm | 6.3 cm | 1.8 cm | 0.9 cm |
| 20 cm | 40 cm | 12.6 cm | 3.5 cm | 1.7 cm |
| 50 cm | 100 cm | 31.5 cm | 8.7 cm | 4.4 cm |
| Distance-to-spot ratio (D:S) | 0.5 : 1 | 1.6 : 1 | 5.7 : 1 | 11.5 : 1 |
MLX90614 wiring: Arduino, ESP32 and Pico
| GY-906 pin | Arduino Uno / Nano | ESP32 | Raspberry Pi Pico |
|---|---|---|---|
| VIN | 5V or 3.3V | 3V3 | 3V3(OUT), pin 36 |
| GND | GND | GND | GND |
| SCL | A5 | GPIO 22 | GP5, pin 7 |
| SDA | A4 | GPIO 21 | GP4, pin 6 |
Keep the wires short and remember that the sensor can't talk I2C faster than 100 kHz. If a display on the same bus runs at 400 kHz, make sure its library drops the speed back down; the Adafruit SSD1306 library does this by itself, raising the clock to 400 kHz while it writes to the screen and returning it to 100 kHz afterwards. If you're curious how the bus works, have a look at What is I2C?.
Step by step: your first reading with Arduino
- In the Arduino IDE, open the Library Manager, search for Adafruit MLX90614 and install it; when it asks about dependencies, install Adafruit BusIO too.
- Wire the GY-906 as in the table above: VIN to 5V, GND to GND, SCL to A5, SDA to A4.
- Upload the code below and open the Serial Monitor at 9600 baud.
- Point the sensor first at an empty wall, then at your palm and at a glass of hot water; you'll see the object temperature change quickly while the ambient temperature stays almost constant.
1#include <Wire.h>
2#include <Adafruit_MLX90614.h>
3
4Adafruit_MLX90614 mlx; // varsayılan adres 0x5A / default address 0x5A
5
6void setup() {
7 Serial.begin(9600);
8 if (!mlx.begin()) { // sensör yanıt vermedi / sensor did not respond
9 Serial.println(F("MLX90614 bulunamadi / not found"));
10 while (1);
11 }
12 Serial.print(F("Emisivite / Emissivity: "));
13 Serial.println(mlx.readEmissivity(), 2); // fabrika ayarı 1.00 / factory default 1.00
14}
15
16void loop() {
17 double ambient = mlx.readAmbientTempC(); // sensörün kendi sıcaklığı / sensor package temperature
18 double object = mlx.readObjectTempC(); // görüş alanındaki yüzey / surface in the field of view
19 Serial.print(F("Ortam / Ambient: "));
20 Serial.print(ambient, 2);
21 Serial.print(F(" C Nesne / Object: "));
22 Serial.print(object, 2);
23 Serial.println(F(" C"));
24 delay(500);
25}readAmbientTempC() returns the temperature of the sensor's own body, and readObjectTempC() the average temperature of the surfaces in its field of view. Internally the sensor stores every value in kelvin in steps of 0.02; the library multiplies the raw number by 0.02 and subtracts 273.15 to get Celsius. If the I2C read fails, the function returns NAN, so checking the value with isnan() before you display it is a good habit. When you point the sensor at a plain wall at room temperature, the two values should be close to each other, a sign that the wiring and the sensor are healthy.
Emissivity: why do shiny metals read wrong?
Emissivity (ε) is a number between 0 and 1 that shows how much infrared radiation a surface emits compared with an ideal radiator (a black body) at the same temperature. The MLX90614 ships set to ε = 1.00, which gives nearly correct results on matte surfaces such as skin, water, wood, plastic or paint. Shiny metals, however, emit little radiation and also reflect their surroundings like a mirror. For example, a polished aluminium pan with an emissivity of about 0.1 at 210 °C reads roughly 60 °C; what you're measuring is less the pan than the room reflected in it.
| Surface | Approximate emissivity |
|---|---|
| Human skin | 0.98 |
| Water, ice | 0.96–0.98 |
| Matte black paint, black electrical tape | 0.95 |
| Wood, paper, cardboard | 0.90–0.95 |
| Plastic, rubber | 0.90–0.95 |
| Concrete, brick | 0.90–0.93 |
| Glass (its surface) | 0.92 |
| Oxidised steel, cast iron | 0.70–0.85 |
| Polished aluminium, stainless steel | 0.05–0.15 |
| Polished copper | 0.03–0.05 |
There are two ways to correct for emissivity. The first is to write a new value to register 0x24 in the sensor's EEPROM: it's stored as 65535 × ε, so about 62258 for 0.95. The Adafruit library does this in a single line. Run the code below only once; EEPROM has a limited number of write cycles and writing to it over and over in a loop wears the sensor out. Afterwards, switch the sensor's power off and on once to be sure the new value takes effect.
1#include <Wire.h>
2#include <Adafruit_MLX90614.h>
3
4Adafruit_MLX90614 mlx;
5const double NEW_EMISSIVITY = 0.95; // ör. mat siyah izole bant / e.g. matte black electrical tape
6
7void setup() {
8 Serial.begin(9600);
9 if (!mlx.begin()) {
10 Serial.println(F("MLX90614 bulunamadi / not found"));
11 while (1);
12 }
13 Serial.print(F("Eski / Old: "));
14 Serial.println(mlx.readEmissivity(), 3);
15 mlx.writeEmissivity(NEW_EMISSIVITY); // EEPROM'a yazar, yalnız bir kez çalıştır / writes EEPROM, run only once
16 Serial.print(F("Yeni / New: "));
17 Serial.println(mlx.readEmissivity(), 3);
18 Serial.println(F("Sensorun gucunu kesip yeniden ver / Power-cycle the sensor"));
19}
20
21void loop() {
22}MLX90614 with the ESP32: correcting emissivity in software
The same library runs on the ESP32; you just need to set the I2C pins with Wire.begin(21, 22) and keep the speed at 100 kHz. The code below never touches the sensor's EEPROM: it corrects the value read at ε = 1.00 with an approximate formula that also takes the ambient temperature into account. The radiation the sensor sees is the sum of the target's own radiation (ε × T⁴) and the radiation reflected from the surroundings ((1 − ε) × Ta⁴). Solving this for the true temperature gives T = ((Tm⁴ − (1 − ε) × Ta⁴) / ε)^¼, where Tm is the measured and Ta the ambient temperature, all in kelvin. The code also averages ten readings to smooth out jumps caused by a shaky hand.
1#include <Wire.h>
2#include <Adafruit_MLX90614.h>
3
4const int SDA_PIN = 21;
5const int SCL_PIN = 22;
6const double EMISSIVITY = 0.95; // ölçülen yüzeyin emisivitesi / emissivity of the target surface
7
8Adafruit_MLX90614 mlx;
9
10// Sensör ε = 1.00 iken okunan değeri gerçek yüzey sıcaklığına çevirir (yaklaşık)
11// Converts a reading taken at ε = 1.00 into the true surface temperature (approximation)
12double correctEmissivity(double apparentC, double ambientC, double eps) {
13 double tApp = apparentC + 273.15; // Kelvin'e çevir / convert to kelvin
14 double tAmb = ambientC + 273.15;
15 double t4 = (pow(tApp, 4) - (1.0 - eps) * pow(tAmb, 4)) / eps;
16 return pow(t4, 0.25) - 273.15;
17}
18
19void setup() {
20 Serial.begin(115200);
21 Wire.begin(SDA_PIN, SCL_PIN);
22 Wire.setClock(100000); // MLX90614 en fazla 100 kHz / MLX90614 max 100 kHz
23 if (!mlx.begin(0x5A, &Wire)) {
24 Serial.println("MLX90614 bulunamadi / not found");
25 while (true) delay(1000);
26 }
27}
28
29void loop() {
30 double sum = 0;
31 int good = 0;
32 for (int i = 0; i < 10; i++) { // 10 ölçümün ortalaması / average of 10 readings
33 double t = mlx.readObjectTempC();
34 if (!isnan(t) && t < 1000) { // 1037.55 C = okuma hatası / read error
35 sum += t;
36 good++;
37 }
38 delay(30);
39 }
40 if (good == 0) {
41 Serial.println("Okuma hatasi / Read error");
42 delay(1000);
43 return;
44 }
45 double amb = mlx.readAmbientTempC();
46 double raw = sum / good;
47 Serial.printf("Ta %.2f C | ham / raw %.2f C | duzeltilmis / corrected %.2f C\n",
48 amb, raw, correctEmissivity(raw, amb, EMISSIVITY));
49 delay(500);
50}Because the formula ignores the fact that the sensor only measures in a narrow wavelength band, the result is approximate; even so, on surfaces with an emissivity above 0.9 the error usually stays below one degree. On very shiny surfaces (ε < 0.3) a small mistake in your emissivity estimate turns into a large temperature error, so the tape method is always more reliable there. There's also a reason the code throws away values above 1000 °C: when a wire comes loose or the I2C bus hangs, the sensor returns 0xFFFF, and that raw value corresponds to exactly 1037.55 °C.
MLX90614 with the Raspberry Pi Pico and MicroPython
MicroPython doesn't need a ready-made driver; you can read the two registers in the sensor's RAM directly: 0x06 is the ambient and 0x07 the object temperature. Each read returns three bytes: a low byte, a high byte and a CRC-8 checksum byte called PEC. The code below calculates the PEC and compares it, so it doesn't print corrupted values from a noisy wire; the top bit of the object value is also the sensor's own error flag. Save the code to the Pico as main.py with Thonny and the board will start measuring every time it powers up.
1from machine import Pin, I2C
2import time
3
4ADDR = 0x5A
5i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=100000) # MLX90614 en fazla 100 kHz / max 100 kHz
6
7def crc8(data): # SMBus PEC, polinom / polynomial 0x07
8 crc = 0
9 for b in data:
10 crc ^= b
11 for _ in range(8):
12 crc = ((crc << 1) ^ 0x07) & 0xFF if crc & 0x80 else (crc << 1) & 0xFF
13 return crc
14
15def read_temp(reg):
16 d = i2c.readfrom_mem(ADDR, reg, 3) # LSB, MSB, PEC
17 if crc8(bytes([ADDR << 1, reg, (ADDR << 1) | 1, d[0], d[1]])) != d[2]:
18 return None # PEC tutmadı / PEC mismatch
19 raw = d[0] | (d[1] << 8)
20 if raw & 0x8000:
21 return None # sensör hata bayrağı / sensor error flag
22 return raw * 0.02 - 273.15 # 0,02 K adım / 0.02 K per step
23
24while True:
25 ta = read_temp(0x06) # ortam / ambient
26 to = read_temp(0x07) # nesne / object
27 if ta is not None and to is not None:
28 print("Ta {:.2f} C To {:.2f} C".format(ta, to))
29 else:
30 print("Okuma hatasi / Read error")
31 time.sleep(0.5)Project: an infrared thermometer gun with an OLED display
Now let's put the parts together and build a small copy of the infrared thermometer guns sold in hardware stores. While you hold the trigger, the sensor measures and the display shows the live value. When you release it, the last value stays on screen with the word HOLD, the buzzer beeps briefly and the highest value seen during the scan appears on the bottom line. This MAX feature is very handy for sweeping the sensor along a pipe or over an electrical panel to find the hottest spot. For more on the display, see How to Use an OLED Display (SSD1306).

| Part | Arduino Uno connection | Note |
|---|---|---|
| MLX90614 (GY-906) | A4 (SDA), A5 (SCL), 5V, GND | Address 0x5A |
| 0.96" OLED | A4 (SDA), A5 (SCL), 5V, GND | Address 0x3C |
| Trigger button | D2 and GND | Internal pull-up, LOW when pressed |
| Buzzer | D8 (+) and GND | Active or passive buzzer |
| Power | 9 V battery (VIN) or USB power bank | For portable use |
1#include <Wire.h>
2#include <Adafruit_GFX.h>
3#include <Adafruit_SSD1306.h>
4#include <Adafruit_MLX90614.h>
5
6const uint8_t TRIGGER_PIN = 2; // tetik butonu, diğer ucu GND / trigger button, other leg to GND
7const uint8_t BUZZER_PIN = 8; // buzzer + ucu / buzzer + leg
8
9Adafruit_SSD1306 display(128, 64, &Wire, -1);
10Adafruit_MLX90614 mlx;
11
12double heldTemp = NAN; // son tutulan ölçüm / last held reading
13double maxTemp = -100; // taramadaki en yüksek değer / highest value of the scan
14bool scanning = false;
15
16void showScreen(double obj, double amb, const __FlashStringHelper *label) {
17 display.clearDisplay();
18 display.setTextSize(1);
19 display.setCursor(0, 0);
20 display.print(label); // SCAN ya da HOLD / SCAN or HOLD
21 display.setCursor(78, 0);
22 display.print(F("Ta "));
23 display.print(amb, 1);
24 display.setTextSize(3);
25 display.setCursor(0, 20);
26 if (isnan(obj) || obj > 1000) display.print(F("--.-"));
27 else display.print(obj, 1);
28 display.setTextSize(2);
29 display.print(F("C"));
30 display.setTextSize(1);
31 display.setCursor(0, 56);
32 display.print(F("MAX "));
33 if (maxTemp > -100) display.print(maxTemp, 1);
34 display.display();
35}
36
37void setup() {
38 pinMode(TRIGGER_PIN, INPUT_PULLUP);
39 pinMode(BUZZER_PIN, OUTPUT);
40 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
41 display.setTextColor(SSD1306_WHITE);
42 if (!mlx.begin()) {
43 display.clearDisplay();
44 display.setCursor(0, 0);
45 display.print(F("MLX90614 yok / missing"));
46 display.display();
47 while (1);
48 }
49}
50
51void loop() {
52 bool pressed = digitalRead(TRIGGER_PIN) == LOW;
53 double amb = mlx.readAmbientTempC();
54 if (pressed) {
55 if (!scanning) { // yeni tarama başladı / a new scan starts
56 scanning = true;
57 maxTemp = -100;
58 }
59 double obj = mlx.readObjectTempC();
60 if (!isnan(obj) && obj < 1000 && obj > maxTemp) maxTemp = obj;
61 heldTemp = obj;
62 showScreen(obj, amb, F("SCAN"));
63 } else {
64 if (scanning) { // tetik bırakıldı: değeri tut, bip / trigger released: hold, beep
65 scanning = false;
66 tone(BUZZER_PIN, 2000, 80);
67 }
68 showScreen(heldTemp, amb, F("HOLD"));
69 }
70 delay(100);
71}The code refreshes the display every 100 ms, which looks smooth without keeping the I2C bus needlessly busy. When you design the housing, put the sensor at the tip of the barrel and the display at the back, and leave nothing in front of the sensor; even thin plastic or glass blocks infrared radiation. Keep the sensor away from a warm regulator and from the heat of your hand, because the MLX90614 is sensitive to its own body warming up quickly, which can shift the reading by several degrees. If you add a laser pointer, mount it parallel to the sensor and as close as possible; even so, with a wide-angle sensor the laser dot only marks the centre of the measured area, not the area itself.
Forehead temperature: the limits of the MLX90614
The most popular use people ask about is measuring fever, and here it pays to be honest. The sensor measures the temperature of the skin's surface, not your core body temperature. Forehead skin is normally between 34 and 36 °C, and even with a core temperature of 37 °C it can vary by several degrees depending on the room temperature, sweating and whether you've just come in from outside. Forehead thermometers sold in pharmacies use sensors calibrated to medical accuracy and algorithms that estimate core temperature from skin temperature, and they pass standard tests. The standard version on the GY-906, on the other hand, is accurate to ±0.5 °C, which isn't enough to reliably tell 37.5 °C from 38 °C.
- Distance: from 3 cm away a 90° sensor sees a 6 cm circle; if the forehead doesn't fill it, hair and background pull the value down.
- Environment and skin: the forehead of someone who has just come in from the cold reads several degrees low; wait 10–15 minutes in the room before measuring.
- Sweat and make-up: damp skin cools through evaporation and reads low.
- The sensor's own temperature: holding the device in your palm or carrying it from a cold room into a warm one shifts the reading for a few minutes until the sensor settles.
- The offset trick: adding a fixed number (e.g. +2.5 °C) to the measured skin temperature gives a rough estimate, but it doesn't hold for every person or every environment.
MLX90614 project ideas
- Coffee and baby-bottle alert: sound a buzzer when the cup cools down to drinking temperature (55–60 °C).
- 3D printer bed and soldering work: monitor the bed or part temperature without contact; for readings above 380 °C a MAX6675 thermocouple is a better fit.
- Motor overheating alarm: keep watching the case of a DC motor or motor driver and cut the load when it crosses a threshold.
- Home heat-loss scan: sweep the thermometer gun along window frames, sockets and under doors to find cold spots.
- Contactless measuring station: for a science fair, build a setup that waits with an HC-SR04 until the person is at the right distance and then takes the reading.
- Plant leaf stress: compare leaf temperature with the air temperature from a DHT11; a thirsty plant has warmer leaves.
Common mistakes and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| Constant 1037.55 °C | The I2C read returns 0xFFFF: broken wire, SDA and SCL swapped or the bus at 400 kHz | Check the wiring, use Wire.setClock(100000) |
| NAN or "not found" | The sensor doesn't answer at address 0x5A | Look for the address with an I2C scanner, measure the supply with a multimeter |
| Shiny metal looks far too cold | Low emissivity and reflections | Apply matte black tape or correct ε |
| Small object reads too cold | The measuring spot is bigger than the target | Move closer or use a narrow-angle (BCF) sensor |
| The value slowly drifts | The sensor body is warming up or cooling down | Keep it away from heat sources and let it settle |
| Can't measure an object behind glass | Glass doesn't pass 5–14 µm radiation, so you measure the glass itself | Measure without glass or clear plastic in the way |
| Occasional bad readings on the ESP32 | Long wires, weak pull-ups, fast I2C | Shorten the wires, use 100 kHz, retry failed reads |
The MLX90614 opens the door to contactless measuring: handle the field of view, distance and emissivity correctly and you can read the temperature of anything from a coffee cup to a motor with a few lines of code. In the BlueGrays app you'll find step-by-step projects with circuit diagrams and code for DHT11 temperature and humidity, an NTC thermometer with an LCD, an ESP32 OLED weather display and a temperature logger, and adding the MLX90614 to any of them is as easy as connecting four wires to the same I2C bus.
Frequently asked questions
How far can the MLX90614 measure?
There's no fixed distance limit; the field of view sets it. On the 90° sensor of the GY-906 the measuring spot is twice the distance across, so from 10 cm it averages an area 20 cm wide. To measure a small target from further away you need the narrow 10° or 5° versions.
Can the MLX90614 measure body temperature?
It measures skin temperature, and forehead skin is usually 1–3 °C cooler than your core temperature. The ±0.5 °C accuracy of the standard version isn't enough to diagnose a fever reliably. It's fine for experiments and school projects, but it doesn't replace a medical thermometer.
Why does my MLX90614 read 1037.55 °C?
That value appears when the sensor returns 0xFFFF, and it's almost always an I2C error. Check the wiring, the SDA and SCL order and that the bus runs at 100 kHz. On the ESP32, setting the pins explicitly with Wire.begin(21, 22) often fixes it too.
How accurate is the MLX90614?
The standard version is accurate to ±0.5 °C when both the sensor and the target are within 0–50 °C; outside that range the error grows. Its resolution is 0.02 °C, so it sees small changes, but the absolute value depends on emissivity and the field of view.
What's the difference between the MLX90614 and the MLX90640?
The MLX90614 is a single-point thermometer that gives the average temperature of its field of view. The MLX90640 is a 32×24-pixel thermal camera that measures each pixel separately and produces a heat map, but it costs more and needs a more powerful board such as an ESP32.
Does the MLX90614 work with 3.3 V?
Thanks to the regulator on the GY-906 module, it works with both 3.3 V and 5 V; on the ESP32 and Pico, connect it to the 3V3 pin. With a bare chip, check the letter in the part code: B and D versions are 3 V parts, the A version is for 5 V.
Projects to build after reading this
See all projects
Temperature and Humidity with DHT11
How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

Temperature Measurement with NTC and 2x16 Lcd Display
Measure the temperature around you with a sensor that looks like a tiny bead. This part, called an NTC, lets electricity through more easily as it warms up; the Arduino reads that change, turns it…

ESP32 DHT22 Temperature and Humidity (with LCD Display)
This project measures ambient temperature and humidity using a DHT22 sensor and displays the data in real time on a 16x2 I2C LCD. Data is read from the sensor using the one-wire protocol via the Adafruit DHT library. This project serves as the foundation for IoT weather stations, smart home automation, or environmental monitoring systems in greenhouses. Communication with the DHT22 is established via the ESP32's GPIO 4 pin.

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.

ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)
In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. Unlike the I2C LCD version, it uses an SSD1306 OLED (128×64) display, with large text and vector icons for a richer look. Seven weather icons (sunny, rainy, snowy and more) are drawn on the fly, with no bitmap files.

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.

ESP32 I2C LCD Display (16x2)
In this project we connect a 16x2 character LCD to the ESP32 over I2C and display text. With I2C, just 2 data pins (SDA and SCL) control the screen, instead of the 6+ pins a classic parallel connection wastes. The code prints a fixed message on the first line and a counter that goes up every second on the second. At startup an I2C scanner also prints the display's address to the Serial Monitor (usually 0x27 or 0x3F).

Using LCD Screen with I2C
Give your Arduino its own screen and make it write its first message. The two-line LCD screen hooks up with just a few wires; a greeting appears on the top line, then a second message on the bottom…
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

