Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Build AD8495 K-Type Thermocouple ESP32 WebServer
ESP32 Projects IoT Projects

Build AD8495 K-Type Thermocouple ESP32 WebServer

Mamtaz AlamBy Mamtaz AlamUpdated:February 2, 20255 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Build AD8495 K-Type Thermocouple ESP32 WebServer
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

In this tutorial, we will be interfacing AD8495 Analog Output K-Type Thermocouple Amplifier with ESP32 and displaying the temperature readings on an AJAX-based dynamic web server. Earlier, we used AD8495 with Arduino and Raspberry Pi Pico.

The AD8495 is an analog output thermocouple amplifier. The AD8495 thermocouple amplifiers provide a simple, low-cost solution for measuring thermocouple temperatures. This guide will help you connect the AD8495 K-Type Thermocouple Amplifier with ESP32. Using the datasheet and the mathematical equation for temperature measurement, we will develop code to read the temperature values and display them dynamically on a web server using AJAX for real-time updates.


Bill of Materials

We need the following components for making Digital Thermometer using AD8495 Thermocouple Amplifier & ESP32.

S.N.Components NameQuantityPurchase Links
1ESP32 Board1Amazon | AliExpress
2AD8495 K-Type Thermocouple Amplifier1Amazon | AliExpress
3Connecting Wires5Amazon | AliExpress
4Breadboard1Amazon | AliExpress




AD8495 K-Type Thermocouple Amplifier

The AD8495 K-Type Thermocouple Amplifier, developed by Analog Devices, is particularly suited for applications requiring high precision. As part of the AD8494/AD8495/AD8496/AD8497 family, it integrates precision instrumentation amplifiers with a cold junction compensator to directly produce a 5 mV/°C output from a K-type thermocouple signal.

AD8495 k-Type Thermocouple Amplifier

This device simplifies the process of temperature measurement by combining an ice point reference with a precalibrated amplifier. This facilitates its use either as a standalone thermometer or as part of a switched output setpoint controller. Specifically calibrated for K-type (chromel-alumel) thermocouples through laser wafer trimming, the AD8495 ensures high accuracy across its optimized ambient temperature range. It supports a wide variety of supply voltages, from 3 V for direct interfacing with low-supply ADCs to up to 36 V for industrial systems requiring broad common-mode input ranges.

AD8495 k-Type Thermocouple Amplifier with Thermocouple

The temperature readings can be easily obtained by measuring the output voltage and applying the equation:

Temperature = (Vout – 1.25) / 0.005 V

For instance, a voltage reading of 1.5VDC translates to a temperature of 50°C. The device’s design minimizes self-heating with a total supply current of 180 μA when unloaded, although it is capable of delivering over ±5 mA to a load. This amplifier comes with a fully assembled PCB, which includes the AD8495 and a TLVH431 1.25V precision voltage reference, a 2-pin terminal block for easy connection to a thermocouple, and a pin header for breadboard integration. Refer to the AD8495 Datasheet for more information.



AD8495 Features & Specifications

  • Works with any K-type thermocouple
  • Will not work with any other kind of thermocouple other than K type.
  • Easy to use analog output.
  • Temp range with 5V power: -250°C to +750°C output(0 to 5VDC)
  • Temp range with 3.3V power: -250°C to +410°C output(0 to 3.3VDC)
  • Sensing Accuracy Range: ± 1°C around room temperature, ± 2°C for −25°C to +400°C
  • Sensing Temperature Max: 400°C
  • Sensing Temperature Min: -25°C
  • Supply Voltage: 3-18V DC

AD8495 Breakout Board Pinout

Power & Output Pins

  • V+ – This is the power pin. This board works with 3.3V and 5V power.
  • GND – Common ground pins
  • OUT – This is the output voltage pin. Read using an analog input.

Thermocouple Terminal

  • Red- – Connect the red or – wire on your thermocouple to this side of the screw terminal.
  • Ylw+ – Connect the yellow or + wire on your thermocouple to this side of the screw terminal.

Interfacing AD8495 K-Type Thermocouple Amplifier with ESP32

