General Arduino

Is data coming from SEN0231 linear?

userHead Cha.Vi 2026-07-01 21:40:59 51 Views1 Replies

Hi team,

 

I have an SEN0231 formaldehyde sensor connected to a Raspberry Pi pico and it is reading UART communication from the module. For the code below, I am getting the following response. 
 

import time

from machine import UART, Pin


 

uart1 = machine.UART(1, baudrate=9600, tx=machine.Pin(4), rx=machine.Pin(5), timeout=1000)

while True:

    reading = uart1.read(10)

    if reading != None:

        print(uart1.read(10))

    time.sleep(0.01)


The response is as follows.

 

b'\xff\x17\x04\x00\x00\x11\x13\x889'
b'\xff\x17\x04\x00\x00\x11\x13\x889'
b'\xff\x17\x04\x00\x00\x11\x13\x889'

 

Can I know which part of this is the formaldehyde reading? Is it in ppm or mg/l? Also does it increase and decrease linearly with the formaldehyde concentration? I couldn't find this info in the documentation.

2026-07-02 10:28:02

Hi, 

 

According to the official Wiki, SEN0231 uploads a 9-byte UART packet about every 1 second by default.

So the raw value from the packet is in ppb, and the official library converts it to ppm.

 

I’d suggest using the official DFRobot library and Wiki example instead of manually parsing the UART data.

 

Wiki: https://wiki.dfrobot.com/sen0231/docs/19767

userHeadPic Yx