Saturday, November 26, 2016

Thermal Flow Sensor Measurement Circuit with PIC Microcontroller
Xiang Zheng Tu

  
As shown in the above figure, a PIC16F1704 is used for a thermal flow sensor measurement circuit provided by POSIFA Microsystems Company. The thermal mass flow sensor consists of upstream and downstream temperature thermopiles and a heater located between the two thermopiles. If no gas flows over the sensor surface, the thermopiles measure the same rise in temperature, resulting in the same output voltage of the two thermopiles. If a non-zero gas flows, the velocity of a fully-developed laminar air flow unbalances the temperature profile around the heater and heat is transferred from upstream thermopiles to the downstream thermopiles, causing a change in the voltages of the thermopiles. Larger gas flow rates result in larger change in the temperature profile.
The sensors are thermally isolated so only heat transfer due to flow can occur. Other heat transfer pathways such as through substrate or electrical leads result in thermal losses is minimized in the device design.

To interface the microcontroller the following I/O pins of the microcontroller are setup as:
  • RC0 assigned to OPA1in+, pin 9 (sensor in)
  • RC1 assigned to OPA1in-, pin 8 (offset bias)
  • RC2 assigned to digital out, pin7
  • RC3 assigned to OPA2 out, pin 6
  • RC4 assigned to OPA2 in-, pin5
  • RC5 assigned to OPA2in+, pin4
  • RA2 assigned to DAC1out2, pin 10 (offset setting)
  • RA0 assigned to I2C data, pin 12, where I2C pull-up to be provided by host assigned to ANO when not in I2C mode (bat monitor)
  • RA1 assigned to I2C CLK, pin 11, where I2C pull-up to be provided by host assigned to AN1 when not in I2C mode (temp monitor)
  • RA3 assigned to /MCLR pin 3 as an input assigned to LED as an output
  • RA4 assigned to AN3 pin 2 (sensor from op-amp 1)
  • RA5 assigned to digital output pin 1 firmware PWM for heater current set up as open drain
The internal devices of the microcontroller are setup as:
  • Set OPAMP1out to AN6
  • Set DAC reference to VFR at 2.048 and Vss
  • A/D reference tied to VFR at 2.048 and Vss 
Some concepts are adopted in operation of the microcontroller:
  • Processor powered directly off battery – no regulator
  • External reference for heater and thermistor
  • External ref and current source is lower cost than regulator
  • DAC and Analog in referenced internally to 2.048
  • Offset and amps are setup to avoid amp saturation
  • Calibration with no flow to obtain offset reference value
  • During operation, heater is on for 15 ms at which time data is taken 
The circuit supports a battery driven power supply and is capable of time keeping. It senses the signals from the flow sensor, calculates the flow and then accumulates it. The total flow accumulated and the month wise profile of the flow are stored and updated in the memory. The user key available on the board can be used to display the flow accumulated in a month and the date on the LCD. The design also supports wireless communication with another handheld device. Thus, the device supports the AMR where

The software design matching the circuit consists mainly of the flow calculation, database, user interface, and communication modules. The software has following main modules:
• Flow Calculation Module
• Database Management Module
• User Interface Module
• Communication Module

PIC Microcontrollers - Programming in C is a Microchip site where you can browse and download free software / firmware code examples for your PIC projects. You'll find code for controlling simple timers and UARTs, low power modes, Fast Fourier Transforms, LCD displays, motor-control algorithms, and many more. These examples are better proof that program writing is neither a privilege nor a talent issue, but the ability of simple putting puzzle pieces together using directives. Design and development of devices mainly boil down to the ‘test-correct-repeat’ method. Of course, the more you are in it, the more complicated it gets since the puzzle pieces are put together by both children and first-class architects.
Example 1: Module CCP1 as PWM signal generator

Example 2: Using A/D converter

Example 3: Using EEPROM Memory
 

Example 4: Using LCD display

Tuesday, November 15, 2016

Increasement of Thermal Flow Sensor Resolution
by Oversampling with Lower Bit ADCs

Xiang Zheng Tu

 

As shown in the above figure, a thermal flow sensor provided by POSIFA Microsystems Company consists of a heater and two thermopiles. The sensor is heated above ambient temperature by passing a PWM output of a microcontroller through the heater and the sensor flow-dependent heat loss causes temperature changes which are converted by the thermopiles into an electrical signal. This signal is then periodically sampled and digitized by the analog-to-digital converter (ADC) of the microcontroller.

When considering the resolution required for an A/D converter (ADC) integrated in a microcontroller, embedded systems designers must balance cost and performance. Higher ADC resolution implies higher-cost microcontroller, but in some cases you can use other features in the microcontroller to enhance the ADC performance via software. That approach lets you achieve higher resolution using an inexpensive integrated ADC.

