Saturday, April 18, 2009

Introduction To FPGA

What are FPGAs?

Field programmable gate arrays (FPGAs) are digital integrated circuits (ICs) that contain configurable (programmable) blocks of logic along with configurable interconnects between these
blocks. Design engineers can configure (program) such devices to perform a tremendous variety of tasks.

Depending on the way in which they are implemented, some FPGAs may only be programmed a single time, while others may be reprogrammed over and over again. Not surprisingly, a device that can be programmed only one time is referred to as one-time programmable (OTP).

The “field programmable” portion of the FPGA’s namerefers to the fact that its programming takes place “in the field” (as opposed to devices whose internal functionality is hardwired
by the manufacturer). This may mean that FPGAs are configured in the laboratory, or it may refer to modifying the function of a device resident in an electronic system that has
already been deployed in the outside world. If a device is capable of being programmed while remaining resident in a higher-level system, it is referred to as being in-system programmable
(ISP).

Why are FPGAs of interest?

There are many different types of digital ICs, including “jelly-bean logic” (small components containing a few simple, fixed logical functions), memory devices, and microprocessors
(μPs). Of particular interest to us here, however, are programmable logic devices (PLDs), application-specific integrated circuits (ASICs), application-specific standard parts (ASSPs), and—of course—FPGAs.

For the purposes of this portion of our discussion, we shall consider the term PLD to encompass both simple programmable logic devices (SPLDs) and complex programmable logic devices (CPLDs).

Various aspects of PLDs, ASICs, and ASSPs will be introduced in more detail in chapters 2 and 3. For the nonce, we need only be aware that PLDs are devices whose internal architecture is predetermined by the manufacturer, but which are created in such a way that they can be configured (programmed) by engineers in the field to perform a variety of different functions. In comparison to an FPGA, however, these devices contain a relatively limited number of logic gates, and the functions they can be used to implement are much smaller and simpler.

At the other end of the spectrum are ASICs and ASSPs, which can contain hundreds of millions of logic gates and can be used to create incredibly large and complex functions. ASICs and ASSPs are based on the same design processes and manufacturing technologies. Both are custom-designed to address a specific application, the only difference being that an ASIC is designed and built to order for use by a specific company, while an ASSP is marketed to multiple customers. (When we use the term ASIC henceforth, it may be assumed that we are also referring to ASSPs unless otherwise noted or where such interpretation is inconsistent with the context.)

Although ASICs offer the ultimate in size (number of transistors), complexity, and performance; designing and building one is an extremely time-consuming and expensive process, with the added disadvantage that the final design is “frozen in silicon” and cannot be modified without creating a new version of the device.

Thus, FPGAs occupy a middle ground between PLDs and ASICs because their functionality can be customized in the field like PLDs, but they can contain millions of logic gates1 and be used to implement extremely large and complex functions that previously could be realized only using ASICs.

The cost of an FPGA design is much lower than that of an ASIC (although the ensuing ASIC components are much cheaper in large production runs). At the same time, implementing
design changes is much easier in FPGAs, and the time-to-market for such designs is much faster. Thus, FPGAs make a lot of small, innovative design companies viable because—in addition to their use by large system design houses—FPGAs facilitate “Fred-in-the-shed”–type operations.
This means they allow individual engineers or small groups of engineers to realize their hardware and software concepts on an FPGA-based test platform without having to incur the
enormous nonrecurring engineering (NRE) costs or purchase the expensive toolsets associated with ASIC designs. Hence, there were estimated to be only 1,500 to 4,000 ASIC design starts
and 5,000 ASSP design starts in 2003 (these numbers are falling dramatically year by year), as opposed to an educated “guesstimate” of around 450,000 FPGA design starts in the
same year.

What can FPGAs be used for?

When they first arrived on the scene in the mid-1980s, FPGAs were largely used to implement glue logic, medium complexity state machines, and relatively limited data processing tasks. During the early 1990s, as the size and sophistication of FPGAs started to increase, their big markets at that time were in the telecommunications and networking arenas, both of which involved processing large blocks of data and pushing that data around. Later, toward the end of the 1990s, the use of FPGAs in consumer, automotive, and industrial applications underwent a humongous growth spurt.

FPGAs are often used to prototype ASIC designs or to provide a hardware platform on which to verify the physical implementation of new algorithms. However, their low development cost and short time-to-market mean that they are increasingly finding their way into final products (some of the major FPGA vendors actually have devices that they specifically market as competing directly against ASICs).

By the early-2000s, high-performance FPGAs containing millions of gates had become available. Some of these devices feature embedded microprocessor cores, high-speed input/output
(I/O) interfaces, and the like. The end result is that today’s FPGAs can be used to implement just about anything, including communications devices and software-defined radios; radar, image, and other digital signal processing (DSP) applications; all the way up to system-on-chip (SoC)components that contain both hardware and software elements.



To be just a tad more specific, FPGAs are currently eating into four major market segments: ASIC and custom silicon, DSP, embedded microcontroller applications, and physical
layer communication chips. Furthermore, FPGAs have created a new market in their own right: reconfigurable computing (RC).

ASIC and custom silicon: As was discussed in the previous section, today’s FPGAs are increasingly being used to implement a variety of designs that could previously have been realized using only ASICs and custom silicon.

