The particle dust sensor from Sensirion is a beautifull sensor. The built in software is verry complicated.
The Github libraries are difficult to get working. So i decided to use the I2C connection and program it my self.
With some nice help it is working beautifully. The results seem to be OK.
The format of the output is 4 heaxadecimal characters representing the IEEE754 floating point value.
With an IEEE745 converter correct values can be calculated:
https://www.h-schmidt.net/FloatConverter/IEEE754.html
my result: 0x40588CE4 gives a float value of 3.3835992 wich seems to be a correct value.
The conversion exists of replacing the 4 hex bytes at the place of the float. At the internet i found lots of programs to do this exchange. But these programs don't function with my Arduino's I used the UNO and the ESP32, both give the same result. Always 0.00
Can anybody find the error in my code?
hex_to_float.ino (283 Bytes)