Oversampling is a process of sampling a signal with a sampling frequency significantly higher than the Nyquist rate. Theoretically a bandwidth-limited signal can be perfectly reconstructed if sampled above the Nyquist rate, which is twice the highest frequency in the signal. Oversampling improves resolution, reduces noise and help avoid aliasing and phase distortion by relaxing anti-aliasing filter performance requirements.

In our case, to implement a 12-bit converter, it is sufficient to use a 16-bit converter that can run at 256 times the target sampling rate. Combining 256 consecutive 12-bit samples can increase the signal-to-noise ratio at the voltage level by a factor of 16 (the square root of the number of samples averaged), effectively adding 4 bits to the resolution and producing a single sample with 16-bit resolution. To get the best possible representation of the analog input signal, it is necessary to oversample the signal this much, because a larger amount of samples will give a better representation of the input signal, when averaged.

Criterias for using oversampling technique are:
·       The sensor signal being measured should vary at very low frequency. Furthermore to obtain very accurate information about the dynamics of the signal, multiple harmonic components of the signal are acquired, resulting in the need to process signal bandwidths much wider than the actual signal.
·       The signal-component of interest should not vary significantly during a conversion. There should be some noise present in the signal. The amplitude of the noise should be at least 1 LSB.

Fortunately, the bandwidth of the thermal flow sensor is rather small, typically ranging from a few Hertz to a few kilohertz, high oversampling ratios can be readily employed.
Normally there are some noises present during an analog-to-digital conversion. These noises include thermal noise, noise from the CPU core, switching of I/O-ports, variation in the power supply and others, which are enough to make this method work. Another approach for satisfying the criteria is to use a method similar to a Delta-Sigma modulator, by adding a triangular wave to the input signal.

Digital Signal Processing software is required for oversampling and average. This software can be divided into five major blocks:
·       Peripheral Initialization
·       Triangular Signal Generation
·       Data Acquisition
·       Digital Filter Decimation
·       Interrupt Service Routine


A PWM output and an analog low pass filter can be used to generate a triangular signal as an additional noise signal. Reference to the above figure another PWM output of the microcontroller is used to heat the thermal flow sensor. It should be understand that the thermal inertia of the flow sensor can be modeled as a low-pass filter in the thermal domain. This may limit the response time of the flow sensor, but also remove the peak noise from the PWM output signal.

Thursday, November 3, 2016

MEMS Infrared Emitters
Xiang Zheng Tu

Infrared thermal emitters can be approximated as black body radiation, which is the type of electromagnetic radiation. The radiation has a specific spectrum and intensity that depends only on the temperature of the emitters. An emitter at room temperature appears black, as most of the energy it radiates is infra-red and cannot be perceived by the human eye. When it becomes a little hotter, it appears dull red. As its temperature increases further it eventually becomes blue-white.

POSIFA Microsystems Company has developed a new generation of MEMS infrared emitters that form its hot-heater based thermal flow sensors and thermal conductivity sensors. Proprietary advanced porous silicon technology combined with silicon processing result in the highest performance MEMS infrared emitters.

The MEMS infrared emitter consists of a resistive thin film platinum based heater which is positioned on a free standing thin-film stack membrane, and allows the heater to operate continuously and reliably at a higher temperature. The freestanding thin-film stack membrane thermally and electrically isolates the heater from the silicon substrate, and reduces the power consumption of the heater. In addition, the membrane has low thermal mass so that the heater is easy to modulate. The rise time of the heater is as low as 5 ms, indicating the frequency of driving pulse voltage can be up to 100 Hz.

As shown in the above figure, when the MEMS infrared emitter is operated at 300 k, the produced infrared spectrum range can be from 2 to 20 µm. This is mid-infrared spectral region containing strong characteristic vibrational transitions of many important molecules as well as two atmospheric transmission windows of 3-5 μm and 8-13 μm, which makes it crucial for applications in spectroscopy, materials processing, chemical and biomolecular sensing, security and industry.

The MEMS infrared emitters have many industrial applications including:
  • Medical (CO2 / other gases monitoring, breath /vapor analyzing),
  • Military / Law Enforcement,
  • Automotive / Transportation (breath alcohol testing / exhaust monitoring)
  • Aerospace (calibration systems, image sensing),
  • HVAC (demand controlled ventilation, refrigerant monitoring), and
  • Safety / Industrial / Environment Control (combustion gas analyzers, gas detection, air pollution). 

In the above figure the key components of an infrared greenhouse gases measurement system are infrared emitter, measurement chamber, interference filter, and infrared detector. Infrared radiation is directed from the infrared emitter through the measured greenhouse gases to the infrared detector. An interference filter located in front of the detector prevents wavelengths other than that specific to the measured gases from passing through to the detector. POSIFA Microsystems Company can provide not only infrared emitters, but also interference filters and infrared detectors. The interference filter is made of multi porous silicon layers and the infrared detectors are thermopile type.