Digital signal processing: High-speed DSP has traditionally been implemented using specially tailored microprocessors called digital signal processors (DSPs). However, today’s FPGAs can contain embedded multipliers, dedicated arithmetic routing, and large amounts of on-chip RAM, all of which facilitate DSP operations. When these features are coupled with the massive parallelism provided by FPGAs, the result is to outperform the fastest DSP chips by a factor of 500 or more.

Embedded microcontrollers: Small control functions have traditionally been handled by special-purpose embedded processors called microcontrollers. These lowcost devices contain on-chip program and instruction memories, timers, and I/O peripherals wrapped around a processor core. FPGA prices are falling, however, and even the smallest devices now have more than enough capability to implement a soft processor core combined with a selection of custom I/O functions. The end result is that FPGAs are becoming increasingly attractive for embedded control applications.

Physical layer communications: FPGAs have long been used to implement the glue logic that interfaces between physical layer communication chips and highlevel networking protocol layers. The fact that today’s high-end FPGAs can contain multiple high-speed transceivers means that communications and networking functions can be consolidated into a single device.

Reconfigurable computing: This refers to exploiting the inherent parallelism and reconfigurability provided by FPGAs to “hardware accelerate” software algorithms. Various companies are currently building huge FPGA-based reconfigurable computing engines for tasks ranging from hardware simulation to cryptography analysis to discovering new drugs.


Friday, January 23, 2009

Application Digital Audio Equalizer

For an audio application such as the CD player, the digital audio equalizer is used to make the sound as one desires by changing filter gains for different audio frequency bands. Other applications include adjusting the sound source to take room acoustics into account, removing undesired noise, and boosting the desired signal in the specified passband. The simulation is based on the consumer digital audio processor—such as a CD player—handling the 16-bit digital samples with a sampling rate of 44.1 kHz and an audio signal bandwidth at 22.05 kHz. A block diagram of the digital audio equalizer is depicted in Figure 1



A seven-band audio equalizer is adopted for discussion. The center frequencies are listed in Table 1. The 3 dB bandwidth for each bandpass filter ischosen to be 50% of the center frequency. As shown in Figure 1, g0 through g6 are the digital gains for each bandpass filter output and can be adjusted to make sound effects, while y0(n) through y6(n) are the digital amplified bandpass filter outputs. Finally, the equalized signal is the sum of the amplified band pass filter outputs and itself. By changing the digital gains of the equalizer, many sound effects can be produced.



To complete the design and simulation, second-order IIR bandpass Butter-worth filters are chosen for the audio equalizer. The coefficients are achievedusing the BLT method, and are given in table 2.



The magnitude response for each filter bank is plotted in Figure 2 for design verification.



As shown in the figure, after careful examination, the magnitude response of each filter band meets the design specification. We willperform simulation next.Simulation in the MATLAB environment is based on the following setting.The audio test signal having frequency components of 100 Hz, 200 Hz, 400 Hz, 1.000Hz, 2.500Hz, 6.000Hz, and 15.000Hz is generated from Equation :


After simulation, we notice that the frequency components at 100 Hz, 200 Hz, 6.000 Hz, and 15.000 Hz will be boosted by 20log10 10 ¼ 20dB. The top plot in Figure 3 shows the spectrum for the audio test signal, while the bottom plot depicts the spectrum for the equalized audio test signal. As shown in the plots, before audio digital equalization, the spectral peaks at all bands are at the same level ; after audio digital equalization, the frequency components at bank 0, bank 1, bank 5, and bank 6 are amplified. Therefore, as we expected, the operation of the digital equalizer boosts the low frequency components andthe high frequency components. The MATLAB list for the simulation is shown in program bellow



%MATLAB Program for simulating the digital equalizer

close all; clear all
% these filter coefficients (Butterworth type, designed using BLT)
B0=[0.0031954934 0 -0.0031954934]; A0=[1.0000000000 -1.9934066716 0.9936090132];
B1=[0.0063708102 0 -0.0063708102]; A1=[1.0000000000 -1.9864516324 0.9872583796];
B2=[0.0126623878 0 -0.0126623878]; A2=[1.0000000000 -1.9714693192 0.9746752244];
B3=[0.0310900413 0 -0.0310900413]; A3=[ 1.0000000000 -1.9181849043 0.9378199174];
B4=[ 0.0746111954 0.000000000 -0.0746111954];
A4=[1.0000000000 -1.7346085867 0.8507776092];
B5=[0.1663862883 0.0000000000 -0.1663862884];
A5=[1.0000000000 -1.0942477187 0.6672274233];
B6=[0.3354404899 0.0000000000 -0.3354404899];
A6=[1.0000000000 0.7131366534 0.3291190202];

