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

No comments:

Post a Comment