Anon ymous
Published © MIT

Temperature Measurement Using ☒XinaBox And A Thermistor

Measure the temperature of a liquid using an analogue input ☒CHIP from XinaBox and a thermistor probe.

BeginnerFull instructions provided30 minutes645
Temperature Measurement Using ☒XinaBox And A Thermistor

Things used in this project

Hardware components

XinaBox SX02
☒CHIP analogue input sensor with ADC
×1
XinaBox CC01
☒CHIP version of Arduino Uno based on ATmega328P
×1
Resistor 10k ohm
Resistor 10k ohm
10k resistor for voltage divider network
×1
Thermistor Probe
10k at 25°C NTC waterproof thermistor probe
×1
IP01
XinaBox IP01
☒CHIP USB Programmer based on FT232R From FTDI Limited
×1
OD01
XinaBox OD01
☒CHIP 128x64 Pixel OLED Display
×1
XC10
XinaBox XC10
☒CHIP bus connectors
×4
PU01
XinaBox PU01
☒CHIP USB (Type A) Power Supply
×1
5V USB Power Supply
Power Bank or similar
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Flathead Screwdriver
To tighten or loosen screw terminal clamp

Story

Read more

Code

ThermTemp_Display.ino

Arduino
Research thermistors in order to understand the calculations in the code.
#include <xCore.h>          // include core library for xCHIPs
#include <xSX01.h>          // include analogue input sensor library
#include <xOD01.h>          // include OLED display library
#include <math.h>           // include maths functions

#define C_Kelvin 273.15     // for conversion from kelvin to celsius
#define series_res 10000    // value of series resistor in ohms
#define B 3950              // B parameter for thermistor
#define room_tempK 298.15   // room temperature in kelvin
#define room_res 10000      // resistance at room temperature in ohms
#define vcc 3.3             // supply voltage

xSX01 SX01(0x55);           // set the i2c address

float voltage;              // variable containing the measured voltage (0 - 3.3V)
float therm_res;            // thermistor resistance
float act_tempK;            // actual temperature kelvin
float act_tempC;            // actual temperature in celsius

void setup() {
  // put your setup code here, to run once:

  // initialize variables to 0
  voltage = 0;
  therm_res = 0;
  act_tempK = 0;
  act_tempC = 0;

  // start serial communication
  Serial.begin(115200);

  // start i2c communication
  Wire.begin();

  // start the analogue input sensor
  SX01.begin();

  // start OLED display
  OLED.begin();

  // clear display
  OD01.clear();

  // delay to normailze
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:

  // read the voltage
  SX01.poll();

  // store the volatge
  voltage = SX01.getVoltage();

  // calculate thermistor resistance
  therm_res = ((vcc * series_res) / voltage) - series_res;

  // calculate the actual temperature in kelvin
  act_tempK = (room_tempK * B) / (B + room_tempK * log(therm_res / room_res));

  // convert kelvin to celsius
  act_tempC = act_tempK - C_Kelvin;

  // print temperature on OLED display
  // manual formatting to display in center
  OD01.set2X();
  OD01.println("");
  OD01.println("");
  OD01.print("  ");
  OD01.print(act_tempC);
  OD01.print(" C");
  OD01.println("");

  delay(2000);      // update display every 2 seconds
}

Credits

Anon ymous

Anon ymous

10 projects • 2 followers
Thanks to Circuit Basics.

Comments