Let us interface the AD8495 K-Type Thermocouple Amplifier with ESP32 WiF-Fi Microcontroller. Here is the connection diagram.

Interfacing AD8495 K-Type Thermocouple Amplifier with ESP32

  • Connect the VCC of the AD8495 to the 3.3V of ESP32.
  • Connect the GND of the AD8495 to a GND pin on the ESP32.
  • Finally, connect the Vout (output) of the AD8495 to GPIO33 of ESP32.

AD8495 ESP32 Module

You may use a breadboard to place the AD8495 Module. Then, install the thermocouple on the thermocouple terminal of AD8495.




Source Code/Program for Reading Temperature

This code reads a raw ADC value from a thermocouple connected to pin 33 on an ESP32 Then it converts the raw ADC reading to a voltage, and then calculates the temperature from that voltage. The temperature is then printed to the Serial Monitor every 500 milliseconds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "esp_adc_cal.h"
 
#define THERMOCOUPLE_PIN 33
#define ANALOG_REFERENCE_VOLTAGE 3.3 // ESP32 typically uses 3.3V for AREF
#define ADC_BIT_RESOLUTION 12 // ESP32 uses 12-bit ADC resolution by default
 
float calculatedVoltage, measuredTemperature;
 
// Function to convert a raw ADC reading to voltage. ESP32's ADC readings can be 12-bit by default,
// and we're using 3.3V as the reference voltage.
float convertRawAdcToVoltage(uint32_t rawAdcValue) {
  // Characterize the ADC
  esp_adc_cal_characteristics_t adcCharacteristics;
  esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, 1100, &adcCharacteristics);
 
  // Convert the raw ADC value to calibrated voltage in millivolts
  uint32_t voltageInMilliVolts = esp_adc_cal_raw_to_voltage(rawAdcValue, &adcCharacteristics);
 
  // Convert millivolts to volts
  return voltageInMilliVolts / 1000.0;
}
 
float calculateTemperatureFromVoltage(float voltage) {
  return (voltage - 1.25) / 0.005;
}
 
void setup() {
  Serial.begin(115200);
  // Note: Additional configuration for the ADC may be necessary depending on your specific setup.
}
 
void loop() {
  // Read the raw ADC value
  uint32_t rawAdcReading = analogRead(THERMOCOUPLE_PIN);
  
  // Convert the raw ADC reading to voltage
  calculatedVoltage = convertRawAdcToVoltage(rawAdcReading);
  
  // Calculate the temperature in Celsius from the voltage
  measuredTemperature = calculateTemperatureFromVoltage(calculatedVoltage);
  
  // Print the measured temperature
  Serial.print("Temperature = ");
  Serial.print(measuredTemperature);
  Serial.println(" °C");
  
  // Delay for a short period before reading the temperature again
  delay(500);
}

Upload the code to the ESP32 Wi-Fi Module. Once the uploading is done, open the Serial Monitor.



Source Code/Program for ESP32 AD8495 WebServer

The following code connects an ESP32 to a Wi-Fi network, reads the temperature from a thermocouple connected to pin 33, and serves a web page to display the temperature.

It reads the raw ADC value, converts it to voltage, calculates the temperature, and provides a JSON endpoint to get the temperature in both Celsius and Fahrenheit. The temperature data is updated and served to clients via a web server running on the ESP32.

html.h