[h0,f]=freqz(B0,A0,2048,44100);
[h1,f]=freqz(B1,A1,2048,44100);
[h2,f]=freqz(B2,A2,2048,44100);
[h3,f]=freqz(B3,A3,2048,44100);
[h4,f]=freqz(B4,A4,2048,44100);
[h5,f]=freqz(B5,A5,2048,44100);
[h6,f]=freqz(B6,A6,2048,44100);
loglog(f,abs(h0),f,abs(h1), f,abs(h2), ...
f,abs(h3),f,abs(h4),f,abs(h5),f,abs(h6));
xlabel('Frequency (Hz)');
ylabel('Filter Gain');grid
axis([10 10^5 10^(-6) 1]);
figure(2)
g0=10;g1=10;g2=0;g3=0;g4=0;g5=10;g6=10;
p0=0;p1=pi/14;p2=2*p1;p3=3*p1;p4=4*p1;p5=5*p1;p6=6*p1;
n=0:1:20480; % indices of samples
fs=44100; % sampling rate
x=sin(2*pi*100*n/fs)+sin(2*pi*200*n/fs+p1)+...
sin(2*pi*400*n/fs+p2)+sin(2*pi*1000*n/fs+p3)+...
sin(2*pi*2500*n/fs+p4)+sin(2*pi*6000*n/fs+p5)+...
sin(2*pi*15000*n/fs+p6); % generate test audio signals
y0=filter(B0,A0,x); % band pass filter 0
y1=filter(B1,A1,x); % bandpass filter 1
y2=filter(B2,A2,x); % bandpass filter 2
y3=filter(B3,A3,x); % bandpass filter 3
y4=filter(B4,A4,x); % bandpass filter 4
y5=filter(B5,A5,x); % bandpass filter 5
y6=filter(B6,A6,x); % bandpass filter 6
y=g0.*y0+g1.*y1+g2.*y2+g3.*y3+g4.*y4+g5.*y5+g6.*y6+x; % equalizer output
N=length(x);
Axk=2*abs(fft(x))/N;Axk(1)=Axk(1)/2; % one side amplitude spectrum of the input
f=[0:N/2]*fs/N;
subplot(2,1,1);loglog(f,Axk(1:N/2+1));
title('Audio spectrum');
axis([10 100000 0.00001 100]);grid;
Ayk=2*abs(fft(y))/N; Ayk(1)=Ayk(1)/2; % one side amplitude spectrum of the output
subplot(2,1,2);loglog(f,Ayk(1:N/2+1));
xlabel('Frequency (Hz)');
title('Equalized audio spectrum');
axis([10 100000 0.00001 100]);grid;

Wednesday, January 14, 2009

Biosensors

What Is a Biosensor?
Biosensor = bioreceptor + transducer. A biosensor consists of two components: a bioreceptor and a transducer. The bioreceptor is a biomolecule that recognizes the target analyte, and the transducer converts the recognition event into a measurable signal. The uniqueness of a biosensor is that the two components are integrated into one single sensor.



This combination enables one to measure the target analyte without using reagents. For example, the glucose concentration in a blood sample can be measured directly by a biosensor made specifically for glucose measurement, by simply dipping the sensor in the sample. This is in contrast to the commonly performed assays, in which many sample preparation steps are necessary and each step may require a reagent to treat the sample. The simplicity and the speed of measurements that require no specialized laboratory skills are the main advantages of a biosensor.
Enzyme is a Bioreceptor. When we eat food such as hamburgers and french fries, it is broken down into small molecules in our body via many reaction steps (these breakdown reactions are called catabolism). These small molecules are then used to make the building blocks of our body, such as proteins (these synthesis reactions are called anabolism). Each of these catabolism and anabolism reactions (the combination is called metabolism) are catalyzed by a specific enzyme. Therefore, an enzyme is capable of recognizing a specific target molecule




This biorecognition
is to be noted that only minute quantities of bioreceptor molecules are needed, andcapability of the enzyme is used in biosensors. Other biorecognizing molecules (= bioreceptors) include antibodies, nucleic acids, and receptors. Immobilization of Bioreceptor. One major requirement for a biosensor is that the bioreceptor be immobilized in the vicinity of the transducer. The immobilization is done either by physical entrapment or chemical attachment. Chemical attachment often involves covalent bonding to transducer surface by suitable reagents. It is to be noted that only minute quantities of bioreceptor molecules are needed, and they are used repeatedly for measurements.
Typically, this is done by measuring the change that occurs in the bioreceptor reaction. For example, the enzyme glucose oxidase is used as a bioreceptor in a glucose biosensor that catalyzes the following reaction:




To measure the glucose in aqueous solutions, three different transducers can be used:
1. An oxygen sensor that measures oxygen concentration, a result of glucose reaction




2. A pH sensor that measures the acid (gluconic acid), a reaction product of glucose


3. A peroxidase sensor that measures H2O2 concentration, a result of glucose reaction



Note that an oxygen sensor is a transducer that converts oxygen concentration into electrical current. A pH sensor is a transducer that converts pH change into voltage change. Similarly, a peroxidase sensor is a transducer that converts peroxidase concentration into an electrical current.

Biosensor Characteristics. Biosensors are characterized by eight parameters. These are: (1) Sensitivity is the response of the sensor to per unit change in analyte concentration. (2) Selectivity is the ability of the sensor to respond only to the target analyte. That is, lack of response to other interfering chemicals is the desired feature. (3) Range is the concentration range over which the sensitivity of the sensor is good. Sometimes this is called dynamic range or linearity. (4) Response time is the time required for the sensor to indicate 63% of its final response due to a step change in analyte concentration. (5) Reproducibility is the accuracy with which the sensor’s output can be obtained. (6) Detection limit is the lowest concentration of the analyte to which there is a measurable response. (7) Life time is the time period over which the
sensor can be used without significant deterioration in performance characteristics. (8) Stability characterizes the change in its baseline or sensitivity over a fixed period of time.

Considerations in Biosensor Development. Once a target analyte has been identified,
the major tasks in developing a biosensor involve:
  1. Selection of a suitable bioreceptor or a recognition molecule
  2. Selection of a suitable immobilization method
  3. Selection and design of a transducer that translates binding reaction into measurable signal
  4. Design of biosensor considering measurement range, linearity, and minimization of interference, and enhancement of sensitivity
  5. Packaging of the biosensor into a complete device
