Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
University of Montenegro
Faculty of Electrical Engineering
Course: Industrial Electronics
Theme: Surface Temperature Measurement Using a Type K
Thermocouple
Mentor: Prof. dr Radovan Stojanović
Students:
Golubović Tina 41/19
Djurković Jovan 6/19 Vojinović Ivan 43/19
Date and Place: March 2020, Podgorica
2
Contents Problem description ................................................................................................................................ 3
Connection scheme................................................................................................................................. 3
Program................................................................................................................................................... 5
Experimental Results and Diagrams ....................................................................................................... 8
Conclusion ............................................................................................................................................. 10
Literature .............................................................................................................................................. 10
3
Problem description
This is a lab project, made in ADEG electronics lab at the University of Montenegro, with
mentoring of prof. dr. Radovan Stojanovic. The task of this project is to demonstrate
sampling process of a VERNIER type K thermocouple sensor at time interrupt levels with the
possibility of setting the START / STOP function and sampling frequency at 5Hz, 2Hz and
1Hz.In our case, this set of commands defines the sampling rate of the sensor. Samples can
be taken every 0.2sec, 0.5sec and 1sec.
Connection scheme
The Surface Temperature Sensor has an exposed thermistor that results in an extremely rapid
response time. This design allows for use in air and water. For temperature measurements in
harsher environments, a more durable probe is required. The sensor is connected on Arduino
Uno board through BAT-ELV Vernier, where SIG1 is connected to Arduino analog pin A0,
5V and GND is from Arduino board.
Figure 1 – Arduino Uno board Figure 2 – analog protoboard adapter
Figure 3 – Experimental setup
4
Here are some specifications of the sensor:
Temperature range: –25 to 125°C (–13 to 257°F)
Maximum temperature that the sensor can tolerate without damage: 150°C
Typical Resolution:
0.08°C (–25 to 0°C)
0.03°C (0 to 40°C)
0.1°C (40 to 100°C)
0.25°C (100 to 125°C)
Temperature sensor: 20 kΩ NTC Thermistor
Accuracy: ±0.2°C at 0°C, ±0.5°C at 100°C
Response time (time for 90% change in reading)
50 seconds (in still air)
20 seconds (in moving air)
Probe dimensions: Probe length (handle plus body) 15.5 cm
Typical uses for the Surface Temperature Sensor include the following:
Skin temperature measurements
Human respiration studies
Specific heat experiments
Heat transfer experiments
Friction and energy studies
Figure 4 – Running the experiment
5
Program
The code shown below uses arduino timer interrupts, which allows us to briefly pause the
normal sequence of events taking place in the loop() function at precisely timed intervals,
while we execute a separate set of commands. Once these commands are done,
the Arduino picks up again where it was in the loop(). We also used EEPROM memory
which stands for electrically erasable programmable read-only memory. It is a non-volatile
flash memory device, that is, stored information is retained when the power is removed. The
information saved in an EEPROM chip is not lost even when power is turned off.
Arduino code:
#include <EEPROM.h> // nedded to access EEPROM memory
#include <MATH.h> // nedded to calculate log
float voltage = 0;
double R = 0;
double Rlog = 0;
double T = 0;
const double K0 = 1.02119e-3;
const double K1 = 2.22468e-4;
const double K2 = 1.33342e-7;
char inChar = 'A';
int sensorValue = 0;
unsigned int Nt = 53036;
boolean reading = false;
unsigned int NtEeprom=0;
void setup()
Serial.begin(57600);
NtEeprom = ((((EEPROM.read(4))*10 + EEPROM.read(3))*10 +
EEPROM.read(2))*10 + EEPROM.read(1))*10 + EEPROM.read(0);
Nt = NtEeprom;
noInterrupts(); // disable all interrupts
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = Nt; // preload timer 65536-16MHz/256/5Hz
TCCR1B |= (1 << CS12); // 256 prescaler 64us
TIMSK1 |= (1 << TOIE1); // enable timer overflow interrupt
interrupts(); // enable all interrupts
void loop()
if(reading && inChar == 'a') //If A/D read
Serial.println(T); //Print value
reading = false; //enable A/D read again
6
if(reading && inChar == 'b') //If A/D read
Nt = 53036; // T=0.2s
EEPROM.write(0, 6); // write 53036 in EEPROM
EEPROM.write(1, 3);
EEPROM.write(2, 0);
EEPROM.write(3, 3);
EEPROM.write(4, 5);
Serial.println(T); //Print value
Reading = false; //enable A/D read again
if(reading && inChar == 'c') //If A/D read
Nt = 34286; // T=0.5s
EEPROM.write(0, 6); // write 34286 in EEPROM
EEPROM.write(1, 8);
EEPROM.write(2, 2);
EEPROM.write(3, 4);
EEPROM.write(4, 3);
Serial.println(T); //Print value
reading = false; //enable A/D read again
if(reading && inChar == 'd') //If A/D read
Nt = 3036; // T = 1s
EEPROM.write(0, 6); // 3036 in EEPROM
EEPROM.write(1, 3);
EEPROM.write(2, 0);
EEPROM.write(3, 3);
EEPROM.write(4, 0);
Serial.println(T); //Print value
reading = false; //enable A/D read again
if(reading = false && inChar == 'e') //If A/D read
Serial.println(T); //Print value
reading = true; //enable A/D read again
void serialEvent()
while(Serial.available())
inChar = (char)Serial.read();
ISR(TIMER1_OVF_vect)
TCNT1 = Nt; // preload timer
sensorValue = analogRead(A0); //read A/D
7
voltage = float(sensorValue)*5/1024;
R = (15000*voltage) / (5 - voltage);
Rlog = log(R);
T = 1/(K0 + K1*Rlog + K2*Rlog*Rlog*Rlog) - 273.15;
reading = true; //A/D read
8
Experimental Results and Diagrams
This probe uses the 20 kΩ NTC Thermistor, which is a variable resistor. When the
temperature increases, the resistance decreases non-linearly. The best-fit approximation to
this nonlinear characteristic is the Steinhart-Hart equation. At 25°C, the resistance is
approximately 4.3% per °C. The interface measures the resistance value, R, at a particular
temperature and converts the resistance using the Steinhart-Hart equation:
T=[K0+K1(ln 1000R) + K2(ln 1000R)3]-1
–273.15,
Where T is temperature (°C), R is the measured resistance in kΩ, K0=1.02119×10-3
,
K1=2.22468×10-4
and K2=1.33342×10-7
. Our program performs this conversion and provides
readings in °C.
Figure 5 – Matlab plotter for thermistor function
Two experiments were done. First one is with ice water and the second with boiling water.
We have compared our results with results from software Logger Lite 1.9.4 from VERNIR
web site as a proof that our sensor is working correctly.
For the first experiment the Figure 6 shows results from Arduino Serial Plotter and Figure 7
shows corresponding measurement from Logger Lite software. Similar for the second
experiment, results are shown in Figure 8 and Figure 9.
As it can be seen, the sensor does not need to be calibrated, which indicates that our code is
valid and sensor does work correctly.
9
Figure 6 – Arduino Serial Plotter results of ice water
Figure 7 – Software Logger Lite and Lab Quest results of ice water
Figure 8 – Arduino Serial Plotter results of boiling water
10
Figure 9 – Software Logger Lite and Lab Quest results of boiling water
Conclusion
Surface temperature sensor is used for temperature measurements and it is useful in medicine,
industry and commercial purposes. The maximum allowed variation in accuracy is ±0.2°C at 0°C, ±0.5°C at 100°C.
As a software solution we used Arduino. For the code written above, the temperature changes
on the type K thermocouple can be seen in Arduino/Serial Monitor for specified entered
character which determines the speed of printed readings (sampling frequency), or releasing
and interrupting this series of samples. Graphic interpretation is obtained through
Arduino/Serial Plotter. For higher sampling frequency we get more detailed graph.
Literature 1. http://apeg.ac.me/nastava/VJEZBA3%20Timer%20interrupt.pdf
2. https://www.instructables.com/id/Arduino-Timer-Interrupts/
2. https://www.vernier.com/product/surface-temperature-sensor/
3. https://www.vernier.com/files/manuals/sts-bta/sts-bta.pdf