First save this html file with the name html.h in the folder where main sketch is located.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const char html_page[] PROGMEM = R"rawString(
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Temperature Monitor</title>
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
  <style>
    body {
      margin: 0;
      padding: 20px;
      font-family: 'Roboto', sans-serif;
      background: #FFFFFF; /* Background color set to white */
      color: #333;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      overflow: hidden;
    }
    .container {
      text-align: center;
      padding: 2em;
      background: rgba(255, 255, 255, 0.95); /* Slightly transparent white for depth */
      border-radius: 15px;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Soft shadow for a subtle depth effect */
    }
    h1 {
      color: #333; /* Dark grey text for contrast */
      margin-bottom: 1em;
    }
    .temperature {
      display: inline-block;
      background: rgba(0, 0, 0, 0.05); /* Very light background for the temperature boxes */
      color: #333; /* Consistent text color */
      padding: 0.5em 1em;
      border-radius: 8px;
      margin: 0.5em 0;
      font-size: 2em;
    }
    .temperature span {
      font-size: 2.5em;
      font-weight: 500;
    }
    .degree-symbol {
      font-size: 0.5em;
      vertical-align: super;
    }
    @media (max-width: 600px) {
      .temperature span {
        font-size: 2em;
      }
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>ESP32 Temperature Monitor</h1>
    <div class="temperature">
      <span id="TempValueCelsius">--</span><span class="degree-symbol">&deg;C</span>
    </div>
    <div class="temperature">
      <span id="TempValueFahrenheit">--</span><span class="degree-symbol">&deg;F</span>
    </div>
  </div>
 
  <script>
    setInterval(function() {
      fetch("readTemp")
        .then(response => response.json())
        .then(data => {
          document.getElementById("TempValueCelsius").innerHTML = data.celsius;
          document.getElementById("TempValueFahrenheit").innerHTML = data.fahrenheit;
        })
        .catch(error => console.error("Error fetching temperature data:", error));
    }, 1000);
  </script>
</body>
</html>
)rawString";



main.ino

Open the new Arduino sketch and save the file in the folder where html.h file is located.
Change the ssid and password and replace with your credentials.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <WiFi.h>
#include <WebServer.h>
#include <esp_adc_cal.h>
#include "html.h"
 
// Replace with your network credentials
const char* ssid = "***********";
const char* password = "***********";
 
WebServer server(80);
 
#define THERMOCOUPLE_PIN 33
#define ANALOG_REFERENCE_VOLTAGE 3.3
#define ADC_BIT_RESOLUTION 12
 
float calculatedVoltage, measuredTemperature;
 
float convertRawAdcToVoltage(uint32_t rawAdcValue)
{
  esp_adc_cal_characteristics_t adcCharacteristics;
  esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, 1100, &adcCharacteristics);
  uint32_t voltageInMilliVolts = esp_adc_cal_raw_to_voltage(rawAdcValue, &adcCharacteristics);
  return voltageInMilliVolts / 1000.0;
}
 
float calculateTemperatureFromVoltage(float voltage)
{
  return (voltage - 1.25) / 0.005;
}
 
void setup()
{
  Serial.begin(115200);
 
  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(2000);
    Serial.println("Connecting to WiFi...");
  }
 
  // Print the IP address
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());
 
  server.on("/", []()
  {
    server.send_P(200, "text/html", html_page);
  });
 
  server.on("/readTemp", HTTP_GET, []() {
    float celsius = measuredTemperature;
    float fahrenheit = celsius * 1.8 + 32;
    char json[70];
    snprintf(json, 70, "{\"celsius\": \"%.2f\", \"fahrenheit\": \"%.2f\"}", celsius, fahrenheit);
    server.send(200, "application/json", json);
  });
 
  server.begin();
}
 
void loop()
{
  uint32_t rawAdcReading = analogRead(THERMOCOUPLE_PIN);
  calculatedVoltage = convertRawAdcToVoltage(rawAdcReading);
  measuredTemperature = calculateTemperatureFromVoltage(calculatedVoltage);
 
  server.handleClient();
}

After uploading the code, open the Serial Monitor, the ESP32 local IP address will be displayed. Enter the IP address in the Web browser and hit enter.

To observe the change in temperature, heat the thermocouple.

You will see rise in temperature.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleThermal Fever Detector with MLX90640 & OpenCV Raspberry Pi
Next Article Mars Rover Robot Replica using ESP32 CAM & Arduino

Related Posts

ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

Updated:June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

Updated:June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

Updated:May 10, 20262K
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

Updated:May 2, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

Updated:April 27, 20261K
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

Updated:April 27, 20262K
Add A Comment

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • Designing of MPPT Solar Charge Controller using Arduino
    Designing of MPPT Solar Charge Controller using Arduino
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.