Environment X6 Sensor

From Waveshare Wiki
Jump to: navigation, search
Environment X6 Sensor
Environment X6 Sensor

Environmental Sensor, UART
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

The Environment X6 Sensor is based on German EC Sense solid-state polymer electrochemical technology. It adopts a multi-electrode integrated structure and solid-state electrolyte system. The gas undergoes an electrochemical reaction on the working electrode surface to output a current signal, enabling high-sensitivity detection of target gas concentrations. Compared to traditional gas sensors, the solid-state polymer design offers advantages such as no liquid leakage, no poisoning, essentially no drift, and long service life.

Application Scenarios

  • Smart home
  • Ambient air quality monitoring
  • Car air purifier
  • Handheld air quality monitor
  • Factory workshop fresh air system

Operating Principle

The internal structure of the solid-state polymer electrochemical sensor adopts a classic three-electrode architecture (Working Electrode WE, Reference Electrode RE, Counter Electrode CE). Through multi-layer printing process technology, the design incorporates multiple catalytic active sites on a single electrode, a diffusion control layer, and intelligent signal decoupling algorithms, enabling parallel detection and identification of various gases.

Specifications

Environment X6 Sensor
Supply voltage 5V Logic voltage 3.3V
Communication Interface UART Communication Baud Rate 9600 bps
Measurement Range HCHO: 0~1 ppm
TVOC: 0~5 ppm
CO: 0~100 ppm
Resolution HCHO: 0.001 ppm (Effective detection value: 0.015 ppm)
TVOC: 0.001 ppm (Effective detection value: 0.050 ppm)
CO: 0.001 ppm (Effective detection value: <8 ppm)
Accuracy Error HCHO: 0~0.15 ppm (±0.02 ppm); 0.16 ppm+ (< ±2% FS)
TVOC: 0~0.2 ppm (±0.05 ppm); 0.2 ppm+ (< ±2% FS)
CO: 0~8 ppm (±2.5 ppm); 8 ppm+ (< ±1% FS)
Response Time HCHO: T10 <5 s; T90 <90 s (gas injection measurement)
TVOC: T10 <3 s; T90 <120 s (isobutylene gas injection measurement)
CO: T10 <3 s; T90 <15 s (gas injection measurement)
Product dimensions 23×25.5×9.5 mm Mounting hole diameter 2.0 mm
Operating Current 6.5 mA Operating Temperature -40 ℃ ~ +55 ℃
Operating Humidity >15%RH Service Life 10 years

  • The IO level of the sensor is 3.3V. If a 5V IO level is used, level conversion is required, otherwise the sensor will be damaged

Pinout Definition

Pin No. Identifier Pin Description
1 VCC 5V power positive
2 GND Ground
3 RXD UART input
4 TXD UART output

Protocol Parsing

UART Communication Process

  • The default configuration of the serial port is: 8-bit data bit, 1-bit stop bit, no parity check, no flow control, and the default baud rate is 9600.
  • The protocol consists of a command header, Data, and 0-add8 (checksum).

Note: The protocol packet follows big-endian format, i.e., high byte first, low byte last.

Command Introduction

  • Gas Concentration Units
0x00:IAQ
0x02:ppm
IAQ Value Explanation, based on EPA standards
0~50 Good
51~100 Moderate
101~150 Unhealthy for Sensitive Groups
151~200 Unhealthy
201~300 Very Unhealthy
301~500 Hazardous
  • Sensor Type Table
IAQ:0x33
TVOC:0x18
HCHO:0x17
CO:0x19
  • Query Current Concentration
    • The command format to read the current concentration is as follows:
Command Header Checksum
Byte0 Byte1
70 0-add8
  • Query data decoding
    • After sending the query current concentration command, the module will return the following data:
Command Header IAQ Data TVOC Data HCHO Data CO Data Temperature Data Humidity Data Checksum
Byte0 Byte1-Byte4 Byte5-Byte8 Byte9-Byte12 Byte13-Byte16 Byte17-Byte18 Byte19-Byte20 Byte21
70 42 30 00 00 3D 35 64 F0 3D 53 D2 5B 3D 08 19 55 0A C8 27 0F E0
  • Parsing Table
Send Parsing:
0x70----------------------Command header
0x90----------------------Checksum
Receive Parsing:
0x70----------------------Command header
0x42 0x30 0x00 0x00---------0x42300000 IAQ detected gas concentration value, converted to float: 44.000f
0x3D 0x35 0x64 0xF0---------0x3D3564F0 TVOC detected gas concentration value, converted to float: 0.044f
0x3D 0x53 0xD2 0x5B---------0x3D53D25B HCHO detected gas concentration value, converted to float: 0.052f
0x3D 0x08 0x19 0x55---------0x3D081955 CO detected gas concentration value, converted to float: 0.033f
0x0A 0xC8-----------------0x0AC8 = 2760, two decimal places, temperature: 27.6 ℃
0x27 0x0F-----------------0x270F = 9999, two decimal places, humidity: 99.99% rh
0xE0----------------------Checksum
  • Read Sensor Parameters
    • The command format to read sensor parameters is as follows:
