How to Make a Thermal Camera: Parts, Wiring & Setup

You can build a working thermal camera for roughly $30 to $80 using an infrared sensor, a small microcontroller, and a color display. The result won’t match a $500 commercial unit, but it will detect heat signatures through walls, find drafts in your home, spot overheating electronics, and visualize temperature differences in real time. The entire build can be completed in an afternoon with basic soldering skills.

Choosing a Thermal Sensor

The sensor is the core of your build, and two options dominate the hobbyist market: the AMG8833 and the MLX90640. They differ significantly in resolution and price, so your choice shapes the entire project.

The AMG8833 produces an 8×8 pixel grid, giving you 64 temperature readings per frame. That’s enough to see a person-shaped blob in a room or locate a hot spot on a circuit board, but the image is blocky without heavy software smoothing. It costs around $10 to $15 and is the easier sensor to work with, making it a solid first build.

The MLX90640 jumps to 32×24 pixels (768 temperature readings), which produces noticeably sharper thermal images. It measures temperatures from -40°C to 300°C and comes in two field-of-view options: a narrow 55°x35° for focused work or a wide 110°x75° for scanning rooms. It typically runs $25 to $50. If you want results that actually look like thermal imaging rather than a pixelated heatmap, this is the sensor to pick.

Both sensors communicate over I2C, a standard two-wire protocol that uses just a data line (SDA) and a clock line (SCL). This keeps wiring simple regardless of which sensor you choose.

Full Parts List

Beyond the sensor, you need a handful of components. Here’s what a complete portable build requires:

  • Microcontroller: An ESP32 or ESP8266 board. The ESP32 is the better choice for the MLX90640 since it has more processing power for the larger pixel array. An ESP8266 (like the NodeMCU) works fine with the AMG8833.
  • Display: A 2.8-inch ILI9341 TFT LCD. These are inexpensive, widely available, and have enough resolution to display interpolated thermal images in color.
  • Battery: A 3.7V lithium-ion cell (1000mAh or larger) for portability.
  • Charging module: A TP4056 board to safely recharge the battery over USB.
  • Slide switch: A simple 3-pin switch for power on/off.
  • Pull-up resistors: The I2C bus requires pull-up resistors on both the SDA and SCL lines, though many breakout boards include these already. You’ll also need a 130K resistor if you want to monitor battery voltage through the microcontroller’s analog pin.

Total cost for an AMG8833-based build runs about $25 to $40. An MLX90640 build lands between $50 and $80 depending on where you source parts.

Wiring the Circuit

The wiring is straightforward because I2C keeps things minimal. You only need four connections between the sensor and the microcontroller: SDA to the designated SDA pin, SCL to the designated SCL pin, power (3.3V), and ground. The display connects via SPI, which uses a few more wires (typically clock, data, chip select, data/command, and reset), but most TFT display tutorials for your specific board will map these out pin by pin.

Connect the battery to the TP4056 charging module, then run its output through the slide switch to the microcontroller’s power input. If you want a battery level indicator on screen, run a wire from the battery’s positive terminal through a 130K resistor to the analog input pin. This voltage divider lets the microcontroller read battery level without damaging the pin.

Double-check that your sensor breakout board already includes I2C pull-up resistors before adding external ones. Stacking pull-ups can cause communication errors. If your sensor readings come back as zeros or garbage data, mismatched pull-ups are the most common culprit.

Installing the Software

You’ll program the microcontroller through the Arduino IDE, which is free and runs on Windows, Mac, or Linux. Start by installing the board support package for your microcontroller (search “ESP32” or “ESP8266” in the Arduino Boards Manager).

For the AMG8833, install the Adafruit AMG88xx library through the Arduino Library Manager. For the MLX90640, use the Adafruit MLX90640 library. Both libraries handle the I2C communication and return an array of temperature values, one per pixel, that you can immediately work with.

A basic test sketch reads the sensor data and prints raw temperature values to the serial monitor. With the AMG8833, you’ll see 64 floating-point numbers representing the temperature at each pixel in degrees Celsius. With the MLX90640, you’ll get 768 values. Once you confirm the sensor is returning sensible numbers (your hand held in front of it should read around 30 to 34°C), you’re ready to add the display code.

