Virtual Tool Used for Temperature Monitoring through I 2 C Protocol

. Temperature monitoring is very important both for large geographical and industrial environments, but equally for equipment or subassemblies in a technological process. Monitoring in all cases is important to prevent accidents or the occurrence of major defects. In this paper, a temperature monitoring solution is proposed for a number of up to 8 measurement points located at distances of up to 2 m by means of intelligent integrated sensors capable of transmitting information through the I 2 C industrial protocol. A flexible hardware structure and software development concept are presented to offer local information and to be integrated into a hierarchical temperature monitoring network.


Temperature measurement and monitoring
Temperature is one of the physical quantities whose values need to be known in many situations.Their measurement can be imposed by the need to know the evolution of this quantity but also for the indirect determination of other physical quantities such as air speed or the value of an electric current, for example.
For temperature, measurement engineers use a variety of sensors, but the most popular of these are thermocouples, RTDs, and thermistors.Choosing the right sensor for an application depends on this application's requirements.
In Table1 is presented a comparison of the typical temperature sensors [1].Along with these types of sensors, integrated sensors based on the functional principles of the p-n junction have been developed and gained a growing area of use.Their field of use is also very wide, from measurements in the laboratory to measurements in industrial processes developed on an appreciable surface.
Making temperature sensors based on the p-n junction from a diode or bipolar transistor is possible due to the pronounced dependence of its parameters on temperature.Powering the junction through a constant current source causes a voltage drop across it proportional to the temperature at which the junction is found.
Another principle used in the realization of semiconductor sensors consists in the successive establishment of two values of the collector currents and the memorization of the corresponding base-emitter voltages and by their difference a voltage is obtained that is directly proportional to the absolute temperature of the structure.
Smart temperature sensors are made in an integrated form and both the sensitive element and the signal acquisition and processing circuits are integrated, including those for transmission of data through different communication protocols.

Temperature sensor TCN75A
In the realization of the hardware structure of the temperature monitoring system proposed in this paper, the integrated temperature sensor TCN75A, a Microchip product, is used.This is 2-wire serial temperature sensor which uses the difference in the base-emitter voltage of a transistor while its collector current is changed from IC1 to I C2 .With this method, the ΔV BE depends only on the ratio of the two currents and the ambient temperature, as shown in equation ( 1) where: T = temperature in Kelvin; ΔV BE = change in base-emitter voltage junction; k = Boltzmann's constant; q = electron charge; I C1 and I C2 = currents with known ratio.A Sigma-Delta analog-digital convertor is used to convert ΔV BE to a digital code that corresponds to the transistor temperature.The converter has an adjustable resolution from 0.5°C (at 30 msec.conversion time) to 0.0625°C (at 240 msec.conversion time).Thus, it allows the user to make trade-offs between resolution and conversion time.
The most important features of this sensor are [2]:  Temperature-to-Digital Converter;  Accuracy: ±1 (typical) from -40°C to +125°C;  User-selectable Resolution: 0.5°C to 0.0625°C;  Operating Voltage Range: 2.7V to 5.5V;  2-wire Interface: I2C™ Compatible;  Operating Current: 200 μA (typical);  Shutdown Current: 2 μA (maximum);  Power-saving One-shot Temperature Measurement.The TCN75A has integrated user-programmable registers which ensure flexibility in temperature-sensing applications.Such register settings allow a selection from 0.5°C to 0.0625°C of the temperature measurement resolution.The configuration between the powersaving Shutdown and One-shot modes ensures the specification of temperature alert output and hysteresis limits.When the temperature changes beyond the specified limits, the TCN75A outputs an alert signal.The user has the option of setting the alert output signal polarity as an active-low or active-high comparator output for thermostat operation, or as temperature event interrupts output for the acquisition systems.
In Fig. 1 are shown the pin configuration and the typical application of this temperature sensor.The TCN75A sensor has an industry-standard 2-wire, I2C™ compatible serial interface, allowing up to eight devices to be controlled in a single serial bus.These features make the TCN75A ideal for low-cost, sophisticated multi-zone temperature-monitoring applications [2].

Hardware structure of the monitoring system
The monitoring system was tested using three TCN75A sensors connected to an NI MyRIO module, a National Instruments product.Each sensor is included in a PmodTmp3 module that ensures the voltage supply as well as making connections for I 2 C communication with the NI MyRIO data acquisition and processing module.
The PmodTMP3 module communicates with other devices via the serial bus and I 2 C protocol using an 8-pin connector that also provides the necessary pins for serial connection with the other I 2 C devices.The user has a 3-pin slot for selecting the sensor address and another 2-pin slot for controlling attached external devices.The control is carried out based on the temperature thresholds defined by the user in the control software application.The measured temperature values are transmitted to the user in 2's complement format with a resolution from 9 to 12 bits also set by software via the sensor's configuration register [3].
Two 8-bit registers provide the measured temperature data in degrees Celsius every 30 msec for 9-bit analogue-digital resolution and every 240 msec for 12-bit resolution.It should be noted that each additional bit doubles the analogue-digital conversion time.The opendrain "ALERT" output provides a limit reference value to indicate when the temperature exceeds a user-defined limit value.
The NI myRIO module is a National Instruments product built on the NI CompactRIO technology and platform.It includes Xilinx's programmable on-a-chip (SoC) technology, which combines a dual-core ARM Cortex-A9 processor and an FPGA with 28,000 programmable logic cells.It can be programmed through the NI LabVIEW graphical programming environment providing flexibility in prototyping and projects.NI myRIO includes 10 analog inputs, six analog outputs, and 40 digital I/O lines-also a three-axis accelerometer, several programmable LEDs, and the possibility of a WiFi connection [4].Using the 3-pin slot, through which the addresses of up to 8 Pmod TMP3 modules can be set, the addresses 48h, 49h and 4Ah are set for the 3 modules used.

