4
EXPERIMENT 3 OBJECTIVE: To interface temperature sensor with microcontroller and perform closed loop control operation using the LabVIEW. APPARATUS USED: Arduino board, Temperature sensor, LABVIEW setup. THEORY: Introduction to LABVIEW: LabVIEW is an integrated development environment designed specifically for engineers and scientists. Native to LabVIEW is a graphical programming language (G) that uses a dataflow model instead of sequential lines of text code, empowering you to write functional code using a visual layout that resembles your thought process. This means you spend less time worrying about semicolons and syntax and more time solving the problems that matter. Introduction to Arduino: Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

To interface temperature sensor with microcontroller and perform closed loop control operation using the LabVIEW

Embed Size (px)

Citation preview

Page 1: To interface temperature sensor with microcontroller and perform closed loop control operation using the LabVIEW

EXPERIMENT – 3

OBJECTIVE: To interface temperature sensor with microcontroller and perform closed loop

control operation using the LabVIEW.

APPARATUS USED: Arduino board, Temperature sensor, LABVIEW setup.

THEORY:

Introduction to LABVIEW: LabVIEW is an integrated development environment designed

specifically for engineers and scientists. Native to LabVIEW is a graphical programming language

(G) that uses a dataflow model instead of sequential lines of text code, empowering you to write

functional code using a visual layout that resembles your thought process. This means you spend

less time worrying about semicolons and syntax and more time solving the problems that matter.

Introduction to Arduino: Arduino is an open-source electronics platform based on easy-to-use

hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button,

or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing

something online. You can tell your board what to do by sending a set of instructions to the

microcontroller on the board. To do so you use the Arduino programming language (based on Wiring),

and the Arduino Software (IDE), based on Processing.

Page 2: To interface temperature sensor with microcontroller and perform closed loop control operation using the LabVIEW

Over the years Arduino has been the brain of thousands of projects, from everyday objects to

complex scientific instruments. A worldwide community of makers - students, hobbyists, artists,

programmers, and professionals - has gathered around this open-source platform, their

contributions have added up to an incredible amount of accessible knowledge that can be of great

help to novices and experts alike.

Temperature Sensor: A thermistor is a type of resistor whose resistance is dependent on

temperature, more so than in standard resistors. The word is a portmanteau of thermal and resistor.

Thermistors are widely used as inrush current limiter, temperature sensors (Negative Temperature

Coefficient or NTC type typically), self-resetting overcurrent protectors, and self-regulating

heating elements (Positive Temperature Coefficient or PTC type typically).

Thermistors are of two opposite fundamental types:

With NTC, resistance decreases as temperature rises to protect against inrush overvoltage

conditions. Commonly installed parallel in a circuit. As current sink.

With PTC, resistance increases as temperature rises to protect against overcurrent conditions.

Commonly installed series in a circuit. As resettable fuse.

Thermistors differ from resistance temperature detectors (RTDs) in that the material used in a

thermistor is generally a ceramic or polymer, while RTDs use pure metals. The temperature

response is also different; RTDs are useful over larger temperature ranges, while thermistors

typically achieve a greater precision within a limited temperature range, typically −90 °C to 130

°C.

Interfacing Thermistor with Arduino:

These thermistors are pretty hardy, you can strip the PVC insulation and stick the wires into a

breadboard or solder to them directly. Of course you can cut or extend the wires. Since the

resistance is pretty high (10Kohm) the wire resistance won't make a huge difference.

Page 3: To interface temperature sensor with microcontroller and perform closed loop control operation using the LabVIEW

Interface Arduino through LabVIEW:

Step 1: In LabVIEW (any version) establish the following front panel

Step 2: Establish the following block diagram.

Step 4: This virtual instrument:

>> Starts communication with Arduino.

>> Detects if there is a change in control knob value.

>> If there is a change it sends the new value to Arduino.

>> Else, it clears serial port Input/output register to avoid data overflow and serial port

overloading.

>> When pressing STOP, it sends “0” (brake or hold order) to Arduino.

Step 5: Arduino Code

(Attachment available)

Page 4: To interface temperature sensor with microcontroller and perform closed loop control operation using the LabVIEW

Checks if LabVIEW sent a new value. If there is a new value, it converts it into integer byte with

the same value. This integer byte represents the delay interval used in stepping sequence. That,

the greater the delay the lower the speed and vice versa. Else, Arduino continue running the

motor at current speed. This prevents the processor from overloading the serial port and pushes it

to avoid Arduino Serial port hanging.

Calculates temperature from its resolution and delay intervals between steps as following:

The Steinhart and Hart equation is an empirical expression that has been determined to be the best

mathematical expression for resistance temperature relationship of NTC thermistors and NTC

probe assemblies.

The most common equation is:

1/T= a+ b(LnR)+c(LnR)^3 (Eqn 5)

where: T = degrees Kelvin

a,b, and c = coefficients derived from measurement

To solve for a, b and c coefficients, measure the thermistor at three different temperatures. The

temperatures should be evenly spaced and at least 10 degrees apart. Use the three temperatures to

solve three simultaneous equations.

1/T1 = a +b(LnR1)+c(LnR1)^3

1/T2 = a +b(LnR2)+c(LnR2)^3

1/T1 = a +b(LnR3)+c(LnR3)^3

These equations allow you to derive a, b and c for any temperature range. Knowing a, b and c for

the thermistor allows you to use the Steinhart and Hart equation in two ways.

1) If resistance is known and temperature desired then use eqn 5.

2) If temperature is known and expected resistance is desired than use this equation:

R= e exp [(ß – (ά/2))^1/3 – (ß + (ά/2))^1/3]

Where

ά=(a-(1/T))/c and ß=[((b/3c)^3) + ((ά^2)/4)]^1/2

Sends the calculated motor speed to another Serial port of Arduino UNO to show if our code

works

RESULT: Successfully reading the temperature variation by interfacing thermistor with Arduino

and LabVIEW.