LM75 sensor/Using it/09. When the reading is wrong
Using it · 09 of 9

When the reading is wrong

Five things go wrong with this block, and each has its own look in the serial monitor: no answer, a zero on the first line, 250 degrees in the cold, a reading that runs warm, and one that never changes. Most are the wiring or the arithmetic, not the chip.

Five symptoms

What the monitor says
What you see
Symptom
Near 256 °C in the cold
Look at
the sketch
Below zero the top bit is the sign. Put the two bytes into an int16_t before dividing, as the book's sketch does; an int on an ESP32 or a Pico is 32 bits and loses it.

Each one points somewhere different: the wires, the sketch or where the board sits. The figure shows what the monitor looks like in each case, and the paragraphs below say what to check first.

No answer

The book's sketch prints No LM75 at 0x48 when the chip does not acknowledge. Check the order from the square pad: GND, VCC, SDA, SCL. On this block SDA is the third pin, and a pair of jumper wires swapped between SDA and SCL is the most common cause. Then VCC: without it the chip is silent and nothing lights to say so.

If the jumper on the back has been cut, the bus may have no pull-ups at all. VCC sets the bus says when that is safe.

The wrong number

A 0.000 on the first line is a read before the first conversion finished. The book's sketch throws that one away.

About 250 below zero is the arithmetic: the two bytes went into a 32-bit int and the sign was lost. Degrees in two bytes has the one line that fixes it.

A degree or two high is usually heat from nearby: the chip measures its own temperature, and a microcontroller or a regulator a centimetre away warms the board. Put it on longer wires, away from both.

The same value, again and again is a sketch reading faster than the chip converts, or a room whose temperature is steady. A finger on the chip tells the two apart in a second or two.

When it does not work

Nothing answers at 0x48.

Count from the square pad: GND, VCC, SDA, SCL. SDA and SCL swapped is the usual cause, then VCC not connected, then a cut pull-up jumper with no other pull-ups on the bus. Nothing is damaged by any of those.

Below zero it reads about 250 °C.

The sketch combined the two bytes in a 32-bit int. Read them into an int16_t and divide by 256.0. The book's sketch does; the code on the page this book replaced did not.

It reads a couple of degrees high.

The chip is warmer than the air: a microcontroller, a regulator or the sun is heating the board. Move it a few centimetres away on longer wires and give it a minute. What is left, up to 2 °C, is within the datasheet.

A scan finds something at 0x48 but the numbers make no sense.

Two devices may share the address. An ADS1115 left at its default is also 0x48. Unplug everything else and read again; if it comes right, move the other device's address.

Where this goes next

Back to the block's page: the specifications, the files and the quick reference.

The TK42 LM75 →

Edit this page — content/books/lm75/when-the-reading-is-wrong.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

LM75 Temperature Sensor

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →