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 !
larry
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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 :
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
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 !
larry