2 Replies Latest reply on Feb 28, 2019 9:26 PM by rsiva

    PSoC 4 Pioneer Kit Community Project#087 – Gas Sensor Example




      In today’s example we are showcasing a simple carbon monoxide (CO) gas sensor monitor using the Pioneer board. The Figaro TSG 5042 gas sensor is used in this example to detect a range of 0-10,000 ppm.


      001 - Schematic Design.png


      Forum Post Attachments:


      At the bottom of this post we are including the following items:

      • Example Project Zip File
      • Project Images
      • Gas Sensor Datasheet


      Components Used: 


      The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:

      • Opamp (x2)
      • SAR ADC
      • UART
      • CyPins


      Firmware Description:


      The main.c firmware is included in the example project. Please review the commented sections for more details.


      In this design the sensor will, when detecting the chemical, produce a very small electric current which needs to be converted to a output voltage by an op-amp/resistor combination. To accomplish this our example project uses an op-amp with a feedback resistor for the sensor current to voltage conversion. This is effectively a Trans-Impedance Amplifier (TIA).


      002 - Sensor Layout.png


      In the project we will use a reference voltage for the op-amp and an ADC to read in the output voltage from the TIA.


      After the voltage has been sampled the value will be sent out over the UART to be displayed using a hyperterminal software.


      In the schematic layout there are a couple of items that may need to be defined:


      TIA_Reference: The SAR ADC internal reference of 1.024V bypassed to the port P1.7 is connected to the opamp_buffer input P1.5


      Gas_sensor_ground: The buffered output of the TIA_reference. The negative terminal of the gas sensor is connected to this terminal which is fed io the non-inverting input of the TIA opamp.


      Gas_sensor_sense: The gas sensor positive input is connected to the negative input of the TIA opamp. The feedback resistor of 500k is connected between the inverting output and the output of the opamp, TIA_output.


      In the video below we have output the values to an LCD shield.


      Hardware Connections:


      You will need to connect a couple of items for this example. First you will need to connect the bypass resistor (R1 503k ohms) and capacitor (C1 22uF).


      Next connect the UART P4.1 pin to the P12.6 pin on the PSoC 5LP header.


      Test Your Project:


      Connect the hardware to the Pioneer board including capacitor, resistor and sensor. Next connect the UART bridge to the PSoC 4 board. Launch the hyperterminal software to view the data received from the Pioneer board.


      In the video below you see the example project being used to calculate carbon monoxide out the back of a motor cycle pipe. Careful, the video is a little loud and suffers from a mild case of motorcycle adrenaline shaky cam.



      I hope this example can help you in your design.




        • Re: PSoC 4 Pioneer Kit Community Project#087 – Gas Sensor Example

          Hello Matt.

          Thanks for this project.

          The PSoC 4200 has a pair of low-power comparators, which can also operate in the Deep Sleep and Hibernate modes. This allows the analog system blocks to be disabled while retaining the ability to monitor external voltage levels during low-power modes. The comparator outputs are normally synchronized to avoid metastability unless operating in an asynchronous power mode (Hibernate) where the system wake-up circuit is activated by a comparator switch event.

          Best regards,


          Jesus Antonio.

          • Re: PSoC 4 Pioneer Kit Community Project#087 – Gas Sensor Example


                          Very interesting project. Could you pl explain the TIA reference and the opamp with the direct negative feedback loop in your diagram above.

            It is not very clear to me. The manufacturer's sensor sheet diagram shows that the + terminal of the 2nd opamp at the bottom of your picture is to be connected to the sensor ground. But you seem to have connected the sensor ground to the first opamp's output at what voltage ?.

            If you can explain, it will be great.




            Siva R


            PS: Also did you do any calibration for temperature sensitivity of measured CO levels (-20 to 70 C) in the code.