Upload
phungnga
View
218
Download
1
Embed Size (px)
Citation preview
Slide 1
Insert Company Logo Here
Respiratory Sensor System (RSS) for In Situ Breath Measurement:
O2, CO2 and Flow,based on a MSP430F149
Dipl.-Ing. Timo KirschkeDipl.-Ing Jörg Heisig
supported by the European Space Agency ESA
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 2
Insert Company Logo Here
Contents
• RSS 1.5 – explanation and principles• Hardware• Software• Control Algorithms• Sensor Modelling and Errors• Trivia• Results• System Evolution• Discussion, Questions
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 3
Insert Company Logo Here
RSS 1.5 – What's that?
Abstract
The TU Dresden, Institute for Aerospace Engineering, is developing a Respiratory Sensor System in a project, sponsored by the European Space Agency. Essential parts of the system are: solid electrolyte gas sensors, an electronics box and the visualisation software, written in LabView and running on a PC. The initial target of the system is to observe the fitness of astronauts during their activities at the International Space Station ISS. Main terrestrial applications for this system are the fitness market and/or other medical applications, but also many gas sensing applications (e.g. vacuum coating techniques, combustion control...).
The electronics of this RSS were built around the TI MSP430F149. The electronic box contains analogue signal conditioning circuitry, voltage and current excitation for the sensors, a flow turbine pulse shaping circuit, two classD (PWM) power output stages for sensor heaters, bidirectional RS232 communication, some power supply parts and a reset circuit.
The main challenge was the realisation of some DSP-like functionalities on a low power µController. The heater control algorithm uses a cycle time of 1ms. Two PID-controls for the sensor heaters, all signal precalculations and the bidirectional communication with the PC had to be realised inside this time frame.
This presentation will introduce some interesting parts of the electronics, especially the power output section, and the challenges of the firmware development to meet the timing requirements, following the slogan: „Squeezing the last bit“.
The Respiratory Sensor System will be demonstrated in function.
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 4
Insert Company Logo Here
RSS 1.5 Advantages
• Low response time allowing a breath-to-breath, or even a ”one-breath” analysis
• Capability of measuring O2, CO2, and flow rate simultaneously
• Measurement in mainstream (the inspired/expired flow path of a human subject)
• Miniaturised design, „low-weight“• Low power loss of the electronics• Possibility of mobile/portable use of systems incorporating
the new sensor
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 5
Insert Company Logo Here
Principle of the O2 Sensors
● Oxygen ions can be conducted through a hot (>600°C) solid state electrolyte● Ions can be “pumped” from the cathode to the anode by an applied DC-voltage● The oxygen flux to the cathode is limited by a diffusion barrier and the sensor
temperature is kept constant
A
diffusionbarrier cathode
current anode
O2-
O2
O2
solidelectrolyte
constantvoltage
Anode
Electrolyte
Cathode
Substrate
Heater
Planar Design
Size:20 x 3,5 x 0,5 mm
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 6
Insert Company Logo Here
Flow Measurement● Sensor dissipates heat to
surroundings through:- Radiation- Free convection- Forced convection- Heat conduction to sensor plug
● Need to stabilise the temperature with a controller:- Heating by electrical power
● By measuring this power the original fluid flow rate can be computed (similar to “hot wire/hot film anemometer”)
VFluid
Radiation Free convection Forced convection Heating
Heat conduction
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 7
Insert Company Logo Here• Sensor signal
conditioning (INA, TIA, PGA: 5 gain ranges, 8ch. ADC)
• DAC 6/8ch. 16Bit• 2ch. PWM heater
power amplifier • Temperature
measurement, (programmable RTD current excitation)
• Flow turbine (SW quadrature dec.)
• JTAG + RS232
Hardware Structure
O2-sensor
CO2-sensor
PC
V24 protocolserial data
port
TI MSP430F149
serial on boardprogramming port
display port
LC – displayStatus-LEDs
digital heating control
additional port
SPI
digital input port
keypad
PowerAmp
DAC
DAC
ADC
PGA
DAC
PowerAmp
DAC
PGA
Reference
ADC-Filter
Temperature measurement
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 8
Insert Company Logo Here
Linear Power Stage
previous design:Linear Power Amplifier
main advantages:simple,fast,stable
disadvantage:high powerloss
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 9
Insert Company Logo Here
Triangle PWM Power Stage2nd approach:
natural sampling PWM, clocked by MSP430
advantage:low power loss
disadvantage:complex design, inherent output impedance makes output voltagemeasurementnecessary(no internal
control loop)
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 10
Insert Company Logo Here
Hysteretic Modulator OPS
1st quadrant modification of an Audio classD amplifier principleself oscillating, needs no clock, internal voltage control loop
3rd approach: Hysteretic ModulatorInstitute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 11
Insert Company Logo Here
Hyst. Modulator Simulation
● 0 ≤ M ≤ 1 possible, load independent over a wide range● constant voltage ripple over varying modulation index● good linearity (in Audio applications: fidelity)● not sensitive against power supply variations
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 12
Insert Company Logo Here
Power Stage Schematic
Small, simple, stable, efficient (>91% >5W), fast, accurateminor disadvantage: noisy at extreme modulation indexes
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 13
Insert Company Logo Here
Power Stage Efficiency
Total power consumption of the complete electronics box is approx. 2.5W (working condition)
Additional power loss of the output stage remains below 1W, even at full power (25W)
0,1 1,0 10,0 100,00
10
20
30
40
50
60
70
80
90
100Modulator Efficiency vs. output Power
Eta [%] @ 100Ω V 1_0Eta [%] @ 20Ω V 1_0Eta [%] @ 100Ω V 1_5Eta [%] @ 20Ω V 1_5
Output Power [W]
Effi
cien
cy E
ta [%
]
Main Working RangeVersion 1.0
Version 1.5
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 14
Insert Company Logo Here
Software Summary
● Development of a dedicated sensor model for control design
● Analytical and PC-based numerical parametrisation possible
● Development and verification of different control algorithms● Working principle of the sensors and their applicability was
demonstrated● Decision for a control algorithm depends on the sensor
structure and its parameters● LabView-Software + DDE-interface available
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 15
Insert Company Logo Here
Data Flux in the System
Analogue sensor
signals
Micro-controller
(heat control anddigitalisation)
Sensor(measurement of gas
mixture and flow)
MC-Driver(for data
acquisition andcalibration)
PC
Raw data inRS 232 buffer
Time, Flow,O2 and CO2 datain DDE buffer
UserProgram
(for data processing, storageand visualisation)
Digital sensor signals via serial port
Serial port DDE interface
Current sampling rates:
1000 Hz in MC250 Hz in PC
Analogue sensor
signals
Micro-controller
(heat control anddigitalisation)
Sensor(measurement of gas
mixture and flow)
MC-Driver(for data
acquisition andcalibration)
PC
Raw data inRS 232 buffer
Time, Flow,O2 and CO2 datain DDE buffer
UserProgram
(for data processing, storageand visualisation)
Digital sensor signals via serial port
Serial port DDE interface
Current sampling rates:
1000 Hz in MC250 Hz in PC
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 16
Insert Company Logo Here
Function Calls (Modules)
main
read ADC
Initialisation Oscillator ADC Timer A Timer B UART0 UART1 SPI0 WakeUpDAC Temp. Sensor
receive interrupt
convert ASCII->Hex
convert Hex->ASCII
load parameters set control switch
init sensorapplication
control switch PRBS PID_Heater PID_Sensor 3point_heater 3point_sensor Mod 3point_heater Mod 3point_sensor PARC PVR OR2/2 (OR4/4) cascaded_heater cascaded_sensor
upload values fill send buffer
wake up DACs
control cycle
one shot
transmit interrupt
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 17
Insert Company Logo Here
Control Algorithms● Control algorithm requirements:
- fast (quick response on disturbances, short cycle time),- robust (non-sensitive against parameter errors)- adjusted to the control path - high control quality;- continuous (smooth) controlling variable- low (better: no) remaining offset- low consumption of resources
calculation timememory space
● Suitable algorithms: 3-point-controlPID control
● Literature example: spra083.pdf on TI's website“PID and Deadbeat Controllers With the TMS320 Family”Finally implemented formulas No. 45 + 46
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 18
Insert Company Logo Here
PID Control Formulas
PID- Parameter Loading
K1 = Kp + 2•Kd/T + Ki•T/2K2 = Ki•T – 4•Kd/TK3 = Ki•T/2 + 2•Kd/T – Kp
Calculation of the output voltage (discrete algorithm)
u(n) = u(n-2) + K1*e(n) + K2*e(n-1) + K3*e(n-2)
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 19
Insert Company Logo Here
PID Control ProgrammingInstitute for Aerospace EngineeringProfessorship for Space Systems and Utilization
PID- Parameter Loading (P is shown only, I and D are similar)
If (Parameter[0]=='P' && Parameter[1]=='F' && Parameter[2]=='O') // O2 sensor PID control proportional factor{ P_Factor_O2 = 10*Value; K1_O2 = P_Factor_O2 + 2 * D_Factor_O2 + (I_Factor_O2 >> 1); K2_O2 = I_Factor_O2 - 4 * D_Factor_O2; K3_O2 = 2 * D_Factor_O2 - P_Factor_O2 + (I_Factor_O2 >> 1); return;}
Calculation of the output voltage(small modifications are dependent on the control path)
y[k0] = y[k1] + ((K1_O2 * (RTsoll - RTist[k0])) >> 10)+ ((K2_O2 * (RTsoll - RTist[k1])) >> 10)+ ((K3_O2 * (RTsoll - RTist[k2])) >> 10);
ControlOut = ((y[k0] + DAC_Offset) * DAC_Factor) >> 10;
Slide 20
Insert Company Logo Here
3-Point Control PrincipleInstitute for Aerospace EngineeringProfessorship for Space Systems and Utilization
UT>UTsoll+Hysteresis?
UHmid
send to DAC,output acquired data
yes
no
yes
UT<UTsoll-Hysteresis?
UHhighUHlow
yes
no
Slide 21
Insert Company Logo Here
3-Point Control Programming
// calculate output voltage
if (RTist[k0] > (RTsoll + Hysteresis)){ y[k0] = y_Low; // set out voltage = lower limit P5OUT &= ~BIT7; // switch LED 4 off}else if (RTist[k0] < (RTsoll - Hysteresis)){ y[k0] = y_High; // set out voltage = upper limit P5OUT |= BIT7; // switch LED 4 on}else y[k0] = y_Mid; // set out voltage = mid point
if (RTist[k0] > RT_UpLimit) // overheat?{ y[k0] = 1000; // reset control output value P5OUT |= BIT5; // switch LED 2 on}
ControlOut = ((y[k0] + DAC_Offset) * DAC_Factor) >> 10;
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 22
Insert Company Logo Here
Sensor Modelling (1)Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Hea
ter
Tem
pera
ture
sen
sor
Slide 23
Insert Company Logo Here
Sensor Modelling (2)
u voltagei currentP powerR resistanceQ heat
flowϑ temperatureG transfer
functionH heater sideS sensor sidedr drain offdist disturbance
GRϑH
GPH
GϑH GϑS
GiH
uH
RH
RH
RHuH RH
ϑS
GRHuH
iH
PH
ϑH
● ●
QdrH+QdistH
● ●
QdrS+QdistS
●
QLeit
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 24
Insert Company Logo Here
Quantisation EffectsInstitute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Discretisation• Time intervals (1ms)• Amplitude (12 Bit = 4095 values)Measuring range is:• Heater voltage 24 V ∆u = 6mV• Heater current 2.5 A ∆i = 610µA
• Measurement error is higher than the aimed temperature accuracypossible solution:significant enhancement of the measurement resolution
• Fast and accurate control algorithms get a two-point-behavior due to - the limited resolution and - the time delay between heater and temperature sensor
possible solution:concentration of control path parameterse.g. heater = temperature measurement resistor
Slide 25
Insert Company Logo Here
Measurement Quantisation and Resulting Reading Error
Peak to peak reading errors
Heater voltage±0.05% of range
Heater current±0.05% of range
Heater resistance±0.3% of reading(!)
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 26
Insert Company Logo Here
Heater Control Results
● If optimised for speed, a PID control shows similar behaviour as a 3-point control:
● Control variable deviation (green)
● Control variable noise (blue)
● Response time
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
PID control | 3-point control
0.1s
< 0.
1%
Slide 27
Insert Company Logo Here
Division Routines● 32Bit/32Bit via Libraries takes 68µs @ 8MHz● 2 divisions per control cycle necessary
approx. 16% of computational time● Lookup Table division possible?● Resolution of the measured values, acting as the divisor, is
12 Bits● Rearrange the division into a multiplication with the divisor
reciprocals, put them into a L.U.T. (vector)● Expand the reciprocals by 12Bit to keep the resolution,
even for the smallest values● Split the L.U.T. into 3 blocks to stay inside the 16Bit-range
(scaling by 16/20/24 Bits)● 12Bit/12Bit via L.U.T. takes 12µs @ 8MHz
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 28
Insert Company Logo Here
Serial Data Transmission
● Control cycle time: 1ms● Max. Baudrate: 115.2kBd, limited by the PC● Data to be transmitted: 8 values at 4 ASCII-symbols each● Overhead: 6 ASCII-symbols sum: 38 Bytes● Parameters 8N1: 9 Bits per data Byte● Theoretical data rate: 336 value sets per second● Data transmission: every 4ms● Function calls inside data conversion and buffer filling
routines avoided● Keep overhead small
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 29
Insert Company Logo Here
Transmit Results via RS232void FillSendBuf(unsigned int UARTx){ static unsigned int i = 0; static int result; { SendCRC = 0; SendBuf1[37] = 0x02; // STX
result = 0x0F & ((int)(SumRHist >> 12)); // convert numbers hex->ASCII if (result <= 9) SendBuf1[36] = result + '0'; else SendBuf1[36] = result + ('A' - 10);
result = 0x0F & ((int)(SumRHist >> 8)); if (result <= 9) SendBuf1[35] = result + '0'; else SendBuf1[35] = result + ('A' – 10);... for (i = 36; i >= 3; i--) // build CRC exclusive STX/ETX { SendCRC = SendCRC ^ (SendBuf1[i]); // bytewise EXOR } SendBuf1[2] = Digit1(SendCRC); // ASCII CRC SendBuf1[1] = Digit0(SendCRC); // ASCII CRC
SendBuf1[0] = 0x03; // ETX SendBufCnt1 = 37; // counter for bytes to be sent TXBUF1 = SendBuf1[SendBufCnt1]; // load 1st value into buffer } // initiates UART send routine}
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 30
Insert Company Logo Here
Used PeripheralsInstitute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 31
Insert Company Logo Here
3 rd Hardware Generation● All elements integrated
onto 1 PCB (3 PCBs)● Full SMT except big
caps and connectors● External power supply● O2 and CO2 sensor
channels (O2 only)● Multiple measurement
ranges per sensor channel (1 range only)
● PWM output stages(linear OPS)
● ¼ size, ⅓ weight
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
3rd (1st) hardware generation
Slide 32
Insert Company Logo Here
The Complete RSS PRO 1.5● Mask, containing
O2 and CO2 sensors
● Sensor cables, interface connection
● Electronics box ● External power
supply ● PC with LabView-
software
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 33
Insert Company Logo Here
Used Tools
Schematic: Orcad - not the optimum, many chrashes, sometimes corrupting the design
PCB-Layout: Orcad (sub-contractor)Software: first IAR, later Crossworks – no way back ☺
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 34
Insert Company Logo Here
The Final
Thanks to:
● The ESA/ESTEC for the financial support of our project● Texas Instruments for their nice controllers and support● The web community (e.g. MSP430 Yahoo-forum)● Paul Curtis (Rowley) for his generous help● You, for your attention and patience
Enjoy your projects!
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
Slide 35
Insert Company Logo Here
Slides - Discussion1. Title2. Contents3. RSS 1.5 – What's that?4. RSS 1.5 Advantages5. Principle of the O2 Sensors6. Flow Measurement7. Hardware Structure8. Linear Power Stage9. Triangle PWM Power Stage10. Hysteretic Modulator OPS11. Hyst. Modulator Simulation12. Power Stage Schematic13. Power Stage Efficiency14. Software Summary15. Data Flux in the System16. Function Calls (Modules)17. Control Algorithms18. PID Control Formulas19. PID Control Programming
Institute for Aerospace EngineeringProfessorship for Space Systems and Utilization
20. 3-Point Control Principle21. 3-Point Control Programming22. Sensor Modelling (1)23. Sensor Modelling (2)24. Quantisation Effects25. Measurement Quantisation and
Resulting Reading Error26. Heater Control Results27. Division Routines28. Serial Data Transmission29. Transmit Results via RS23230. Used Peripherals31. 3rd Hardware Generation32. The Complete RSS PRO 1.533. Used Tools34. The Final35. Slides - Discussion