Temperature Mapping with Low-Cost Thermal Arrays
Temperature Mapping with Low-Cost Thermal Arrays
Overview
Section titled “Overview”“Where is it hot” and “what is the temperature” are different requirements: single-point sensing is cheap and accurate, only an array gives you location. This section sets the capability boundary of low-cost IR arrays. By the end you will be able to:
- Decide whether a project truly needs an array, or several single-point measurements are cheaper
- Explain most “inaccurate readings” with two concepts: emissivity and spot size
- Configure I2C array parts correctly (address, refresh rate, compensation) and control how much data leaves the device
- Write deliverable detection schemes for cabinets, busbars, motors and tanks
Prerequisites
Section titled “Prerequisites”Before starting this section, make sure you:
- Completed Section 4 of Chapter 25 (single-point temperature: NTC and DS18B20)
- Have an 8×8 or larger IR array module (MLX90640 / AMG8833 class)
- Have a spot infrared thermometer for comparison (set both to the same emissivity, otherwise the comparison is meaningless)
Key Concepts
Section titled “Key Concepts”Four tiers of “temperature mapping”
Section titled “Four tiers of “temperature mapping””| Tier | Representative part | Resolution | Typical nominal accuracy | Frame rate | Notes |
|---|---|---|---|---|---|
| Single-point thermopile | MLX90614 / 90615 | 1 point (mean within its FOV) | ±0.5 °C class (per model) | Fast | Cheap non-contact spot measurement |
| Small array | AMG8833 | 8×8 (64 px) | ±2.5 °C or a few percent of reading | Very low (sub-second) | Enough for “which region is hot”, not for precise values |
| Medium array | MLX90640 | 32×24 | ±1.5 °C class (per model and mode) | Configurable, a few Hz up to tens of Hz | Needs compensation maths, more RAM and CPU |
| Real imager | Lepton class | 80×60 / 160×120 | Better | Video grade | Expensive, plus flat-field and start-up settling issues |
My rule: when a customer asks for “thermal imaging”, first ask whether they need an alarm or an image. Cabinet, busbar and motor-surface monitoring is alarm-type: 8×8 or a small array suffices at acceptable cost. Only when they need to see the shape of a hot spot for diagnosis or evidence do you go to a real imager. Asking this one question typically drops the solution cost by an order of magnitude.
Emissivity decides whether you can measure at all
Section titled “Emissivity decides whether you can measure at all”IR thermometry reads surface radiation, and radiation strength depends on emissivity:
- Matte black paint, skin, plastic, rubber, water: high emissivity (commonly above 0.9) — measure directly
- Polished metal: very low emissivity (down to 0.1–0.3), so you mostly read reflected ambient instead of the part’s own temperature → readings come out clearly low
- Fixes, ranked by reliability: put matte black tape or paint on the spot and measure that (practical, and label the data as “temperature at the taped area”), raise the emissivity setting and reduce confidence, or switch to contact sensing (PT100, DS18B20, thermocouple)
Also consider reflected apparent temperature: when measuring low-emissivity targets, nearby hot objects (a person, a heating element) reflect into the reading, and results change with where the observer stands.
Spot size and distance: the target must fill the field
Section titled “Spot size and distance: the target must fill the field”Single-point parts have their own field of view (e.g. 35° or 90°), and arrays have an equivalent FOV. The further away you are, the larger the measured area:
- Inaccurate readings on small targets are usually not an accuracy problem but background mixed into the field (you wanted the terminal, you measured the whole board)
- To measure a small target at distance, choose a narrow-FOV single-point part (or add a shading tube) instead of forcing a wide-angle array
- The datasheet distance-to-spot ratio (D:S) tells you the minimum target diameter; do this arithmetic in the proposal
Long-wave IR does not pass ordinary glass or plastic
Section titled “Long-wave IR does not pass ordinary glass or plastic”The 8–14 µm band is strongly absorbed by ordinary glass and most plastics, therefore:
- You cannot place an IR array inside a PC/ABS enclosure wall — it is like mounting it behind an opaque window
- If it must be sealed, use the germanium or chalcogenide window supplied by the module vendor, or open a transmissive aperture in the cover
- This is also why thermal lenses are special parts, prone to condensation and sensitive to dirt
Data volume and reporting policy
Section titled “Data volume and reporting policy”A 32×24 frame is 768 values; 8×8 is 64. Do not upload full frames at high rate. The engineering pattern:
- Compute hotspots on-device: max/min/mean, number of cells over limit, hotspot coordinates
- Upload on events (first exceedance, sustained exceedance, clearance), keeping raw frames in a local rolling buffer
- When evidence is needed, upload a down-sampled image (e.g. 8×8) or a false-colour PNG instead of raw arrays
- Include the emissivity setting and compensation parameter version in the payload, otherwise the data cannot be explained afterwards
This ties directly into Chapter 10’s data processing: thermal-array projects go out of control on data volume first.
Implementation
Section titled “Implementation”8×8 array: hotspot and over-limit area
Section titled “8×8 array: hotspot and over-limit area”#include <Adafruit_AMG8833.h>
Adafruit_AMG8833 amg;const float EMISSIVITY = 0.95f; // set per material; carry this value in the payloadconst float LIMIT_C = 60.0f; // over-limit threshold, calibrated on site
float pixels[8 * 8];
void setup() { Serial.begin(115200); amg.begin(); // default I2C address 0x68, switchable via the ADDR pin}
void scanThermalField() { amg.getPixels(pixels); float mx = -100, mn = 200, sum = 0; uint8_t hotCells = 0, hotX = 0, hotY = 0; for (uint8_t y = 0; y < 8; y++) { for (uint8_t x = 0; x < 8; x++) { float v = pixels[y * 8 + x]; if (v > mx) { mx = v; hotX = x; hotY = y; } if (v < mn) mn = v; sum += v; if (v > LIMIT_C) hotCells++; } } Serial.printf("max=%.1f C at(%u,%u) min=%.1f avg=%.1f hotCells=%u\n", mx, hotX, hotY, mn, sum / 64.0f, hotCells);}AMG8833 frame rates are very low (sub-second): do not tight-loop the read, or you keep consuming duplicate frames while thinking you are live.
32×24 array: where compensation usually goes wrong
Section titled “32×24 array: where compensation usually goes wrong”MLX90640 raw data needs the full conversion chain (gain, offset, per-pixel coefficients, ambient temperature and emissivity compensation), which vendor libraries implement. The three things engineers actually get wrong:
// Key configuration (illustrative — use your library's real names)// 1) refresh rate and mode: higher costs more I2C and CPU; start at 4–8 Hz// 2) emissivity: default 0.95; must change it for shiny metal, or tape the target// 3) reflected ambient temperature: for low-emissivity targets set Ta, otherwise// compensation counts reflections as the object's own temperaturemlx90640_set_TaMode(false); // use an external Ta sensor: closer to reality than the internal readingmlx90640_set_Emissivity(0.95f);mlx90640_SetRefreshRate(0x06); // look the value up in the datasheet mapping table, do not trust memoryAll three settings must appear in the project document and in the payload metadata, because the same batch of data is not comparable after an emissivity or refresh-rate change.
Event-based reporting
Section titled “Event-based reporting”bool overLimitSinceSet = false;unsigned long overLimitSinceMs = 0;
void reportThermalEvent(float maxC, uint8_t hotCells) { bool nowOver = (maxC > LIMIT_C) && (hotCells >= 2); // require two or more cells, suppressing single-pixel noise if (nowOver && !overLimitSinceSet) { overLimitSinceSet = true; overLimitSinceMs = millis(); publish("thermal_alarm", maxC, hotCells, EMISSIVITY); } else if (!nowOver && overLimitSinceSet && millis() - overLimitSinceMs > 60000) { overLimitSinceSet = false; publish("thermal_clear", maxC, hotCells, EMISSIVITY); }}Rules like hotCells >= 2 matter: isolated pixel outliers are normal in thermal arrays, and a single-point criterion will alarm constantly.
Verification
Section titled “Verification”Measurement credibility checks
Section titled “Measurement credibility checks”| Check | Expected result | Verified |
|---|---|---|
| Against a spot thermometer at equal emissivity (matte surface) | Stable difference, giving an error band | |
| Palm near the array centre | Hotspot coordinates follow the hand; temperature climbs towards skin temperature | |
| Hot-water cup / ice pack | Correct rise and fall direction with acceptable response time | |
| Shiny metal directly, then with black tape | Reading rises clearly after taping — proves the emissivity effect | |
| Double the distance | Hot area widens and peak drops (spot-size effect), confirming the minimum target size | |
| Behind ordinary glass / PC sheet | Target temperature almost invisible (long-wave absorbed), proving the window requirement | |
| One hour continuous logging | Actual frame rate not below setting, no duplicate-frame pile-up |
Engineering constraint checks
Section titled “Engineering constraint checks”| Check | Expected result | Verified |
|---|---|---|
| Reporting concurrent with frame capture | Frame rate does not collapse and no I2C timeouts; otherwise lower the rate or reprioritise tasks | |
| Supply and I2C cable length | Long runs degrade comms; publish a maximum cable length | |
| Dirty or fogged lens | Clearly attenuated readings, feeding the maintenance interval |
Troubleshooting
Section titled “Troubleshooting”Issue 1: no device found on the bus
Section titled “Issue 1: no device found on the bus”Possible causes: the address differs from the library default (AMG8833 toggles between two addresses via the ADDR pin; MLX90640 is commonly 0x5A/0x5B; single-point parts have their own defaults), weak pull-ups, or a longer initialisation than assumed.
Solutions:
- Scan the I2C bus first and then set library parameters — never assume the default address
- Check pull-ups in the 2.2–4.7 kΩ range and shorten wiring
- Retry initialisation three times with delays; if it still fails, treat it as hardware (these modules are sensitive to power-on sequencing)
Issue 2: readings consistently low
Section titled “Issue 2: readings consistently low”Possible causes: emissivity set too high for a shiny target; the target does not fill the FOV (background mixed in); wrong ambient-compensation input; dirty or fogged lens.
Solutions:
- Apply matte tape or paint and re-measure, labelling the data as “taped area”
- Move closer or use a narrow-FOV part so the spot is fully covered
- Fix the Ta source (prefer an external ambient sensor over the die’s own reading)
- Clean the window; add anti-condensation design or intermittent purge in humid sites
Issue 3: frame rate will not rise, or duplicates everywhere
Section titled “Issue 3: frame rate will not rise, or duplicates everywhere”Possible causes: I2C clock conflicting with the refresh setting, CPU stolen by Wi-Fi/MQTT, or the code tight-loops while the library expects frame-paced reads.
Solutions:
- Lower the refresh band (2–4 Hz is enough for most monitoring), and confirm register values against the datasheet mapping
- Split capture and reporting into separate tasks: capture prioritised, reporting rate-limited
- Read on the frame period and use a frame counter or timestamp to prove a new frame actually arrived
Issue 4: a fixed pixel deviates from its neighbours
Section titled “Issue 4: a fixed pixel deviates from its neighbours”Symptoms: one or two stubborn hot or cold cells in every frame.
Cause and handling: per-pixel spread and calibration residuals are normal. Handle it by multi-cell agreement rules rather than single-max criteria, mask known bad pixels, and if a brand-new module shows several outliers, treat it as a component-quality issue with a record.
Best Practices
Section titled “Best Practices”- Do: separate “alarm” from “image” before choosing a tier — that single question usually decides the cost
- Do: put emissivity, refresh rate, Ta source and decision rules into reporting metadata so data stays explainable and traceable
- Do: publish events and hotspot summaries externally (max plus coordinates plus cells over limit), keeping raw frames local
- Do: design an IR-transmissive window in the enclosure and document “no ordinary plastic in front of the lens” — a mechanical-stage decision
- Don’t: replace smoke or heat detectors with a thermal array for fire alarm duty (same responsibility boundary as Section 8)
- Don’t: report absolute temperature on polished metal without surface preparation
- Don’t: max out refresh rate for prettier pictures at the expense of Wi-Fi and OTA stability
Summary
Section titled “Summary”Key points of this section:
- Choose the tier by need: alarm-type work is fine with 8×8 or a small array; only diagnostic evidence justifies a real imager
- Emissivity and spot size explain most “inaccurate” results — tape shiny metal, and make the target fill the field
- Long-wave IR does not pass ordinary glass or plastic, so sealed housings need the right window material or an aperture
- Data-volume control is the engineering core: on-device hotspot computation, event-based reporting, raw frames rolling locally
- Require multi-cell agreement in the criteria; isolated pixel outliers are normal behaviour, not a fault
Next section: physiological sensing — heart rate, respiration and sleep: what is feasible, and the disclaimers that must be written.
We provide ESP32 ODM design-to-manufacturing services. From prototype to production — the team behind this tutorial can build it with you.
💡 Mention tutorial.imagrove.com in your Alibaba chat with us — get 10% off your custom project quote.
First published attutorial.imagrove.com/sensor-module-selection/11-temperature-mapping-with-low-cost-thermal-arrays/Please credit Imagrove and link back to this page when quoting or republishing.
Questions or issues with this tutorial?
Sign in with GitHub to leave a comment. If a step fails for you, tell us — we verify it and update the tutorial.
© Imagrove · ESP32 IoT Tutorial