• I bought a fine particle sensor, the sds011. This sensor has a USB socket that allows me to test it super fast with a Node.js script (SDS011-Wrapper) it works very well.

    Now I want to make a "more" portable solution, by connecting the sensor with Espruino Pico.

    This sensor is connected in Serial.

    During my tests using a Node.js script, I have exactly an hex bytes buffer output that corresponds to the documentation, like :

    <Buffer aa  c0  1b  05  7d  08  9c  eb  2c  ab>

    For exemple, to get the PM2.5 value :
    PM2.5 value: PM2.5 (μg /m3) = ((PM2.5 High byte *256) + PM2.5 low byte)/10

    Where PM2.5 High byte = 05(Hex) = 5(decimal)
    and PM2.5 low byte = 1b(Hex) = 27(decimal)

    (reading de doc), after converting the Hex data to Decimal

    const PM2.5 = ( ( 5 * 256 ) +   27   ) /10 = 130.7

    Now, connecting Pico serial to this sensor and console.log the serial output give me weird result (exotic characters, like ÿ ô , etc ...). I know I missing something, I know I should convert the sensor serial output to decimal data but I don't know where to start?, well in fact I don't know what is the type of data the sensor give me? an array of Hex?, decimal ASCII values ?

    Will apreciate your help if someone have already use this little cool device !


Avatar for larry @larry started