Sunday, April 26, 2020

LM35 temperature sensor signal processing and LabVIEW interfacing


Semiconductor temperature sensors offer high accuracy and high linearity over an operating range of about –55°C to +150°C. The output is scaled to give sensitivity of 10mV/°C. They are also useful in cold-junction compensation circuits for wide temperature range thermocouples.

All semiconductor temperature sensors make use of the relationship between a bipolar junction transistor's (BJT) base-emitter voltage to its collector current:
where k is Boltzmann's constant, T is the absolute temperature, q is the charge of an electron, and Is is a current related to the geometry and the temperature of the transistors.

The LM35/36/37 are voltage output temperature sensors with a 10mV/°C (LM35/36) or 20mV/°C (LM37) scale factor. Supply current is below 50µA, providing very low self-heating (less than 0.1°C in still air). The LM35 provides a 250mV output at +25°C and reads temperature from +10°C to +125°C. LM35 have an output scale factor of +10mV/°C.
LT1167 Single Resistor Gain Programmable, Precision Instrumentation Amplifier
As the output from LM35 is very low (typically 300 mV at 30°C), it is susceptible to distortion due to noise. The signal is amplified using an amplifier to a suitable level so as to utilize the full input range of ADC of Arduino. It improves the measurement sensitivity.
We are using LT1167 precision In-amp from Linear Technologies (now Analog Devices).
Supply voltage: ±15 VDC


Setup and connection

REF pin (5) is to be connected to Ground.
We have selected Rg=8.2kΩ. So the gain is 7.02.
The amplified output is fed to analog input channel of an Arduino UNO board. The data is read on LabVIEW using Makerhub example program for Single Channel AI read. I tweaked the program to display temperature in degree C.

Saturday, April 25, 2020

Working with PIR sensor on Arduino


PIR Sensor

PIR Sensor stands for Pyroelectric (passive) InfraRed sensor, which allows us to detect human or object movement within a certain range. They are small, low-cost, low-power, easy to use and long lasting. PIR sensors are adopted in myriads of projects as they are easy to use with popular hardwares such as Arduino and raspberry pi. PIR sensors are commonly used in security alarms and automatic lighting applications.
Working of PIR sensor
PIRs are basically made of a pyroelectric sensor, which can detect levels of infrared radiation and convert IR energy to electrical signal. All bodies with temperature above absolute zero (0 K) emit infra-red radiation. The higher the temperature, the more radiation is emitted. The sensor in a motion detector is actually split in two halves. When a body moves, the sensor detects change in IR levels. The two halves are connected in a way so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.
If the human infrared radiation is directly irradiated on the detector, it will output a signal. The signal strength depends on distance from body.  Farther the distance, lesser is the irradiation on sensor and lesser is the sensitivity. In order to lengthen the detection distance of the detector, an optical system is added to focus the infrared radiation, usually using a plastic optical reflection system or a Fresnel lens made of plastic as a focusing system for infrared radiation.
In the detection area, the infrared radiation energy of the human body through the clothing is received by the lens of the detector and focused on the pyroelectric sensor. The detector can sense the human body within a field of view . The pyroelectric sensor sees the moving human body till it is within field of view and then does not see it beyond that. The infrared radiation constantly changes the temperature of the pyroelectric material so that it outputs a corresponding signal, which is the alarm signal.
Most PIR sensors have a 3-pin connection at the side or bottom. One pin will be ground, another will be signal and the last pin will be power. Power is usually up to 5V. Interfacing PIR with Arduino is very easy and simple. The PIR acts as a digital output so all you need to do read the output state as HIGH or LOW. The motion can be detected by checking for a high signal on a single I/O pin. Once the sensor warms up the output will remain low until there is motion, at which time the output will swing high for a couple of seconds, then return low. If motion continues the output will cycle in this manner until the sensors line of sight of still again. The PIR sensor needs a warm-up time with a specific end goal to capacity fittingly. The settling is adjustable from 10-60 seconds.


The Range of PIR Sensor

Indoor passive infrared: 25 cm to 20 m.

Indoor curtain type: 25 cm to 20 m.

