Skip to content

readTemperature() Returns Nonsensical Values (Nano 33 IoT) #41

Open
@ryanohoro

Description

@ryanohoro

Running SimpleTempSensor results in readTemperature() returning nonsensical values that change based on the temperature.

Temperature sensor sample rate = 52.00 Hz

Temperature reading in degrees C
T
123.12
126.44
126.00
127.25
128.56

The root cause is that the original part the Nano 33 IoT shipped with, the LSM6DS3 (Chip marked SH) is no longer manufactured, and other parts from this family are being shipped on these boards. Mine has a LSM6DSOX (Chip marked S4). These parts have different values for temperature sensitivity, which affects how the raw value is converted into degrees Celsius.

t = data[0] / 16.0 + 25;

image

image

Changing the formula results in accurate temperature values

t = data[0] / 256.0 + 25;

Temperature sensor sample rate = 52.00 Hz

Temperature reading in degrees C
T
26.95
26.83
26.79
26.95
26.95

Unfortunately, I'm not sure how to programmatically determine which temperature setting value is appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions