Friday, August 21, 2020

Read and Plot data from text files in LabVIEW

 Read and Plot data from text files in LabVIEW

Sometimes we may have data available in .txt file format and we need to read them. Shown below is a sample table of data for heart rates recorded from an ECG machine. The sample size is 950. We can plot the data on a graph using available features in LabVIEW by following the steps below:

 

1.      Save the text file in .lvm format.

2.      We will use “Read from Measurement File” express vi available under File IO function palette. Put the express vi on the block diagram.

3.      A new window will open.

4.      Select the text file containing data to be displayed. Also check the “Read generic text files” option under “File Format” header.

5.      Put the “Waveform graph” palette on the front panel.

6.      Wire the out of express vi to waveform graph.

7.      Run the vi. We will see data plot.

 This way we can read data saved in text file format. In the next tutorial we will se how to save the text file in TDMS format.



Saturday, May 16, 2020

Load Cell Basics and interfacing load cell with arduino using HX711 amplifier

A load cell is a transducer which converts force into an electrical output. They are commonly used in everyday life- measuring balance in regular grocery shop.  The working of a load cell differs based on its type- hydraulic load cell, pneumatic load cell, and strain gauge load cells.

The strain gauge type load cell most popular. It is comprised of one or more strain gauges bonded to the surface of a metal structure with known elastic properties. The commonly used metal is Aluminum or SS. This metal structure will stretch and compress with applied force. Strain gauges are electrical conductor firmly attached to a film in definite pattern. The strain gauges bonded to this structure measure the strain, translating applied force into electrical resistance changes. These strain gauges are arranged in what is called a bridge circuit, or more precisely a Wheatstone bridge circuit as shown in diagram below. The force on the load cell is measured by voltage change in the strain gauge due to deformation. Strain gauge load cells offer accuracies from within 0.03% to 0.25% of full scale.




Modern load cells have 4 strain gauges installed within so as to increase accuracy. The arrangement is as shown in Figure above. Two gauges (R1 and R4) are under tension and two (R2 and R3) are in compression. When the cylindrical shaft is subjected to a force, it tends to change in dimension. Due to this resistance of strain gauges change.


When there is no load on the load cell, the resistances of each strain gauge will be the same. Under the application of force, the resistance of the strain gauge varies, causing a change in output voltage. The change in output voltage is measured and converted into readable value.


Types of load cells


There are different types of load cells for different applications. Commonly used ones include:


  • Single point load cells: a load cell is located under a platform that is loaded with a weight from above.
  • Bending beam load cells: several load cells are positioned under a steel structure and are loaded with a weight from above.
  • Compressive force load cells: several high-capacity load cells are positioned under a steel structure that is loaded with a weight from above.
  • Tensile load cells: a weight is suspended from one or more load cells.


Installation


The performance of a load cell depends on many factors. Central among these is proper installation and alignment. As such, it is important to follow the manufacturer’s recommendations carefully in order to get the best results from your device and to ensure safe and long-lasting use. These recommendations often include information on proper mounting and alignment of your load cell, appropriate fixing and fastener choice, the use of accessory mounting hardware, electronic adjuncts and calibration procedures


Four strain gauges are positioned on the load cells below at the point where the greatest deformation occurs when force is applied. The arrow is pointing the direction of force application.


Environmental effects on load cells


One special feature of load cells is that the environment in which they are used plays a decisive role – in a number of ways.


Ambient temperature


Every material changes with temperature, expanding in response to heat and contracting in response to cold. And the same applies to load cells and their strain gauges. This also changes the electrical resistance of the conductor. Yet load cells must measure the correct weight everywhere, regardless of the ambient temperature. To achieve this, a temperature compensation mechanism has to be built in load cell.


Load cell interfacing with Arduino

With the availability of low cost development board like Arduino, it has become easier to understand load cell even at home. For interfacing a load cell with we will use an amplifier board HX711 which provides 24-bit data equivalent to load. This board is specially designed for amplifying the signals from load cells and transferring the data to Arduino. The load cells plug into this board, and this board tells the Arduino what the load cells measure.

We will use a 20kg load cell for demonstration purpose. The load cells are available with 4-wires as well as 6-wires configuration. Figure below shows 4-wire load cell which we will use to interface with HX-711 amplifier.



The wiring between load cell and HX711 amplifier module is tabulated below.

Load cell wire

HX-711

Red

E+

Black

E-

White

A-

Green

A+


The connections between Arduino and HX711 module is tabulated below.

Arduino

HX-711

5 V

Vcc

2

SCK

3

DT

GND

GND




It is required to download HX711 library from Arduino IDE library manager.

Arduino code is

#include "HX711.h"

 

// HX711 circuit wiring

const int LOADCELL_DOUT_PIN = 2;

const int LOADCELL_SCK_PIN = 3;

 

