Skip to content

A simple set of CircuitPython test programs to read the ZE15-CO sensor from Winsen.

License

Notifications You must be signed in to change notification settings

ageagainstthemachine/ZE15-CO-CircuitPython-Test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZE15-CO Sensor Tests (CircuitPython)

Overview

This repository contains CircuitPython scripts (programs) for testing the Winsen ZE15-CO carbon monoxide sensor using UART communication on a Raspberry Pi Pico.

Currently included:

Datasheet: ZE15-CO Official Datasheet


Hardware Setup

  • Sensor TX - Pico GP1 (RX)
  • Sensor RX - Pico GP0 (TX)
  • Sensor GND - Pico GND
  • Sensor VCC - Pico 5V

UART Communication Protocol

The ZE15-CO sensor communicates using a UART (serial) interface at:

  • Baud Rate: 9600
  • Data Bits: 8
  • Stop Bits: 1
  • Parity: None

It supports two communication modes: Initiative Upload Mode and Q&A Mode.

Initiative Upload Mode (Default)

  • The sensor automatically sends a 9-byte data packet every 1 second.
  • No commands are needed from the microcontroller.
  • Each packet contains the CO concentration value in ppm.

Initiative Upload Mode Data Packet Format (9 bytes per packet)

Byte0   Byte1   Byte2   Byte3   Byte4   Byte5   Byte6   Byte7   Byte8
0xFF    0x04    0x03    0x01    [HIGH]  [LOW]   0x13    0x88    [CHK]
Byte Description
0xFF Start byte
0x04 Gas type (CO)
0x03 Unit (ppm)
0x01 Number of decimal places (fixed at 0.1 ppm)
[HIGH] CO Concentration High Byte
[LOW] CO Concentration Low Byte
0x13 Full range high byte (fixed)
0x88 Full range low byte (fixed)
[CHK] Checksum

CO Concentration Formula:
CO ppm = (HIGH * 256 + LOW) * 0.1

Example:

Received Data: ['0xFF', '0x04', '0x03', '0x01', '0x00', '0x05', '0x13', '0x88', '0x58']
  • HIGH = 0x00 (0 in decimal)
  • LOW = 0x05 (5 in decimal)
  • CO ppm = (0 * 256 + 5) * 0.1 = 0.5 ppm

Question & Answer (Q&A) Mode

  • The microcontroller sends a command request to the sensor.
  • The sensor responds with a CO concentration reading.

Q&A Mode Request Data Packet Format (9 bytes)

0xFF  0x01  0x86  0x00  0x00  0x00  0x00  0x00  [CHK]

Q&A Mode Response Data Packet Format (9 bytes)

0xFF  0x86  [HIGH]  [LOW]  0x00  0x00  [HIGH]  [LOW]  [CHK]

Usage

  1. Install CircuitPython on the Raspberry Pi Pico. (Guide)
  2. Copy code.py to the Pico.
  3. Open a serial terminal (Mu Editor, Thonny, or screen).
  4. View CO ppm readings which update every second.

About

A simple set of CircuitPython test programs to read the ZE15-CO sensor from Winsen.

Topics

Resources

License

Stars

Watchers

Forks

Languages