The first item above requires knowledge in biochemistry and biology, the second and third require knowledge in chemistry, electrochemistry and physics, and the fourth requires knowledge of kinetics and mass transfer. Once a biosensor has been designed, it must be packaged for convenient manufacturing and use. The current trend is miniaturization and mass production. Modern IC (integrated circuit) fabrication technology and micromachining technology are used increasingly in fabricating biosensors, as they reduce manufacturing costs. Therefore, an interdisciplinary research team, consisting of the various disciplines identified above, is essential for successful development of a biosensor.

Applications of Biosensors
Health Care
Measurement of Metabolites. The initial impetus for advancing sensor technology came from the health care area, where it is now generally recognized that measurements of blood chemistry are essential and allow a better estimation of the metabolic state of a patient. In intensive care units, for example, patients frequently show rapid variations in biochemical composition and levels that require urgent remedial action. Also, in less severe patient handling, more successful treatment can be achieved by obtaining instant assays. At present, available instant analyses are not extensive. In practice, these assays are performed by analytical laboratories, where discrete
samples are collected and shipped for analysis, frequently using the more traditional analytical techniques.

Market Potential. There is an increasing demand for inexpensive and reliable sensors for use in doctor’s offices, emergency rooms, and operating rooms. Ultimately, patients themselves should be able to use biosensors in the monitoring of a clinical condition, such as diabetes. It is probably true that the major biosensor market may be found where an immediate assay is required. If the costs of laboratory instrument maintenance are included, then low-cost biosensor devices can be desirable in the whole spectrum of analytical applications from hospital to home.

Diabetes. The “classic” and most widely explored example of closed-loop drug control is found in the development of an artificial pancreas. Diabetic patients have a relative or absolute lack of insulin, a polypeptide hormone produced by the beta cells of the pancreas, which is essential for glucose uptake. Lack of insulin secretion causes various metabolic abnormalities, including higher than normal blood glucose levels. In patients who have lost insulin-secreting islets of Langerhan, insulin is supplied by subcutaneous injection. However, fine control is difficult to achieve and hyperglycaemia is often encountered. Further, even hypoglycaemia is sometimes induced, causing impaired consciousness and the serious long-term complications to tissue associated with this intermittent low glucose condition.

Insulin Therapy. Better methods for the treatment of insulin-dependent diabetes have been sought and infusion systems for continuous insulin delivery have been developed. However, regardless of the method of insulin therapy, its induction must be made in response to information on the current blood glucose levels in the patient. Three schemes are possible, the first two dependent on discrete manual glucose measurement and the third a “closed-loop” system, where insulin delivery is controlled by the output of a glucose sensor which is integrated with the insulin infuser. In the former case, glucose is estimated based on analysis of finger-prick blood samples with a colorimetric test strip or more recently with an amperometric pensize biosensor device by the patients themselves. Clearly, these diagnostic kits must be easily portable, simple to use and require minimal skill and easy interpretation. However, even with the ability to monitor current glucose levels, intensive conventional insulin therapy requires multiple daily injections. This open-loop approach does not anticipate insulin dosage due to changes in diet and exercise. For example, it was shown that administration of glucose by subcutaneous injection, 60 minutes before a meal provides the best glucose/insulin management. A schemes for insulin therapy can be seen in figure bellow :




Artificial Pancreas. The introduction of a closed-loop system, where integrated glucose measurements provide feedback control on a pre-programmed insulin administration based on habitual requirements, would therefore relieve the patient of frequent assay requirements and, perhaps more desirably, frequent injections. Ultimately, the closed-loop system becomes an artificial pancreas, where the glycemic control is achieved through an implantable glucose sensor. A proposed implantable sensor is given in figure bellow :



Requirements for an implantable glucose sensor:


Industrial Process Control

Bioreactor Control. Bioreactors are used to cultivate recombinant cells for production of therapeutic proteins such as insulin. The productivity of such systems depends on bioreactor conditions. Real-time monitoring of carbon sources, dissolved oxygen and carbon dioxide, and products of metabolism in fermentation processes could lead to optimization giving increased product yields at decreased processing and material cost (Scheper et al., 1996). While real-time monitoring with feedback control involving automated systems does exist, currently only a few common variables are measured on-line, (e.g., pH, temperature, CO2, O2) which are often only indirectly related to the culture activity under control. If cellular metabolic activity can be monitored in real-time using sensors, one can suitably alter the environmental variable to improve process productivity. The benefit of closed-loop control of a cellular state are many, such as improved product yield and quality. It is the lack of sensors that limits the use of closed loop online control of cell culture and fermentation processes.

Military and Homeland Security Applications
The requirement for rapid analysis is also present in military applications. Recent military engagement in the Middle East has caused, rather rapidly, the deployment of field-usable sensors for chemical and biological warfare agents. Many of the sensors are small portable analytical kits that may be termed “dipsticks.” While they are reasonably robust, their performance in the field has been reported to be variable. Thus, there is a large need for robust sensors that require no maintenance. Both contact as well as remote sensing for warfare agents are currently under development. Distributed sensors and systems for monitoring hazards due to terrorist activity are currently being developed under the auspices of the Department of Homeland Security funding.

