Microchip Technology

user Occupation hasn't been added


  • ATtiny104 Xplained Nano Based CO2 Gas Sensor

  • Created: May 14, 2017

    • view21
    • comment0
    • bookmark0
    • fork0


No description available.


This reference design features a carbon dioxide (CO2) sensor that utilizes the ATtiny104 Xplained Nano and MG811 sensor. The ATtiny104 Xplained Nano is an evaluation board that can be used to evaluate the ATtiny104 microcontroller. The board consists of two main components, the target microcontroller ATtiny104 and ATmega32U4. The ATmega32U4 is a composite USB device of two interfaces; a debugger and a virtual COM port. The debugger interface of ATmega32U4 is used to program the ATtiny104 while the virtual COM port which is connected to the UART of the ATtiny104 provides an easy way to communicate with the target microcontroller through terminal software.

The design uses the MG811 device for sensing CO2 gas. MG811 is an electrochemical sensor that is very sensitive to CO2 but less responsive to alcohol and carbon monoxide. As shown in the circuit, the sensor requires 6V for heating so that it could operate at its best performance. Since the power supply input for this circuit is 5V, the GS1662 step-up DC-DC converter converts the 5V DC voltage to 6V. The heating process requires 1.2W of power. So make sure that the power supply input for the circuit must be able to supply at least 500mA. The opamp amplifies the output signal of the sensor. The amplified signal is sent to the PA0 pin of the ATtiny104. The PA0 pin is connected to the first channel of ATtiny104 internal ADC. The ADC converts the analog voltage from the opamp into digital. The data can be logged to a PC using the virtual COM port or can be used as a reference for controlling external hardware. The ATtiny104 still have unused GPIO pins that can be used to control other devices based on the CO2 sensor reading.

Since the design is targeted for data logging, the ATtiny104 Xplained Nano board power supply is taken from the USB port while a separate 5V must be provided for the sensor. Make sure that the ground of the sensor's circuit is connected to the ground pin of the ATtiny104 Xplained Nano board. This CO2 sensor can be used in applications such as air quality control, ferment process control, or room temperature CO2 concentration detection.