Temperature Measurement Using XinaBox and a Thermistor

23

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

Step 1: Things Used in This Project

Hardware components

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

Software apps and online services

Hand tools and fabrication machines

  • Flathead Screwdriver
    To tighten or loosen screw terminal clamp

Step 2: Story

Introduction

I wanted to measure the temperature of a liquid by creating a simple thermometer. By using XinaBox xChips I could accomplish this with relative simplicity. I used the SX02 analogue input xChip which accepts 0 - 3.3V, the CC01 xChip based off the ATmega328P and the OD01 OLED display xChip to view my temperature results.

Thermistor measuring temperature of water in a glass

Step 3: Download Necessary Files

You will need the following libraries and software:

Click here to see how to install the libraries.

Once you've installed the Arduino IDE, open it up and select the "Arduino Pro or Pro Mini" as the board to upload your program to. Also make sure the ATmega328P (5V, 16MHz) processor is selected. See image below.

Select the Arduino Pro or Pro Mini board and the ATmega328P (5V, 16MHz) processor

Step 4: Assemble

Click the programmer xChip, IP01, and the ATmega328P based CC01 xChip together using XC10 bus connectors as shown below. In order to upload to the CC01 you'll need to place the switches in the 'A' and 'DCE' positions respectively.

IP01 and CC01 clicked together

Next, take your 10kΩ resistor and screw one end in the terminal marked "IN" and the other end in the ground terminal, "GND", on the SX02. Take the leads on the thermistor probe and screw one end in Vcc, "3.3V", and the other end in the "IN" terminal. See the graphic below.

SX02 connections

Now combine OD01 and SX02 with CC01 by simply clicking them together using XC10 bus connectos. See below. The silver element in the image is the thermistor probe.

Complete unit for programming

Step 5: Program

Insert the unit into the USB port on your computer. Download or copy and paste the code below into your Arduino IDE. Compile and upload the code to your board. Once uploaded your program should start running. If you probe is at room temperature conditions, you should observe ±25°C on the OLED display as shown below.

After uploading observe the room temperature on the OLED display

Step 6: Portable Thermometer

Remove the unit from your computer. Disassemble the unit and reassemble it using PU01 instead of IP01. Now take your 5V USB portable power supply such as a power bank or similar and insert the new assembly into it. You now have your own cool portable thermometer with good accuracy. See the cover image to see it in operation. I measured hot water in a glass. The below images shows your complete unit.

Complete unit comprising CC01, OD01, SX02 and PU02.

Step 7: Conclusion

This project took under 10min to assemble and another 20min to program. the only passive component required was a resistor. The xChips just click together making it very convenient.

Step 8: 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 normalize 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 }

Share

    Recommendations

    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019

    Discussions