Wiki

The most recent version of this page is a draft.DiffThis version is outdated by a newer approved version.DiffThis version (31 Oct 2016 15:21) was approved by Veronica Lupei.

This is an old revision of the document!


4 – Wire Electrochemical Dual Toxic Gas Demo

The ADuCM360_demo_cn0396 is a dual toxic gas detector demo project, for the EVAL-ADICUP360 base board with additional EVAL-CN0396-ARDZ shield, created using the GNU ARM Eclipse Plug-ins in Eclipse environment.


General description


The ADuCM360_demo_cn0396 project uses the EVAL-CN0396-ARDZ shield which is a single-supply, low noise, portable gas detector, using a 4-electrode electrochemical sensor, for simultaneous detection of two distinct gases - for this example is used the Alphasense COH-A2 sensor, which detects carbon monoxide(CO) and hydrogen sulfide(H2S).

The EVAL-CN0396-ARDZ board provides a potentiostatic circuit for biasing the electrochemical sensor, along with dual programmable TIA's and 16-bit Sigma-Delta ADC. The TIA's convert the small currents passing in the sensor to a voltage that can be read by the AD7798 a 3-channel, low noise, low power 16-bit ADC that converts the analog voltage into digital data. The 16-bit ADC outputs are received via SPI interface of the EVAL-ADICUP360 board. An ADT7310 digital temperature sensor is also included to measure ambient temperature in order for correction of temperature effects.

The ADuCM360_demo_cn0396 application reads temperature value from ADT7310 and ADC values for each gas channel (CO and H2S), processes the values and make all necessary conversions in order to provide the gas concentrations. A UART interface (115200 baud rate and 8-bits data length) is used to send the results to terminal window. The output data will be displayed continuously considering a data refresh parameter (see DISPLAY_REFRESH).

Based on the maximum sensor sensitivity for each gas the system should be configured before using it. The application will calculate the gas concentration using sensor gas sensitivity and then compensate these values using measured temperature value.

Maximum sensitivity and gas sensitivity are dependent on sensor type. These value will need to be updated in case of using another sensor that the one presented here.


Setting up the hardware


Connect the EVAL-CN0396-ARDZ to the Arduino connectors P4, P5, P6, P7, P8 of the EVAL-ADICUP360 board.

Extremely important to plug in an acceptable power supply to the barrel jack P11 to supply power for the EVAL-CN0396-ARDZ. The boards will not work if you try only to power it from the DEBUG_USB or the USER_USB.

In order to program the base board you need to use the DEBUG USB, and you will need to use the USER USB to communicate with the serial terminal program. The important jumpers and switches configurations are highlighted in red.


The ADuCM360_demo_cn0396 uses UART connection via P0.6/P0.7 and SPI1 channel of the ADuCM360 to communicate with EVAL-CN0396-ARDZ board. The CS1 for AD7798 is configured on P0.3, the CS2 for AD5270 is configured on P1.4 and the CS3 for ADT7310 on P1.2. See jumper setup in the picture below:



Obtaining the source code


We recommend not opening the project directly, but rather import it into Eclipse and make a local copy in your Eclipse workspace.

The source code and include files of the ADuCM360_demo_cn0396 can be found on Github:


Importing the ADuCM360_demo_cn0396 project


The necessary instructions on how to import the ADuCM360_demo_cn0396 project form the projects examples in the Git repository, can be found in How to import existing projects from the GIT Repository page.


Debugging the ADuCM360_demo_cn0396 project


  • A debug configuration must be set up for this project in order to have the possibility to program and to debug the ADuCM360_demo_cn0396 project. To do this, follow the instructions from Setting up a Debug Configuration Page.
  • Make sure the target board is connected to the computer (via DEBUG USB) and using the tool bar, navigate to the small Debug icon and select the debugging session you created. The application will programmed and the program execution will stop at the beginning of the main() function.

  • Use step-by-step execution or directly run the program.

After completion of the steps above the program will remain written into the system flash and it will run by default every time the board is powered up.


Project structure


The ADuCM360_demo_cn0396 is a C project which uses ADuCM36x C/C++ Project structure.

This project contains: system initialization part - disabling watchdog, setting system clock, enabling clock for peripherals; port configuration for SPI1, UART via P0.6/P0.7; SPI, UART read/write functions, AD7798 control, AD5270 and ADT7310 control; gas concentration computation.

In the src and include folders you will find the source and header files related to CN0396 software application. The Communication.c/h files contain SPI and UART specific data, the AD7798.c/h files contain the ADC control, the AD5270.c/h files contain the rheostat control, the ADT73100.c/h files contain the temperature sensor control, and the CN0396.c/h files are for the gas calculations.


In the appropriate header files you can configure next parameters:

  • Sensor Range - CO_RANGE & H2S_RANGE - maximum value of the gas concentration (ppm) that can be detected by each of the electrodes of the electrochemical gas sensor being used (CN0396.h).
    #define CO_RANGE   1000
    #define H2S_RANGE  200
  • Sensor Gas Sensitivity - CO_SENS & H2S_SENS - sensitivity (nA/ppm) of each of the 2 electrodes of the electrochemical sensor being used (CN0396.h).
    #define CO_SENS    (75 * pow(10, -9)) 
    #define H2S_SENS   (800 * pow(10, -9)) 
  • Maximum Sensor Gas Sensitivity - MAX_CO_SENS & MAX_H2S_SENS - sensitivity (nA/ppm) of each of the 2 electrodes of the electrochemical sensor being used (CN0396.h).
    #define MAX_CO_SENS  (100 * pow(10, -9)) 
    #define MAX_H2S_SENS (1000 * pow(10, -9))

* Terminal refresh - DISPLAY_REFRESH parameter - how often to refresh the output data - input time value in [msec] (CN0396.h).

    #define DISPLAY_REFRESH        500


The system folder contains system related files (try not to change these files):

  • ADuCM360 – contains low levels drivers for ADuCM360 microcontroller.
  • CMSIS – contains files related to ADuCM360 platform, such as: ADuCM360.h (registers definitions), system_ADuCM360.c/h (system clock), vectors_ADuCM360.c (interrupt vector table).
  • cortexm – contains files for system management (start-up, reset, exception handler).


Navigation - EVAL-ADICUP360

resources/eval/user-guides/eval-adicup360/reference_designs/demo_cn0396.1477923705.txt.gz · Last modified: 31 Oct 2016 15:21 by Veronica Lupei