Environmental Monitoring
Environmental Protection Agency (EPA) Air and Water Monitoring. EPA’s Environmental Monitoring and Assessment Program (EMAP) was established to provide a comprehensive report card on the condition of the nation’s ecological resources and to detect trends in the condition of those resources. EPA routinely monitors both water and air in urban and rural areas. In recent times the Department of Homeland Security has initiated efforts to monitor the environment in urban areas, particularly large population centers, for potential bioterrorism agents. The primary measurement media is water or air, but the variety of target analytes is vast. At sites of potential pollution or terrorist activity, it would be desirable to install on-line real-time monitoring and alarm, targeted at specific analytes. Common environmental analytes are biological oxygen demand (BOD), atmospheric acidity, and river water pH, detergent, herbicides, and fertilizer concentrations in drainage and river (Leonard et al., 2003). The potential for biosensor technology for environmental monitoring is huge, and the potential impact is far-reaching. Although the principle of detection may be the same for a particular analyte, the actual technology platform used will be dependent on application. For example, a glucose sensor for on-line use in a fermenter has very different requirements from those used for monitoring glucose concentration in diabetic patients. Customization to meet application needs is often a very important part of technology development.

Saturday, January 3, 2009

Infinite Impulse Response Filter Design

Bilinear Transformation Design Method
The figure bellow illustrates a flow chart of the BLT design.



The design procedure includes the following steps: (1) transforming digital filter specifications into analog filter specifications, (2) performing analog filter design, and (3) applying bilinear transformation and verifying its frequency response.

Analog Filters Using Lowpass Prototype Transformation
This method converts the analog lowpass filter with a cutoff frequency of 1 radian per second, called the lowpass prototype, into practical analog lowpass, highpass, bandpass, and bandstop filters with their frequency specifications.
Letting Hp(s) be a transfer function of the lowpass prototype, the transformation of the lowpass prototype into a lowpass filter is given in figure bellow:


Let us consider the following first-order lowpass prototype:

Its frequency response is obtained by substituting s= jv


with the magnitude gain


Here's the figure that shows analog lowpass prototype transformation to the highpass filter, bandpass filter, bandstop filter:





Finally, the lowpass prototype transformations are summarized in Table bellow



MATLAB function freqs( ) can be used to plot analog filter frequency
responses for verification with the following syntax:
H = freqs(B, A, W)
B = the vector containing the numerator coefficients
A = the vector containing the denominator coefficients
W =the vector containing the specified analog frequency points (radians per second)
H = the vector containing the frequency response.

Problem
Given a lowpass prototype

a. Determine each of the following analog filters and plot their magnitude
responses from 0 to 200 radians per second.
1. The highpass filter with a cutoff frequency of 40 radians per second.
2. The bandpass filter with a center frequency of 100 radians per second
and bandwidth of 20 radians per second.

Answer using Matlab:
W=0:1:200; %analog frequency points for computing the filter gains
Ha=freqs([1 0],[1 40],W); % frequency response for the highpass filter
Hb=freqs([20 0],[1 20 100],W); % frequency response for the bandpass filter
subplot(2,1,1);plot(W, abs(Ha),'k');grid % the filter gain plot for highpass filter
xlabel('(a) Frequency (radians per second)')
ylabel('Absolute filter gain');
subplot(2,1,2);plot(W,abs(Hb),'k');grid % the filter gain plot for bandpass filter
xlabel('(b) Frequency (radians per second)')
ylabel('Absolute filter gain');

Wednesday, December 24, 2008

Inductive Sensors

Inductive sensors, are noncontact devices used for precision measurement of a conductive target’s position.One of many advantages of using magnetic field for sensing position and distance is that any nonmagnetic material can be penetrated by the field with no loss of position accuracy.Unlike capacitive sensors, inductive sensors are not affected by material in the probe/target gap so they are well adapted to hostile environments where oil, coolants, or other liquids may appear in the gap. Inductive sensors are sensitive to the type of target material. Copper, steel, aluminum and others react differently to the sensor, so for optimum performance the sensor must be calibrated to the correct target material.



A basic inductive sensor consists of a magnetic circuit made from a ferromagnetic core with a coil
wound on it. The coil acts as a source of magnetomotive force (mmf) that drives the flux through the magnetic circuit and the air gap. The presence of the air gap causes a large increase in circuit reluctance and a corresponding decrease in the flux. Hence, a small variation in the air gap results in a measurable change in inductance. For the explanation of the basic principles of inductive sensors,The magnetic circuit consists of a core, made from a ferromagnetic material with a coil of n number of turns wound on it. The coil acts as a source of magnetomotive force (mmf) which drives the flux Φ through the magnetic circuit. If one assumes that the air gap is zero, the equation for the magnetic circuit can be expressed as:

mmf = Flux × Reluctance = Φ × ℜ A - turns (1)

such that the reluctance ℜ limits the flux in a magnetic circuit just as resistance limits the current in an electric circuit. By writing the mmf in terms of current, the magnetic flux may be expressed as:

Φ = n i ℜ weber (2)

the flux linking a single turn is by Equation 2; but the total flux linking by the entire
n number of the turns of the coil is.



Equation 3 leads to self inductance L of the coil, which is described as the total flux (Ψ weber) per unit current for that particular coil; that is



This indicates that the self inductance of an inductive element can be calculated by magnetic circuit properties. Expressing ℜ in terms of dimensions as:





