CurieImu readTemperature() incorrect function

I was trying out the CurieImu.readTemperature() function that I saw listed on the CurieImu reference page. It was returning the error 'class CurieImuClass' has no member named 'readTemperature'. I checked the CurieImu.h file, which led me to the BMI160.h file. The correct function is getTemperature().

There is a new version of the CurieImu library(they renamed it CurieIMU and left the version number at 1.0 just to be extra confusing) included with the new version of Intel Curie Boards(1.0.5). You can install it using Tools > Board > Boards Manager… > Intel Curie Boards > Update. The new version of the library does have a readTemperature() function but all it does is call getTemperature().

Good call. I had 1.0.4. Yep, readTemperature() and getTemperature() both work with 1.0.5. Also had to change my #include to "CurieIMU".

Hello,

There is another thing with the reference regarding CurieIMU.readTemperature() function.

According to the formula, the temperature range would be from 22 to 24 °C. This doesn’t seem fine. If it was to be calculated according to BMI160 datasheet, it would be probably

tempCelsius = rawTemperature / 512.0 + 23.0;

Can anybody check it?

Best regards,
GregorioW

PS This is my first post here, I hope I will be able to contribute something more at some point. Thanks for all the support so far!

GregorioW: Hello,

There is another thing with the reference regarding CurieIMU.readTemperature() function. (...)

Hello,

I know that there are more important things to deal with but I’m just wondering if anybody checked this minor library reference issue ;) Did anybody try?

Best regards, GregorioW

I don't have an Arduino 101 to check but I can see one thing on that page that already looks wrong:

The value of the read temperature is 16 bit signed.

But if you look at the library source(https://github.com/01org/corelibs-arduino101/blob/master/libraries/CurieIMU/src/CurieIMU.h#L199):

int readTemperature();

I'm pretty sure int is 32 bit signed on the Arduino 101.

Hi pert,

pert: (...) I'm pretty sure int is 32 bit signed on the Arduino 101.

Thanks for your reply. Indeed, sizeof(int) returns 4 ;)

It could be the sensor resolution what the authors had in their minds. The BMI60 uses a 2-byte register to store the temperature value (as well as for other sensor data). And in the BMI60.h you already have this ‘generic’ int16_t getTemperature().

BTW, it also seems that I found the answer to my question. If you look at BMI60.cpp:2272, in the comment there is a nice explanation of the temperature range, consistent with what I suggested.

So, my question is no longer a question, but a suggestion to update the readTemperature reference.

Thanks for helping!

Best regards, GregorioW

Yes I see now, I didn't look at the source for getTemperature().

Then if it's verified the equation is wrong the best place to report it is https://github.com/arduino/Arduino/issues. The people in charge of the documentation rarely read the forum. I've found it's best to give them a suggestion of the exact edits to make instead of only reporting the issue. This makes it more likely to get fixed quickly since they can just do a fast cut and paste of your text.

Hi pert,

Thanks for the redirection :) That’s something I needed, I’ll let them know over there.

Best regards, GregorioW