Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 1. CIRCUIT DESIGN If not using one of First Sensors ZBXYA interface boards for sensor control and conditioning, this section describes the basic building blocks required to create an interface circuit. Before continuing a good understanding of application note AN_XYAO2_E_11154 is required. Noise on the buffered amplified signal should be filtered by a low pass filter with a cut-off frequency of around 250 Hz. It is important not to filter the mV Nernst Voltage as this can load the cell. To improve common mode noise rejection a small value capacitor (~10 nF) can be placed across the input terminals of the amplifier. 1.1 HEATER CONTROL The sensor requires 4.35 VDC to create the correct operating temperature for the sensing cell. This should be measured as close to the sensor as possible because due to the high current requirement of the low resistance heater there will be voltage drops across connections and wiring. The designed adjustable voltage supply should be capable of providing at least 2 A and emit minimal noise. 1.7 VOLTAGE REFERENCE AND COMPARISON The amplified sense signal should be compared to voltage references which are the specified pump reversal voltages scaled by the same gain factor as the output amplifier. Each time either the upper or lower reference is met the constant current source should be reversed. This part of the circuit should always start up in the condition that applies the constant current source between PUMP and COMMON as this begins the evacuation necessary to start the pumping cycle i.e. PUMP should be positive with respect to COMMON. 1.2 CONTROL CIRCUIT VOLTAGE REGULATION Step down and control of input supply voltage. 1.3 START UP DELAY Zirconium dioxide only becomes operational above 650 °C and as the temperature decreases below this threshold the cell impedance increases dramatically. It is therefore important that the sensing cell is not pumped when cold. Doing so may damage the sensor as the constant current source will try and drive whatever voltage is necessary, this has been found to create an effect similar to when there is zero ppO2. It is recommended that the sensor is warmed up for a minimum 60 s before the sensor control circuitry becomes active. This delay is usually achieved in software but could also be implemented in hardware . 1.4 CONSTANT CURRENT SOURCE A typ. 40 µA DC constant current source is required to drive the pump side of the sensing cell. It is recommended that an op amp configured as a constant current source is used. A single resistor and reference voltage are chosen to set the current with the sensor cell being the variable load placed in the feedback loop. 1.5 CONSTANT CURRENT SOURCE REVERSAL Connection of the constant current source between PUMP and COMMON has to be able to be reversed whenever either of the reversal voltages are met. 1.8 SIGNAL CONDITIONING A suitable microprocessor is required to monitor the amplified sense signal and continually calculate td or tp. Averaging will reduce natural sensor noise with the amount of averaging set to suit the response time needs of the application. Adaptive filtering is the best solution where the amount of averaging is changed depending on the amount of variation in the calculated values. 1.9 OUTPUT CONDITIONING The microprocessor output should then be scaled or transformed into the required output i.e. voltage, current loop, serial etc. This may involve the use of a DAC and output drive circuitry. Filtering and resolution should also be taken into consideration. Sensor cell Constant current source reversal Constant current source Sensor output amplification and filtering Signal conditioning Voltage reference and comparison Output conditioning Start up delay 1.6 OUTPUT AMPLIFICATION AND FILTERING As the sensed Nernst voltage is a mV signal it is practical to amplify this to a more sensible operating range before analysis. Input impedance of the chosen amplifier should be as high as possible to avoid loading the cell. Input offset should be less than 0.5 mV. E / 11163 / B Control circuit voltage regulation Fig. 1: Sensor heater Power supply Heater voltage regulation Sensor interface block diagramm 1/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 2. AMPLIFYING AND SAMPLING THE SENSORS SENSE SIGNAL This section describes the hardware required to amplify the generated Nernst voltage from the sensor and also the ADC requirements to correctly sample the signal. 2.1 ADC minimum resolution To accurately sample the sensor SENSE signal (Nernst Voltage) using the recommended hardware solution in Section 2.3 the ADC resolution must be at least 12 bits. Two ADC channels are required as the signal is a differential signal (SENSE with respect to COMMON). It is possible to use a single 10 bit ADC but this involves two stage amplification to firstly amplify the signal then a second stage to remove the offset and scale the signal to use the entire 10 bit ADC input range. Due to the requirement for instrumentation amplifiers it is preferred to use higher resolution ADCs which are now common in most microprocessors and a lower cost amplifier setup. 2.2 ADC acquisition time The acquisition time required to convert the analogue signal should be keep to a minimum. If the ADC is serviced by an interrupt it is important to keep its frequency equal to or greater than the maximum sample frequency (see Section 4.1). 2.4 ADC averaging To help reduce noise in the sampled signal the ADC results should be placed into a rolling average filter (see Section 8). 2.5 ADC step voltage Knowing the step voltage is important when calculating the voltage level thresholds of the amplified SENSE signal (see Fig. 3). To calculate the step voltage, the following equation should be used: ADC SV = VS 2N (1) ADCSV = ADC step voltage VS = ADC voltage supply N = ADC bit resolution Example: If our ADC is connected to a 3.3 V supply and the resolution is 12 bits, then: ADC SV = 3 .3 212 = 0.00080566 Volts per bit 2.3 Nernst signal amplification The recommended circuit for amplifying the sensor Nernst voltage generated across the SENSE connection with respect to the COMMON connection is shown in Figure 2. The circuit provides two buffered and filtered outputs to be sampled by the ADC channels. The key characteristics of the amplifier design are: 1. Good common mode noise rejection. 2. Biased for low frequency operation. The SENSE signal is typically less than 15 Hz. 3. Op amp gain bandwidth product of 10 kHz ideal for low frequency operation. 4. Low input offset voltage ±150 µV maximum. 5. Single ended power supply operation coupled with high power supply rejection ratio (88 dB typical). 6. Ultra low input bias current avoids loading of the SENSE signal. 7. Rail to rail input and output. 8. Low cost surface mount components used, X7R/X5R ceramic capacitors and 1 % tolerance resistors. E / 11163 / B 2/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series Fig. 2: Sensor SENSE signal amplification and filtering with buffered COMMON reference E / 11163 / B 3/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 3. SENSOR PUMP CONTROL This section describes the relationship between the direction of the constant source supplied between the sensor PUMP and COMMON connections and the generated Nernst voltage (see Fig. 3). This simple constant current source uses a very low cost amplifier, X7R/X5R ceramic capacitors and 1 % tolerance resistors. A digital output from the microprocessor connects to the terminal CCS reverse in the schematic. 3.1 Pump current minimum requirements 3.2 Controlling the waveform The minimum options required in software for controlling the direction of the pump current are: To successfully run the sensor the pump current direction needs to alternated at fixed points V1 and V5 as illustrated in Fig. 3. To calculate V1 to V5 refer to Section 4.3. • 40 µA PUMP to COMMON • 40 µA COMMON to PUMP • No pump current (sensor disabled) It is important to have the capability to remove the pump current as this prevents the sensor being operated before the appropriate start routine is applied. The process for controlling the direction of the pump current is described in Fig. 4. When the sensor is first activated the 40 µA PUMP to COMMON must be applied to the sensor (CCS LOW). It should remain in this state until the sampled SENSE voltage reaches the threshold V5. Figure 5 on page 5 shows the recommended hardware to provide a true 40 µA constant current source. This is very important for correct sensor operation. Note the voltage across the cell cannot exceed 1.65 V as excess voltage will damage the sensor ! The pump current direction can now be reversed and 40 µA COMMON to PUMP is applied to the sensor (CCS HIGH). The system should remain in this state until the sampled SENSE voltage reaches the threshold V1. The system will continue to switch between states until the pump current is disabled (Pump idle, CCS high impedance or tri-stated) or power is removed from the microprocessor/system. Pump current +i 3.3 Timeout health check -i Nernst voltage V5 V4 V2 V1 t1 t2 t4 t5 time Fig. 3: Relationship between the applied pump current and the generated Nernst voltage (measured between COMMON and SENSE) E / 11163 / B Pump idle (0) Start Stop V3 Stop A pump current timeout should be introduced as a fault detector. This can help indicate a faulty sensor or a problem with the interface. This can be achieved introducing a timeout of approximately 30 sec. The timeout should be reset at each pump current reversal. When a timeout occurs the stop routine should be implemented (see section 6). SENSE voltage V5 40 µA COMMON to PUMP SENSE voltage V1 Fig. 4: 40 µA PUMP to COMMON Controlling the direction of the pump current 4/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series Fig. 5: Microprocessor controlled constant current source E / 11163 / B 5/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 4. SIGNAL PROCESSING 4.1 Sample frequency For the best possible accuracy a minimum sample frequency of 10 kHz should be implemented in the system. Higher frequencies up to 30 kHz can be used to marginally increase accuracy but the benefits are minimal and not normally required for the majority of applications. 4.2 Timer requirement To sample the amplified SENSE signal correctly a timer is required to be set up to measure t1, t2, t4 and t5. If an interrupt timer is used it is important to make sure a high priority is assigned to the interrupt to prevent inaccurate measurements. The time resolution needed has to be equal to or greater than the chosen sample frequency, although it should be noted that having greater time resolution will yield no extra benefits. Example: If using a 10 kHz sample frequency a time resolution of 0.1 ms will be sufficient. 4.3 Voltage level calculations To calculate the SENSE voltage levels (V1 to V5) correctly a good understanding of the SENSE amplification and the ADC step volts are required. Taking into account all amplification gains (x15 for the recommended circuit) and the common reference voltage (if applicable) the following equation should be used to calculate each threshold in ADC steps: V − VCOMMON Threshold = SENSE ADC SV (2) Threshold = Digital threshold voltage level (ADC steps) VSENSE = Each amplified SENSE voltage, V1 to V5 (SENSE AMP from Fig. 2) V COMMON = COMMON reference voltage (COMMON REF from Fig. 2) ADCSV = ADC volts per step as calculated in (1) The recommended Nernst voltages at the sensor level versus the corresponding ADC thresholds for 12 bit ADCs using the recommended circuit from Figure 2 can be found in Table 1. The system should sample both ADC channels applying the rolling average described in Section 2.4 and Section 8. Every measurement should be VSENSE minus VCOMMON and this result should be compared to the ADC thresholds in Table 1. Threshold V1 V2 V3 V4 V5 Nernst voltage at the sensor 40 mV 45 mV 64 mV 85 mV 90 mV 12 bit ADC threshold (amplified SENSE - COMMON) 745 838 1191 1583 1676 Table 1: Maximum water vapour pressure (WVPMax) 4.4 Signal sampling To illustrate the sampling of the SENSE signal the waveform can be split up into six unique steps. The following steps describe the process and operations required. Individually each step has it own process to perform in order to obtain the timing values (t1, t2, t4 and t5) required to calculate td and subsequently %O2. Idle state Current direction: No Pump Current In idle state the system should not be trying to sample the SENSE signal. Once the sensor pump current is activated the system should begin at Step 1: Peak detection. The pump current should always initialise in the state 40 µA PUMP to COMMON. The calculated thresholds in ADC steps can be saved in a lookup table for system reference. E / 11163 / B 6/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series Step 1: Peak detection Current direction: 40 µA PUMP to COMMON → 40 µA COMMON to PUMP Step 3 : t5 Current direction: 40 µA COMMON to PUMP voltage V5 V4 voltage V5 V4 V3 V3 V2 V1 V2 V1 t1 t2 t4 t2 t4 t5 time time In this section the system should be looking to detect the first peak when the sampled SENSE voltage is ≥ V5. When this occurs the pump current should be reversed as described above. Once the sampled SENSE voltage is ≤ V4, Step 2: t4 is activated. Step 2 : t4 Current direction: t1 t5 When entering this section the timer should be reset. This is done when the sampled SENSE voltage is ≤ V3. Once the sampled SENSE voltage is ≤ V2, the results from the timer can be stored as t5. Step 4: Trough detection is now activated. Step 4 : Trough detection Current direction: 40 µA COMMON to PUMP → 40 µA PUMP to COMMON 40 µA COMMON to PUMP voltage V5 V4 voltage V5 V4 V3 V3 V2 V1 V2 V1 t1 t2 t4 t2 t4 t5 time t5 time When entering this section the timer should be initialised/reset. This is done when the sampled SENSE voltage is ≤ V4. Once the sampled SENSE voltage is ≤ V3, the results from the timer can be stored as t4. Step 3: t5 is now activated. E / 11163 / B t1 In this section the system should be looking to detect the waveform trough when the sampled SENSE voltage is ≤ V1. When this occurs the pump current should be reversed as described above. Once the sampled SENSE voltage is ≥ V2 , Step 5: t1 is activated. 7/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series Step 5 : t1 Current direction: 40 µA PUMP to COMMON voltage V5 V4 V3 V2 V1 t1 t2 t4 t5 time When entering this section the timer should be reset. This is done when the sampled SENSE voltage is ≥ V2. Once the sampled SENSE voltage is ≥ V3, the results from the timer can be stored as t1. Step 6: t2 is now activated. Step 6 : t2 Current direction: 40 µA PUMP to COMMON voltage V5 V4 V3 V2 V1 t1 t2 t4 t5 time When entering this section the timer should be reset. This is done when the sampled SENSE voltage is ≥ V3. Once the sampled SENSE voltage is ≥ V4, the results from the timer can be stored as t2. Step 1: Peak detection is now activated and the continuous loop begins again. E / 11163 / B 8/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 5. START ROUTINE 6. STOP ROUTINE The start routine is required every time the sensor is switched off or power cycled. This helps prevent irreversible damage to the oxygen sensor which can occur if the sensor is pumped when the zirconium dioxide sensing cell is cold. Some applications may require the sensor to be stopped during operation for safety, maintenance or for energy efficiency reasons. On system initialisation it is important to make sure the pump current and signal processing are deactivated. The first process should be to deactivate the pump current and signal processing. Minimal delay should be present between each process shutdown. The heater may then be turned off. 6.1 Stop routine description 5.1 Start routine description The first process should be to make sure the heater is enabled to heat up the sensor. After the heater is applied the system should then begin a warm up delay period with a minimum of 60 sec. On delay completion the pump current and signal processing can be activated to allow the sensor to begin its pump cycle. The system cool down delay is a optional process depending on the application requirements. If used a minimum of three minutes should be applied. It may be necessary for a longer delay to be implemented to allow the application to fully cool down before the sensor heater is turned off. The delay should be determined by the application and it’s purpose is to prevent condensation forming on the sensor in humid environments during the shutdown process. The following stop routine should be applied to shutdown the sensor operation correctly. Start of start routine Start of stop routine Enable heater Deactivate pump current Start 60 sec. delay Deactivate signal process Start system cooldown delay Delay completed? No Delay completed? Yes Activate pump current No Yes Activate signal process Disable heater End of start routine End of stop routine Fig. 6: Start routine E / 11163 / B Fig. 7: Stop routine 9/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 7. CALCULATIONS The calculations needed to calculate td and for diagnostics are not time dependant and can be managed during the processors free time. tp is time dependant and will need to be calculated using a timer which is reset at each peak or trough detection. The frequency of the signal can also be calculated using Equation (4). tp should be non zero before this calculation is made. Freq = 1 tp (4) 7.3 Asymmetry The equation for calculating the sampled SENSE voltage asymmetry is displayed in Equation (5): 7.1 td The following equation is used to calculate td: t d = (t1 − t 2 ) + (t 5 − t 4 ) Asymmetry = (3) The time values (t1, t2, t4 and t5) are obtained during the signal processing routine. Therefore td only needs to recalculated after every new t value. It is recommended td is put into a rolling average filter to reduce noise and stabilise the td output. We recommend a buffer size of between 4 to 400. This value is very application dependant with a small buffer size best for fast sensor response and a large buffer size optimal for output stability. Therefore the maximum buffer size is ideal for systems with slowly drifting O2 levels and the minimum buffer size is ideal for applications with rapidly changing O2 levels. For a balance between response and stability a buffer size of 100 is ideal. For applications where both response and stability are critical an adaptive filtering method may be used. This can be achieved by monitoring the variance in each new recorded td value and when the variance exceeds a predetermined level the buffer is flushed and the buffer size reduced to its minimum value. When the td values begin to stabilise again the buffer size can be gradually increased until it reaches its maximum value. 7.2 tp (t1 + t 2 ) (t 5 + t 4 ) (5) Asymmetry need only be recalculated on each new t value at the same time as td. To help avoid divide by zero fault conditions during the start-up cycle it is good practice to only calculate asymmetry if t4 or t5 are not equal to zero. The asymmetry value should also be placed into a rolling average filter to reduce noise and add stability. A buffer size of 10 to 100 is recommended. 7.4 O2 To transform the calculated and buffered td values into the corresponding O2% in the atmosphere a calibration scalar (CS) is required (see Section 9). The O2% value can then be obtained using Equation (6): O 2 (%) = t d (Ave ) × CS (6) It should be noted that this is an averaged O2 value as the buffered td value is used in the calculation. If an instantaneous O2 value is required then td (Ave) can be replaced with each newly calculated td. This is often referred to td raw and the calculated oxygen level as O2% raw. If using a barometric pressure sensor to compensate for pressure changes please refer to Section 3.5 of application note AN_XYA-O2_E_11154 for guidance. The tp calculation can be made by measuring the period of the sampled SENSE voltage waveform. The recommended way to perform this calculation is to measure the time between the waveform peak to peak as this generally more repeatable than measuring the time between the trough to trough. E / 11163 / B 10/11 www.first-sensor.com www.sensortechnics.com Designing interface electronics for zirconium dioxide oxygen sensors of the XYA series 8. ROLLING AVERAGE FILTER 9. CALIBRATION CONSIDERATIONS 8.1 Filter principle To calculate the calibration scalar used in Section 7.4, the following equation should be used: A basic rolling average filter is defined as the sum of all the last N number of data points divided by the number of results: Average = x1 + x 2 + ... + x N−1 + x N N (7) Where: N = Buffer size x = Data This simple filter is extremely useful in reducing noise in a signal or system. It can also be quickly implemented into a system to improve the stability of sampled signals. 8.2 Processor Overhead In some applications this approach can be problematic depending on the platform and compiler. The process of division can take a large amount of processing power and therefore time. As the measurement of oxygen in this system is very time dependant all efforts should be made to avoid any unnecessary overheads.One option to reduce the overhead is by replacing the intensive division calculations present in the averaging filters, with a less intensive process. CS = O 2 (%) t d (Ave ) (9) Where: CS = Calibration scalar O2(%) = Known O2 % in the calibration environment td (Ave) = Average td value Before a calibration process it is vital to make sure the sensor output is stable and the environment only comprises of the calibration gas. It is for these reasons that the sensor is normally calibrated in normal air to 20.7 %O2 and the sensor is given 10 min. after powering the heater before proceeding with calibration. If the heater has been on for more than ten minutes then the sensor only requires 5 min. in the calibration gas before a calibration can proceed. If a calibration gas of another known oxygen concentration is available then this may be used by replacing O2 (%) in the equation above. A division of two can be easily implemented by shifting the value right by one. Example: Binary 00001000 which equals decimal value 8 becomes Binary 00000100 which equals decimal value 4. Using this principle we can carefully select N such that it equates to 2 to the power of y : (8) N = 2y Where: N = Chosen buffer size y = Number of places to shift to the right It is recommended N should be between 16 and 32, when the ADC is sampled at 10 kHz. E / 11163 / B 11/11 www.first-sensor.com www.sensortechnics.com