Inductive Technology Fundamentals
While capacitive sensors use an electric field for sensing the surface of the target, inductive sensors use an electromagnetic field that penetrates into the target. By passing an alternating current through a coil in the end of the probe, inductive sensors generate an alternating electromagnetic field around the end of the probe. When this alternating field contacts the target, small electrical currents are induced in the targetmaterial (eddy currents). These electrical currents, then, generate their own electromagnetic fields. These small fields react with the probe’s field in such a way that the driver electronics can measure them. The closer the probe is to the target, the more the eddy currents react with the probes field and the greater the driver’s output.
Inductive sensors are affected by three things: the sizes of the probe coil and target, the distance between them, and the target material. For displacement measurements the sensor is calibrated for the target material and the probe size remains constant, leaving the target/probe gap as the only variable. Because of its sensitivity to material changes, eddy current technology is also used to detect flaws, cracks, weld seams, and holes in conductive materials.

Target Considerations
Inductive sensors are sensitive to different conductive target materials. Sensors must be calibrated to the specific material with which they will be used. Some materials behave similarly and others differ significantly. There are two basic types of target materials: ferrous (magnetic) and nonferrous (not magnetic). Some inductive sensors will work with both materials, while others will only work with one type or the other. Some ferrous materials include iron, and most steels. Nonferrous materials include aluminum, copper, brass, zinc and others.
Inductive sensors are frequently used to monitor rotating targets such as crankshafts and driveshafts. However, measurements of rotating ferrous targets generate small errors because of tiny variations within the target material. This is called electrical runout or magnetic runout. These errors are quite small, on the order of 0.001 mm, which is negligible in the measurement of larger motions such as driveshafts. But inductive sensors are not well suited to high resolution measurement of rotating ferrous targets where they are expected to measure changes of 0.0001 mm.
Ideally, the target’s measured surface must offer an area three times larger than the probe’s diameter. This is because the electromagnetic field from an inductive sensor’s probe is approximately three times the probe’s diameter. Sensors can be specially calibrated to smaller targets when the application demands it.
Another target consideration is the thickness of the target material. Because electromagnetic fields penetrate the target, there is a minimum thickness requirement for the target. The minimum thickness is dependent on the electrical and magnetic properties of the material and on the frequency at which the probe is driven. As the frequency goes up, the minimum thickness goes down. This table lists some minimum thicknesses for common materials with a typical 1 MHz drive frequency.




Functional principle of an inductive proximity switch


The oscillation coil behind the active surface of the proximity switch produces an alternating electromagnetic rotational current field. Any electrically conductive material entering the field will induce rotational currents extracting energy from the oscillating circuit. The damping of the oscillator is then converted into a switch signal in the output amplifier. It follows from the functional principle that all metals are detected,moving or not. Important:The high frequency field produces no measurable increase in temperature and no magnetic influence inside the object to be detected. That means the sensors operate without interacting with the system.





LVDT (linear variable differential transformer)
Inductive displacement sensors according to the LVDT principle (Linear Variable Differential Transformer) are constructed with a primary and two secondary coils, which are arranged symmetrically to the primary winding. As a measurement object, a rod shaped magnetic core can be moved within the differential transformer. An electronic oscillator supplies the primary coil with an alternating current of constant frequency. The excitation is an alternating voltage with an amplitude of a few volts and a frequency between 1 and 10 kHz.

Depending on the core position alternating voltages are induced in the two secondary windings. If the core is located in its "zero position", the coupling of the primary to both secondary coils is equally large. Movement of the core within the magnetic field of the coil causes a higher voltage in one secondary coil and a lower voltage in the second coil. The difference between the two secondary voltages is proportional to the core displacement. Due to the differential design of the sensor, the LVDT series has an output signal which is very stable.



Example of LVTD :




Eddy Current Sensors
The measurement principle of the EDS series is based on eddy current effect.The displacement sensor uses a ferrous target sleeve of soft magnetic material, a measurement coil and a compensation coil. The coils are mounted inside a pressurised stainless steel housing. An aluminum (ferrous) sleeve which can be moved along the housing without making contact is used as the target.If both coils are supplied with an alternating current, then two orthogonal magnetic fields are produced in the sleeve. The measurement coil, wound in one layer, produces a field which has a magnetic coupling with the target.The eddy currents then arising in the target form a magnetic field which influences the measurement coil impedance. This changes linearly with the target position. The magnetic field of the compensation coil has in contrast no coupling with the target and the impedance of the compensation coil is largely independent of the target position.
The electronic circuit generates a signal from the ratio of the impedance of the measurement coil and the compensation coil and converts the sleeve position into a linear electrical output signal of 4 - 20mA. In achieving this, the temperature effects and the temperature gradient are essentially eliminated.
With measurement ranges from 100 mm to 630 mm, the product range in the EDS series is very versatile. For OEM systems the mechanical interfaces can be adapted to the installation situation.



The depth of the object where eddy currents are produced is defined by



where f is the frequency and σ is the target conductivity. Naturally, for effective operation, the object thickness should be larger than the depth. Hence, eddy detectors should not be used for detecting metallized film or foil objects. Generally, the relationship between the coil impedance and distance to the object x is nonlinear and temperature dependent. The operating frequency of the eddy current sensors range from 50 kHz to 10 MHz.


Figures B and C show two configurations of the eddy sensors: with the shield and without one. The shielded sensor has a metal guard around the ferrite core and the coil assembly. It focuses the electromagnetic field to the front of the sensor. This allows the sensor to be imbedded into a metal structure without influencing the detection range. The unshielded sensor can sense at its sides as well as from the front. As a result, the detecting range of an unshielded sensor is usually somewhat greater than that of the shielded sensor of the same diameter. To operate properly, the unshielded sensors require nonmetallic surrounding objects.

