practicalarduino / SHT1x

Arduino library to support SHT1x-series (SHT10, SHT11, SHT15) temperature / humidity sensors from Sensirion
http://www.practicalarduino.com/
153 stars 118 forks source link

Constants incorrect #13

Open KDrennon opened 8 years ago

KDrennon commented 8 years ago

Version 5 of the SHT1x Datasheet (December 2011) uses different constants than the ones shown here. In SHT1x.cpp, the corrections are as follows.

For 5V and temperature in Celsius, D1 = -40.1 For 5V and temperature in Fahrenheit, D1 = -40.2 For the humidity constants and 12 bit data: C1 = -2.0468 C2 = 0.0367 C3 = -0.0000015955
// I'm not sure if it can use that many decimal places, but there they are just in case.

Of course, you should always check to make sure that you are setting your rig up the same way as the code intends and make appropriate changes to your code as per the datasheet if you want to use a voltage other than 5 V and something other than 14 bit temperature data and 12 bit humidity data.

markbergsma commented 8 years ago

See lthiery/SHT1x for a fork with updated constants that also allow different sensor voltages, or markbergsma/SHT1x for additional improvements (CRC checking, cleanups) on top of that.

giuliotamberi commented 7 years ago

Perfect thank you! However, I'm not able to use those libraries (lthiery/SHT1x & markbergsma/SHT1x) with any Particle Spark Core board: it looks like they are limited to the application on the Arduino boards only, isn't it? When I try to compile with the Particle IDE, I got errors problably because of these lines:

if (ARDUINO >= 100)

include

else

include

endif

Any suggestion? Thanks!

Giulio

giuliotamberi commented 7 years ago

Hello markbergsma, I've just verified and unfortunately in both libraries lthiery/SHT1x & markbergsma/SHT1x the humidity constant C1, C2 and C3 are the old (wrong) values and must be updated according to latest Sensirion datasheet (ver.5, Dec 2011): C1 = -2.0468 C2 = 0.0367 C3 = -0.0000015955

Ciao, Giulio

Vincent-Pang commented 7 years ago

Hi Giulio, I forked this repo and updated the coefficients according to the latest Sensirion datasheet v5. And added the flexibility to use coefficients besides 5v.

https://github.com/Vincent-Pang/SHT1x

Vincent