Software structure of the monitoring system
System programming is done in Labview, such an application having the name of a virtual instrument.A virtual tool thus created has two components main one, namely the front panel which represents the user interface, and the block diagram which represents the program itself [5,6].

Front panel
The front panel contains input-type interface elements through which data and commands can be entered and output-type elements through which the obtained values can be read or viewed.After creating the program, it will be loaded into the internal memory of the module, an operation through which all the functions necessary for its use are integrated into the application.Fetching functions from the Labview libraries is done automatically by loading the program into the internal memory of the Ni MyRio module.
The front panel of this application has two user-selectable temperature measurement mode components, Manual and Automatic, as is seen in Fig. 4.

Fig. 4. Front panel of the virtual instrument
By means of it, temperature monitoring can be done in manual mode when the user selects each measurement point [Zona 0 … Zona 2] or in automatic mode when the sensors in the measurement points are interrogated cyclically with a period set by the user.
For each measurement point in both manual and automatic modes, the front panel includes:  one alarm threshold setting control for setting the temperature value from which the user is warned for exceeding the temperature. one graphic and numerical indicator that will display the current value of the temperature. one character string type indicator each which, in case of exceeding the alarm threshold, will display a corresponding message.On the front panel there is also the STOP button, used to stop the running application and an indicator Configurare regiștrii for displaying the values of the communication programming registers between the sensors and the Ni MyRIO module.
In the window corresponding to the Automatic option on the front panel, the Temporizare control is added through which the user can set the interval [0.1 ... 10] sec.the times between the cyclic readings of two sensors with consecutive addresses.

Diagram block
The block diagram of the application, presented in Fig. 5., represents the actual operating program and includes the structures, functions and operations necessary for settings, data acquisition and processing as well as communication through the I 2 C bus.
For both modes, Manual and Automatic reading of temperature values in the block diagram block diagram, the following structures are used:  While, which allows the program to run, once launched, until the STOP button is pressed;  Case, used both for the selection of one of the two ways of reading the temperature values and for the selection of the sensor, based on their address, that is being read at a given time.The selection of one of the sensors on the bus is based on its address.Used sensors can be connected in a number of eight on the same bus with addresses in 48h...4Fh, for the selection a structure is used that allows choosing the address.Simultaneously with the selection of the address, the indicator that will show the temperature of the sensor is also selected.The selection of the sensors made at their address is done by means of a Tab control with a number of pages identical to the number of sensors used.This control is used to select the options of this Case structure;  Sequence, used for the sequential execution of the operations of choosing the measurement point, reading the temperature values, processing them, transmitting them to the user and displaying them.In the case of the Manual selection mode, the control of the CASE structure for the selection of sensors is performed by the user by choosing the measurement point, but in the case of the Automatic mode, the address generation is performed cyclically by means of a repetitive For structure.In the case of this application, since only three sensors were used, the counter variable of the For structure will have only three values.From the front panel, through the TIMING control, the timing of each of the 3 loops of this repetitive structure is chosen by the user.The chosen value is entered via the Wait function.
For each individual sensor, three sequences are provided in the execution of the program, namely: sensor selection, acquisition, signal processing and information transmission, respectively value display.If the temperature value exceeds the alarm threshold value set for each measurement point, an alarm message will be generated and an appropriate command will be sent that was chosen in the programming stage.
Exceeding the alarm threshold is signalled by means of an LED for each measurement point, which simulates the actuation of an execution element simultaneously with the display of a message.This message is selected using a property type node in the sequence in which the alarm threshold has been exceeded.
The actual acquisition and processing of the signals from the sensors is carried out by the I2C DAQ subroutine whose structure is shown in Fig. 6.The functions performed by this subroutine are: 1. recording the configuration register for sensors in the measurement structure; 2. setting the alarm point by writing selected values in the Tset register; 3. setting the address of the internal register from which the temperature value will be read; 4. transmission of read data.The setting of the sensor parameters is carried out through the CONFIGURARE REGISTRII register in which an eight-bit code is loaded and which is carried out at the same time as the program is launched.

Fig. 5 .
Fig. 5. Block diagram of the virtual instrument