System configuration and detection principle of Eddy Current displacement sensor


The figure about shows the system configuration and detection principle of an EC displacement sensor. This system is composed of a measuring object, a coil, a capacitor for parallel resonance,and a coupling capacitor . An oscillator provides a driving voltage to the coil with driving frequency tuned to the parallel resonance frequency.
The measuring object of the EC displacement sensor is usually made of a magnetic substance. Chromium molybdenum steel was used as the measuring object in this study. The magnetic flux is generated by the driving current of the coil,
and the magnetic flux is generated by the eddy current in the measuring object. changes in accordance with the displacement of the measuring object and the impedance of the coil changes as a result. The impedance of the coil converts the flux change in the coil into an output voltage through the parallel resonance circuit. The construction plan in this study uses the cylindrical coordinates .

Monday, December 22, 2008

Data Logger Schematic for Temperature and Light Sensor

A data logger also known as 'HOBO', is an electronic instrument that storing a series of measurements over time, usually from a sensor that converts a physical quantity such as temperature, pressure, relative humidity, light, resistance, current, power, speed, vibration into a voltage that is then converted by a digital to analog converter (DAC) into a binary number. Data logging hardware may have several DACs for multiple simultaneous measurements. The hardware usually connects to a parallel port, serial port or USB port on a PC.Typically, data loggers are small, battery-powered devices that are equipped with a microprocessor, data storage and sensor. Most data loggers utilize turn-key software on a personal computer to initiate the logger and view the collected data.
Here's the picture of data logger schematic, I made it in EAGLE Version 5.3.0 for Windows Light Edition. This only a data logger for simulation purposes, that's why it use three swicht to replace sensor input.


And here's the bottom board picture :


You can download the schematic file for free in the link bellow, open it using EAGLE Version 5.3.0 or higher version.
DOWNLOAD

Monday, December 15, 2008

Digital Signal Processing Filter Implementation Using MATLAB

Technologies such as microprocessors, microcontrollers, and digital signal processors have become so advanced that they have had a dramatic impact on the disciplines of electronics engineering, computer engineering, and biomedical engineering. Technologists need to become familiar with digital signals and systems and basic digital signal processing (DSP) techniques. This page will show you some example of Matlab code to solve problem in digital signal processing. This sample question I pick from Digital Signal Processing Fundamentals and Applications made by Li Tan. You can run it in Matlab software.

A. Z-transfer Functions, Difference Equations, and Filter Implementation Using MATLAB

1. An FIR system is given below:
Numerator coefficients: b=[0.2 0.3 0.2]
a. Determine its transfer function H(z)=
b. Determine its difference equation y(n)=
Given sampled values: sample=[1:1:10], write a MATLAB program to perform the digital filtering.

Matlab code :

close all;clear all;
sample =[1:1:10]
x=[0 0 sample]
for n=3:1:length(x)
y(n)=(n+5)*2%you can change it depens on the equation you want to use
end
y(3:1:length(x))
yy = filter([0.2 0.3 0.2],1,sample);
y(3:1:length(sample));

2. Two FIR system coefficients are given below, respectively,

FIR system 1:
bLP =[
-0.0012 -0.0025 -0.0045 -0.0068 -0.0073 -0.0030 0.0089 …
0.0297 0.0583 0.0907 0.1208 0.1422 0.1500 0.1422 …
0.1208 0.0907 0.0583 0.0297 0.0089 -0.0030 -0.0073 …
-0.0068 -0.0045 -0.0025 -0.0012]

FIR system 2:
bBP =[
0.0004 -0.0017 -0.0064 -0.0076 0.0073 0.0363 0.0458 …
0.0000 -0.0802 -0.1134 -0.0419 0.0860 0.1500 0.0860 …
-0.0419 -0.1134 -0.0802 0.0000 0.0458 0.0363 0.0073 …
-0.0076 -0.0064 -0.0017 0.0004 ]

a. Determine the transfer function using z-transform for the first FIR system.
b. Determine the difference equation for the first FIR system.

Matlab code :

clear all; close all;
bLP =[ -0.0012 -0.0025 -0.0045 -0.0068 -0.0073 -0.0030 0.0089 0.0297 0.0583 0.0907 0.1208 0.1422 0.1500 0.1422 0.1208 0.0907 0.0583 0.0297 0.0089 -0.0030 0.0073 -0.0068 -0.0045 -0.0025 -0.0012]
bBP =[0.0004 -0.0017 -0.0064 -0.0076 0.0073 0.0363 0.0458 0.0000 -0.0802 -0.1134 -0.0419 0.0860 0.1500 0.0860 -0.0419 -0.1134 -0.0802 0.0000 0.0458 0.0363 0.0073 -0.0076 -0.0064 -0.0017 0.0004 ]
fs=8000;
t=0:1/fs:0.01;
xx=5*cos(2*pi*500*t)+5*cos(2*pi*1200*t+0.25*pi)+5*cos(2*pi*1800*t+0.5*pi);
yL=filter(bLP,1,xx);
yB=filter(bBP,1,xx);
subplot(3,1,1);plot(xx);xlabel('The original wave');grid;
subplot(3,1,2);plot(yL);xlabel('Wave trough low pass filter');grid;
subplot(3,1,3);plot(yB);xlabel('Wave trough band pass filter');grid;

B. Filter Design Using MATLAB