Turning Raw Data Into a Thermal Image

The sensor gives you a grid of numbers. Turning that into a recognizable image involves two steps: interpolation and color mapping.

Interpolation

An 8×8 grid displayed directly on a 320×240 screen looks like a handful of colored squares. Interpolation fills in the gaps between real data points to create a smoother image. Bilinear interpolation is the simplest approach: it estimates each missing pixel by averaging its four nearest neighbors. This works well enough for most DIY builds and runs fast on a microcontroller.

Bicubic interpolation produces sharper results, especially for edges and fine temperature gradients, because it considers 16 surrounding pixels instead of four. The tradeoff is heavier computation. An ESP32 can handle bicubic interpolation on an 8×8 grid comfortably, but you may need to drop the frame rate when using it with the MLX90640’s larger dataset. For most practical purposes, bilinear interpolation on an AMG8833 or raw display of the MLX90640’s 32×24 grid with light smoothing produces good results.

Color Mapping

Each temperature value gets mapped to a color using a palette, sometimes called a look-up table. The most common palettes in thermal imaging are “Ironbow” (black to blue to red to yellow to white, mimicking heated metal), “Rainbow” (full spectrum from violet through red), and simple grayscale. Cooler temperatures map to blues and purples, while hotter temperatures map to reds, yellows, and whites.

In code, you define the minimum and maximum temperature range you care about, then scale each pixel’s temperature to a position within your color array. If your scene ranges from 20°C to 35°C, a pixel reading 27.5°C would land at the midpoint of your palette. Many open-source thermal camera projects on GitHub include pre-built palette arrays you can drop directly into your sketch.

Why You Don’t Need a Lens (Usually)

Commercial thermal cameras use germanium lenses because germanium transmits infrared radiation in the 8 to 14 micrometer wavelength range that thermal sensors detect. Regular glass and plastic are opaque to these wavelengths, which is why you can’t simply put a standard lens in front of a thermal sensor.

The good news: both the AMG8833 and MLX90640 come with built-in optics on the sensor package. The MLX90640’s two field-of-view options (55°x35° or 110°x75°) are set by the lens integrated into the module. You don’t need to source or focus a separate lens for a working build. If you eventually want to narrow the field of view for long-range detection, germanium lenses are available but expensive, often costing more than the rest of the build combined.

Calibrating for Accuracy

Out of the box, your thermal camera will show relative temperature differences accurately but may be off by a few degrees in absolute readings. Two factors affect accuracy the most: emissivity and ambient temperature compensation.

Every material emits infrared radiation differently. Human skin has an emissivity of about 0.98, meaning it radiates nearly all of its thermal energy and is easy to measure accurately. Polished aluminum, by contrast, has an emissivity as low as 0.04 to 0.06, meaning it reflects surrounding heat rather than emitting its own, which makes it appear much colder than it actually is. Oxidized or anodized metals read more accurately: anodized aluminum jumps to about 0.77. Brass ranges from 0.03 (polished) to 0.60 (heavily oxidized).

For a simple calibration, point your camera at a surface with known temperature and known high emissivity. A cup of water at a measured temperature works well since water has an emissivity around 0.96. Compare the sensor’s reading to a standard thermometer and apply an offset in your code if needed. Both the AMG8833 and MLX90640 include an onboard temperature sensor for ambient compensation, which the libraries use automatically.

Putting It in an Enclosure

A 3D-printed case turns a tangle of wires into something you can actually carry around. Hundreds of free enclosure designs exist on Thingiverse and Printables for common thermal camera builds. If you don’t have a 3D printer, a small project box from any electronics supplier works. Cut holes for the sensor window, display, USB charging port, and power switch.

Position the sensor so it faces outward with nothing obstructing its field of view. Remember that plastic is opaque to the infrared wavelengths your sensor detects, so don’t cover the sensor window with a plastic panel. Leave it open, or cover it with a thin polyethylene film (common plastic wrap is partially transparent to far-infrared, though it will reduce accuracy).

Mount the display so it faces you while the sensor faces forward, like a point-and-shoot camera. Secure the battery with foam tape to prevent it from shifting and potentially shorting against exposed contacts. The entire assembled unit typically fits in your palm.