HX711 scale;

 

void setup() {

  Serial.begin(57600);

  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

}

 

void loop() {

 

  if (scale.is_ready()) {

    long reading = scale.read();

    Serial.print("HX711 reading: ");

    Serial.println(reading);

  } else {

    Serial.println("HX711 not found.");

  }

 

  delay(1000);

 

}


Friday, May 1, 2020

Signal Isolation Techniques- analog and digital signal isolation


There are many applications where it is required for one system to have no direct electrical connection with the other system. Such isolation is called Galvanic isolation. This is necessary to avoid the possibility of dangerous voltages or currents from one half of the system causing damage to the other, or to break ground loop. Such a system is said to be "isolated", and the arrangement that passes a signal without galvanic connections is known as an isolation barrier.

The protection of an isolation barrier works in both directions. The common applications where a sensor may accidentally encounter high voltages and the system it is driving must be protected.

An isolation amplifier provides dc isolation between input and output. It is used for the protection of human life or sensitive equipment in those applications where high-voltage transients or power leakage are possible. An isolation amplifier consists of two electrically isolated stages. The input stage and the output stage are separated from each other by an isolation barrier so that a signal must be processed in order to be coupled across the isolation barrier.


Complete isolation of two electrical system include- signal isolation, power isolation.

Application

·         To protect human operators,

·         To protect low-voltage circuitry from high voltages,

·         To improve noise immunity,

·         To reject common mode voltage,

·         To eliminate ground loop,

·         To handle ground potential differences between communicating subsystems.

Types of signal isolation

1.      Optical Isolation

2.      Transformer/ magnetic/ inductive isolation

3.      Capacitive isolation

Some isolation amplifiers use optical coupling or transformer coupling to provide isolation between the stages. However, many modern isolation amplifiers use capacitive coupling for isolation. Each stage has separate supply voltages and grounds so that there are no common electrical paths between them.

The most common isolation amplifiers use transformers, which exploit magnetic fields, and another common type uses small high voltage capacitors, exploiting electric fields.

Optical isolation

Optoisolators, which consist of an LED and a photodiode/ phototransistor, provide isolation by using light. Optical isolators are fast and cheap, and can be made with very high voltage ratings (4 -7 kV is one of the more common ratings), but they have poor analog linearity, and are not usually suitable for direct coupling of precision analog signals.

Analog optocoupler
The analog optocouplers can be used to isolate analog signals in a wide variety of applications that require good stability, linearity, bandwidth and low cost. HCNR200/201 is popular analog optocoupler. Their circuit schematic is as shown below.
The figure below shows  the working circuit of analog voltage isolator using HCNR200.



The ratio of R3/R1 can be selected to provide amplification to the input signal. The ground for input stage (left side) must be separated from ground for output stage (right side). Separate set of power supplies or isolated DC-to-DC converters can be used for this purpose.
Digital optocoupler
The classic digital isolator is the LED/transistor opto-isolator. It can provide isolation upto 10kV or more. Higher speed couplers incorporate an active receiver circuit with a logic-level output.
Transformer isolation
Electromagnetic isolators such as small signal transformers are useful for AC signal isolation. Transformers like audio transformer have their primary and secondary sides isolated which can be used for different audio signal isolation. Another most common use is in network hardware or Ethernet section. Pulse transformers are used to isolate the external wiring with internal hardware. Even telephone lines are used transformer based signal isolators. But, as transformers are isolated by electromagnetically, it only works with AC.
Transformers are capable of analog accuracy of 12-16 bits and bandwidths up to several hundred kHz, but their maximum voltage rating rarely exceeds 10 kV, and is often much lower.
Capacitive isolation
The least popular method for isolating circuits is by using capacitors. Due to poor efficiency and dangerous failure outcomes this is no longer preferred. Capacitors block DC and allow passing a high-frequency AC signal. Due to this property, the capacitor is used as isolators in designs where DC currents of two circuits need to be blocked but still allowing high frequency data transmission.
Capacitive-coupled isolation amplifiers have lower accuracy, perhaps 12-bits maximum, lower bandwidth, and lower voltage ratings—but they are low cost.

Characteristics
·         Linearity- It is desirable that the relation between input and output signal is linear. Modern isolation techniques make it possible to achieve linearity as low as 0.01%.
·         Isolation voltage- It is the maximum voltage on side that can be withstand by the isolation barrier between two stages. Beyond isolation voltage, the barrier breaks down.
·         Bandwidth- It is the frequency range of input signal that can be coupled at the output without significant attenuation.
·         Transfer gain- Ratio of output signal to input signal.


Relation between dBm and dBV with 50 Ohm Impedance

Relationship Between dBm and dBV with 50 Ohm Impedance Relationship Between dBm and dBV with 50 Ohm Impedance ...