1. Design a lowpass FIR filter with the following specifications:
Number of filter taps=31 taps
Cut-off frequency=800 Hz
Sampling rate =8000 Hz
Fourier transform method

Matlab code :

clear all;close all;
N=31;
fc=800;
fs=8000;
M=(N-1)/2;
sigma=2*pi*fc/fs;

for n=1:M
temp(n)=(sin(sigma*n))/(n*pi);
end

for n=1:M
h(n)=temp(M+1-n);
end

h(M+1)=sigma/pi;

for n=1:M
h(M+1+n)= temp(n);
end

freqz(h,1,512,8000);

2. Design a bandpass FIR filter with the following specifications:
Number of filter taps=31 taps,
Lower cut-off frequency=1000 Hz, upper cut-off frequency=1400 Hz,
Sampling rate =8000 Hz
Hanning window

Matlab code :

N=31;
fl=1000;
fh=1400;
fs=8000;

M=(N-1)/2;
sigmal=2*pi*fl/fs;
sigmah=2*pi*fh/fs;

for n=1:M
temp(n)=(sin(sigmah*n))/(n*pi)-(sin(sigmal*n))/(n*pi);
end

for n=1:M
h(n)=temp(M+1-n);
end

h(M+1)=(sigmah-sigmal)/pi;

for n=1:M
h(M+1+n)= temp(n);
end
w=0.5+0.5*cos([-M:1:M]*pi/M);
b=h.*w;
h=b;
freqz(h,1,512,8000);

3. Design a highpass FIR filter with the following specifications:
Number of filter taps=31 taps,
Cut-off frequency=1500 Hz
Sampling rate =8000 Hz
Design using the Hamming window

Matlab code :

clear all;close all;
N=31;
fc=1500;
fs=8000;
M=(N-1)/2;
sigma=2*pi*fc/fs;

for n=1:M
temp(n)=(sin(sigma*n))/(n*pi);
end

for n=1:M
h(n)=temp(M+1-n);
end

h(M+1)=sigma/pi;

for n=1:M
h(M+1+n)= temp(n);
end
w=0.54+0.46*cos([-M:1:M]*pi/M);
b=h.*w;
h=b;
freqz(h,1,512,8000);

C. IIR Filter Design Using MATLAB
1. Design lowpass IIR filter with the following specifications:
Filter order = 2, Butterworth type
Cut-off frequency=800 Hz
Sampling rate =8000 Hz
Design using the bilinear z-transform design method

Matlab code :

clear all;close all;
format long;
fs=8000;
f=800;
Wd=2*pi*f;
T=1/fs;
Wa=2/T*tan(Wd*T/2);
[B A]=lp2lp([1],[1 1.4142 1],Wa);
[b a]=bilinear(B,A,fs);
freqz(b,a,512,fs);
axis([0 fs/2 -40 1])

2. Design a bandpass IIR filter with the following specifications:
Filter order =2, Butterworth type
Lower cut-off frequency=1000 Hz, upper cut-off frequency=1400 Hz,
Sampling rate =8000 Hz
Design using the bilinear z-transform design method

Matlab code :

clear all;close all;
format long;
fs=8000;
fh=1400;
fl=1000;
wh=2*pi*fh;
wl=2*pi*fl;
T=1/fs;
wah=2/T*tan(wh*T/2);
wal=2/T*tan(wl*T/2);
W=wah-wal;
Wo2=wah*wal;
[B A]=lp2bp([1],[1 1.4142 1],sqrt(Wo2),W);
[b a]=bilinear(B,A,fs);
freqz(b,a,512,fs);
axis([0 fs/2 -40 1])

3. Design a highpass IIR filter with the following specifications:
Filter order= 4, Chebyshev type
Ripple on the passband =1 dB
Cut-off frequency=1500 Hz
Sampling rate =8000 Hz
Design using the bilinear z-transform design method

Matlab code :

close all;clear all;
fs=8000;
T=1/fs;
fd=1500;
wd=2*pi*fd;
wa=(2/T)*tan(wd*T/2)
[B A]=lp2hp([0.2546],[1 0.9528 1.4539 0.7426 0.2756],wa);%([numerator],[deminator],[Wa])
[b a]=bilinear(B,A,fs);
freqz(b,a,512,fs);
axis([0 4000 -40 2]);
f=gain

4. Design lowpass IIR filter with the following specifications:
Filter order = 1
3dB cut-off frequency=120 Hz
Sampling rate =8000 Hz
Design using the pole-zero placement method

Matlab code :

close all;clear all;
format long;
fs = 8000;
fc = 120;
alpha = (1 - (2*(fc/fs)*pi));
K = (1 - alpha)/2;
freqz([K K],[1 -alpha],512,fs);
axis([0 fs/2 -40 1])

5. Design a bandpass IIR filter with the following specifications:
Filter order =2
3dB lower cut-off frequency=1200 Hz, 3dB upper cut-off frequency=1400 Hz,
Sampling rate =8000 samples per second
Design using the pole-zero placement method

Matlab code :

close all;clear all;
fs=8000
f0=1400
Bw=1200
r=1-(Bw/fs)*pi
theta=(f0/fs)*2*pi
K=(1-r)*sqrt(1-2*r*cos(2*theta)+r*r)/(2*abs(sin(theta)))
freqz([K*sin(theta) K*sin(theta)],[(1*sqrt(1-2*r*cos(2*theta)+r*r)) (-r*sqrt(1-2*r*cos(2*theta)+r*r))],512,fs);
axis([0 4000 -40 1]);