Outdoor passive infrared: 10 meters to 150 meters.

Outdoor passive infrared curtain detector: 10 meters to 150 meters



Interfacing with Arduino

There are three pins in the PIR sensor- Vcc, OUTPUT, GND. We connect Vcc pin to +5V terminal of Arduino, GND to Ground pin and OUTPUT to any digital input pin of arduino.


Arduino code


/*

  DigitalReadSerial



  Reads a digital input on pin 8, prints the result to the Serial Monitor



// digital pin 12 has a LED attached to it.

int PIR_OUT = 8;

int LED = 12;



// the setup routine runs once when you press reset:

void setup() {

  // initialize serial communication at 9600 bits per second:

  Serial.begin(9600);

  // make the pushbutton's pin an input:

  pinMode(PIR_OUT, INPUT);

  pinMode(LED, INPUT);

}



// the loop routine runs over and over again forever:

void loop() {

  // read the input pin:

  int State = digitalRead(PIR_OUT);

  // print out the state of the button:

  Serial.println(State);

  digitalWrite(LED, State);

  delay(200);        // delay in between reads for stability

}




Tuesday, April 21, 2020

Analog voltage multiplier and voltage divider circuit


Analog Voltage Multiplier


The output Vo1 of first log amplifier is given as:
The output Vo2 of second log amplifier is given as:
The output stage is an adder circuit. Its output is given as:
where
We can see that the output Vo is related to product of two inputs. This circuit acts as “ANALOG VOLTAGE MULTIPLIER”. Such circuits find their applications in Power monitoring.



Log and Antilog Amplifier


Log and antilog amplifiers are used in applications that require compression of analog input data, linearization of transducers that have exponential outputs, and analog multiplication and division. A logarithmic (log) amplifier produces an output that is proportional to the logarithm of the input, and an antilogarithmic (antilog) amplifier takes the antilog or inverse log of the input.

Logarithmic Amplifier

When you place a diode in the feedback loop of an opamp circuit, as shown in Figure below, it acts as a log amplifier. The output is limited to a maximum value of approximately -0.7V because the diode’s logarithmic characteristic is restricted to voltages below 0.7 V.
Since the forward current trough a diode is given by,
As ID = IF,
The term kT/q is a constant equal to approximately 25 mV at 25°C. Therefore, the output voltage can be expressed as
From last equation, you can see that the output voltage is the negative of a logarithmic function of the input voltage. The value of the output is controlled by the value of the input voltage and the value of the resistor R. The other factor, Io is a constant for a given diode.
Anti-Logarithmic Amplifier
An antilog amplifier is formed by connecting a diode at the input side. The output voltage is determined by the current through the feedback resistor.
As ID = IF and Vin = VD





Sunday, April 19, 2020

Control Valve Characteristics


The valve’s flow characteristic is the relationship of the change in the valve’s opening to the change in flow through the valve. In general, the flow through a control valve for a specific fluid at a given temperature can be expressed as

where  Q= volumetric flow rate
            X= valve stem position
            P0= upstream pressure
            P1= downstream pressure


Lets us express the following quantities:
where  Q = flow rate
Qmax = maximum flow rate
X = stem position
Xmax = maximum stem position
The types of valve characteristics can be defined in terms of the sensitivity of the valve, which is the fractional change in flow to the fractional change in stem position for fixed upstream and downstream pressures. Mathematically control valve sensitivity may be expressed as:
Depending on value of can be decreasing, linear or increasing the valve characteristics can be quick opening, linear, and equal percentage respectively.
The quick-opening valve is predominantly used for on/off control applications. A relatively small movement of the valve stem causes the maximum possible flow rate through the valve. For example, a quick-opening valve may allow 85 percent of the maximum flow rate with only 25 percent stem travel.

The linear valve has a flow rate that varies linearly with the position of the stem. This relationship can be expressed as follows:
where ‘α’ is constant.
The equal percentage valve is manufactured so that a given percentage changes in the stem position produces the same percentage change in flow. Generally, this type of valve does not shut off the flow completely in its limit of travel. For an equal-percentage valve, the defining equation is
Here ‘β’ is constant.

Here q0 is the flow at x=0.

At x = 1, q=1,
Qmin represents the minimum flow when the stem is at one limit of its travel. At the fully open position, the control valve allows a maximum flow rate, Qmin. So we define a term called Rangeability (R) as the ratio of maximum flow (Qmax) to minimum flow (Qmin):
The curve in Figure 4 shows a typical equal percentage curve that depends on the rangeability for its exact form. The curve shows that increase in flow rate for a given change in valve opening depends on the extent to which the valve is already open. This curve is typically exponential in form and is represented by:




Thursday, April 9, 2020

Pressure measurement - Boudan Tube Gauge


Bourdon tube is a type of flexible mechanical pressure measuring device. The pressure changes the shape of the measuring element in proportion to the applied pressure. A metallic flexible pressure measuring element can only be deformed within a limited range due to the considerable material stresses involved. Pressure gages using this principle measure pressures above atmospheric to several thousand psi. They are available in C-shape, Helical and spiral shapes.

C-Bourdon Pressure Gauge

The C-type Bourdon tube is made by folding a tube to form segment of a circle, usually an arc of 250°. The process medium whose pressure is to be measured is connected to the fixed end of the tube, while the other end is sealed. Because of pressure difference between inner tube wall and outer tube wall, the Bourdon tube tends to straighten. The sealed tip end moves in non-linear trajectory. By means of mechanical sector and pinion arrangement, this non-linear motion of tip is amplified and converted to linear motion of pointer.





Commonly used material for making Bourdon Tube
  1. Phosphor Bronze
  2.  Beryllium copper
  3. SS 316M
  4. Monel
  5. Inconel

Direct measuring C-Bourdon tubes can measure in the span from 0-15 PSI to 0-20000 PSI. Not suitable for very low pressure. The accuracy is ± 1% of full scale.


Spiral Bourdon Pressure Gauge

The free end motion of C-Bourdon tube is insufficient in some cases. A spiral type formation can be used in such cases. When pressure is applied, this flat spiral tends to uncoil and generates greater movement of free end requiring no mechanical amplification. This improves the accuracy and sensitivity of the instrument.


Helical Bourdon Pressure Gauge

This geometry provides highest sensitivity among all Bourdon gauges. There is no need for mechanical amplification. It is also suitable to use in continuously varying pressure system. They are available in Bronze, Beryllium copper, and stainless-steel.



It should be noted that bourdon tubes may be used to measure differential and/or absolute pressure in addition to gauge pressure. All that is needed for these other functionalities is to subject the other side of each pressure-sensing element to either another applied pressure (in the case of differential measurement) or to a vacuum chamber (in the case of absolute pressure measurement).

Wednesday, April 8, 2020

Three Way Valve Manifold


Valve manifold is used in calibration of pressure or flow instruments. It is commonly used in conjunction with DP transmitter. As the process fluids may be toxic or corrosive, it is necessary to prevent its leakage during calibration. A three-way valve manifold is as shown below.

Figure 1: Three-way Valve manifold

This device incorporates manual valves to isolate and equalize pressure from the process to the transmitter, for maintenance and calibration purposes. A fourth valve called a “bleed” valve used to vent trapped fluid pressure to atmosphere.
Figure 2: Normal operation mode





Figure 3: Maintenance mode

In normal operation, the two block valves are left open to allow process fluid pressure to reach the instrument. The equalizing valve is left tightly shut so no fluid can pass between the “high” and “low” pressure sides. To isolate the transmitter from the process for maintenance, the block valves must be closed and the equalizing valve must be open. The recommended sequence to follow is to first close the high-pressure block valve, then open the equalizing valve, then close the low-pressure block valve. This sequence ensures the transmitter cannot be exposed to a high differential pressure during the isolation procedure, and that the trapped fluid pressure inside the transmitter will be as low as possible prior to “venting” to atmosphere. Finally, the “bleed” valve is opened at the very last step to relieve pent-up fluid pressure within the manifold and transmitter chambers

Modbus and OPC comparison Table

  Modbus vs OPC Comparison between Modbus and OPC Feature Modbus OPC (OLE f...