Command Header Gas ID Checksum
Byte0 Byte1 Byte2
72 00 0-add8
  • Query data decoding
    • After sending the read sensor parameters command, the module returns the following data:
Command Header Gas ID Gas Name Range Unit Checksum
Byte0 Byte1 Byte2 Byte3-Byte4 Byte5 Byte6
72 00 19 03 E8 02 87
  • Parsing Table
Send Parsing:
0x72----------------------Command header 

0x00----------------------IAQ
0x01----------------------TVOC
0x02----------------------HCHO
0x03----------------------CO

0x8D----------------------Checksum

Receive Parsing:
0x72----------------------Command header
0x00----------------------IAQ
0x33----------------------Detected gas name
0x03 0xE8-----------------0x01F4 = 500, Range: 500
0x00----------------------Concentration unit, derived from the [Gas Concentration Unit Table]: IAQ
0x87----------------------Checksum
  • Read LED Status
    • The command format to read the LED status is as follows:
Command Header Checksum
Byte0 Byte1
74 0-add8
  • Query Data Decoding
    • After sending the read LED status command, the module returns the following data:
Command Header LED Status Checksum
Byte0 Byte1 Byte2
74 01 8B
  • Parsing Table
Send Parsing:
0x74----------------------Command header
0x8C----------------------Checksum

Receive Parsing:
0x74----------------------Command header
0x01----------------------LED blinking status (0x00: off, others: blinking)
0x8B----------------------Checksum
  • Set Operation LED Status
    • Downlink Command (Tx) Format:
Command Header LED Control Checksum
Byte0 Byte1 Byte2
56 00 0-add8
    • Uplink Data (Rx) Format:
Command Header Reserved Return Value Checksum
Byte0 Byte1 Byte2-Byte3 Byte4
56 00 4F 4B 10
  • Parsing Table
Send Parsing:
0x56----------------------Command header
0x00----------------------Turn off the operation LED
0xAA----------------------Checksum

Receive Parsing:
0x56----------------------Command header
0x00----------------------Reserved
0x4F 0x4B--------------Setting successful
0x10----------------------Checksum
  • Enter Sleep Mode
    • The command format to enter sleep mode is as follows:
Command Header Sleep Command Checksum
Byte0 Byte1-Byte5 Byte6
54 73 6C 65 65 70 0-add8
  • Query Data Decoding
Command Header Reserved Return Value Checksum
Byte0 Byte1 Byte2-Byte3 Byte4
54 00 4F 4B 12
  • Parsing Table
Send Parsing:
0x54----------------------Command header
0x73 0x6C 0x65 0x65 0x70----ASCII: sleep
0x93----------------------Checksum

Receive Parsing:
0x54----------------------Command header
0x00----------------------Reserved
0x4F 0x4B--------------Execution successful
0x12----------------------Checksum
  • Exit Sleep Mode
Command Header Wake Command Checksum
Byte0 Byte1-Byte5 Byte6
55 61 77 61 6B 65 0-add8
  • Query Data Decoding
Command Header Reserved Return Value Checksum
Byte0 Byte1 Byte2-Byte3 Byte4
55 00 4F 4B 11
  • Parsing Table
Send Parsing:
0x55----------------------Command header
0x61 0x77 0x61 0x6B 0x65----ASCII: awake
0xA2----------------------Checksum

Receive Parsing:
0x55----------------------Command header
0x00----------------------Reserved
0x4F 0x4B--------------Execution successful
0x11----------------------Checksum
  • Get Sensor Serial Number
Command Header Checksum
Byte0 Byte1
71 0-add8
  • Query Data Decoding
Command Header Sensor SN Checksum
Byte0 Byte1-Byte6 Byte7
71 12 34 56 78 91 23 C7
  • Parsing Table
Send Parsing:
0x71----------------------Command header
0x8F----------------------Checksum

Receive Parsing:
0x71----------------------Command header
0x12 0x34 0x56 0x78 0x91 0x23---Sensor serial number: 123456789123
0xC7----------------------Checksum
  • Get Software Version
Command Header Checksum
Byte0 Byte1
73 0-add8
  • Query Data Decoding
Command Header Firmware Version Checksum
Byte0 Byte1-Byte19 Byte20
73 69 4E 6F 73 65 58 36 32 30 32 35 31 31 31 32 31 34 33 39 A2
  • Parsing Table
Send Parsing:
0x73----------------------Command header
0x8D----------------------Checksum

Receive Parsing:
0x73----------------------Command header
0x69 0x4E 0x6F 0x73 0x65 0x58 0x36 0x32 0x30 0x32 0x35 0x31 0x31 0x31 0x32 0x31 0x34 0x33 0x39
Converted to ASCII:
iNoseX6202511121439
0xA2----------------------Checksum

Quick Test

  • Hardware Connection
Environment-X6-Sensor-details-10.jpg
  • Start Test
    • Connect the serial port to the USB port of the computer
      • Use a serial debug assistant (SSCOM), select the correct port number, baud rate 9600, open the serial port, and set the checksum to 0-add8
      • Send the command in hexadecimal: 70, then you can read the data:

①Send query command
②Obtain real-time data

Env x6 usb ttl.jpg

Dimensions

  • Environment-X6-Sensor-size.jpg

Working with Raspberry Pi

  • For the installation and use of the Raspberry Pi system, you can refer to this link.
  • After successful boot, configure the Raspberry Pi environment

Download Demo

sudo apt install gpiod libgpiod-dev
cd ~
git clone https://github.com/waveshareteam/Environment-X6-Sensor
cd Environment-X6-Sensor/examples/raspberrypi

UART Demo

Enable Raspberry Pi UART

  • Enter the command in the Raspberry Pi terminal: sudo raspi-config nonint do_serial 2
  • Select NO in the first pop-up window, YES in the second one, and OK for the final one.

Hardware Connection

  • Refer to the following diagram for connection:

Environment-X6-Sensor-details-5.jpg

Run C Demo

cd ~/environment-x6-sensor/examples/raspberrypi/c/
make
./main

Run Python Demo

cd ~/environment-x6-sensor/examples/raspberrypi/python/example
python main.py

Working with ESP32S3

  • After setting up the environment, you can connect the sensor and download the Demo

Hardware Connection

  • Refer to the following diagram for connection:

Environment-X6-Sensor-details-6.jpg

Arduino esp32 Demos Usage

  • Navigate to Environment-X6-Sensor\examples\esp32s3\arduino\environment_x6_sensor_test and double-click the environment_x6_sensor_test.ino file
  • Select the development board:

TOF Laser Range Sensor C 19.png

  • Select the port of the ESP32S3, and then compile and upload it
  • After the upload is completed, open the serial port monitor, and the relevant information will be output

ESP-IDF Demos Usage

  • Navigate to Environment-X6-Sensor\examples\esp32s3\esp-idf and open this path with VS Code
  • Select the development board:

Env x6 esp idf config.jpg

  • Select the port of the ESP32S3, and then compile and upload it
  • After the upload is completed, open the serial port monitor, and the relevant information will be output

Micropython Demos Usage

  • Navigate to Environment-X6-Sensor\examples\esp32s3\Micropython and double-click the environment_x6_sensor_test.py file
  • Set the chip model to esp32, and select the appropriate port:

Env x6 esp mpy config.jpg

  • Select the port of the ESP32S3, and then run the demo
  • The shell will output the relevant information

Working with Raspberry Pi Pico

  • For setting up the Raspberrypi Pico environment and basic usage, please refer to the following links:
  • After setting up the environment, you can connect the sensor and download the Demo

Hardware Connection

  • Refer to the following diagram for connection:

Environment-X6-Sensor-details-7.jpg

Arduino Pico Demo Usage

  • Navigate to Environment-X6-Sensor\examples\pico\arduino\environment_x6_sensor_test and double-click the environment_x6_sensor_test.ino file to open the project
  • Select the chip model and port:

Env x6 pico arduino.jpg

  • After the upload is completed, open the serial port monitor, and the relevant information will be output

Micropython Demos Usage

  • First flash MicroPython firmware to Raspberry Pi Pico
  • Navigate to Environment-X6-Sensor\examples\pico\micropython and double-click the environment_x6_sensor_test.py file
  • Select the development board:

Env x6 pico mpy config.jpg

  • Select the port of Raspberry Pi Pico, and then run the demo
  • The shell will output the relevant information

Working with Arduino

  • The IO level of the Arduino development board must be 3.3V. If a 5V IO level is used, level conversion is required, otherwise the sensor will be damaged
  • To use waveshare R3/R4, you need to set the following jumper cap to 3.3V before you can use it
  • For Arduino environment setup and basic usage, please refer to this R4 link, R3 is installed by default.
  • After setting up the environment, you can connect the sensor and download the Demo

Arduino Demos

Hardware Connection

  • Refer to the following diagram for connection:

Run Demo

  • Navigate to Environment-X6-Sensor\examples\arduino\environment_x6_sensor_test and double-click the environment_x6_sensor_test.ino file
  • Select the development board:
  • Select the port of the development board, and then compile and upload it
  • After the upload is completed, open the serial port monitor, and the relevant information will be output

API Introduction

  • environment_x6_init(): Environment X6 Sensor initialization
  • environment_x6_get_concentration(): Get real-time concentration values
  • environment_x6_get_sensor_param(): Get sensor parameters, including measurement range and units
  • environment_x6_get_led(): Get LED status (on/off)
  • environment_x6_set_led(): Set LED status
  • environment_x6_sleep(): Put the sensor to sleep
  • environment_x6_wakeup(): Wake up the sensor
  • environment_x6_get_serial(): Get the serial number (SN)
  • environment_x6_get_version(): Get the version number

Effect Demonstration

  • Default output displays real-time concentration. To use other examples, set the corresponding example value to 1:
  • Arduino

Env x6 uno.jpg

  • Micropython

Env x6 pico mpy.jpg

  • RPI

Env x6 rpi c.jpg

Resources

Demo

Software

FAQ

Q1. Is the baud rate fixed at 9600?

Yes, currently the default is 9600 baud rate 

Support




Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)