STM32 Nucleo and LM75 temperature sensor example

In this example we connect an LM75 to a STM32 Nucleo and we will use the MBEd compiler

The LM75 temperature sensor includes a delta-sigma analog-to-digital converter, and a digital overtemperature detector. The host can query the LM75 through its I²C interface to read temperature at any time. The open-drain overtemperature output (OS) sinks current when the programmable temperature limit is exceeded.

The OS output operates in either of two modes, comparator or interrupt. The host controls the temperature at which the alarm is asserted (TOS) and the hysteresis temperature below which the alarm condition is not valid (THYST). Also, the LM75’s TOS and THYST registers can be read by the host.

The address of the LM75 is set with three pins to allow multiple devices to work on the same bus. Power-up is in comparator mode, with defaults of TOS = +80°C and THYST = +75°C. The 3.0V to 5.5V supply voltage range, low supply current, and I²C interface make the LM75 ideal for many applications in thermal management and protection.

Key Features

SO (SOP) and µMAX® (µSOP) Packages
I²C Bus Interface
Separate Open-Drain OS Output Operates as Interrupt or Comparator/Thermostat Input
Register Readback Capability
Power-Up Defaults Permit Stand-Alone Operation as a Thermostat
3.0V to 5.5V Supply Voltage
Low Operating Supply Current 250µA (typ), 1mA (max)
4µA (typ) Shutdown Mode Minimizes Power Consumption
Up to Eight LM75s Can Be Connected to a Single Bus



I2C device you can power it from 3.3 or 5v


stm32nucleo and lm75
stm32nucleo and lm75



I used this library –


[codesyntax lang=”cpp”]

#include “mbed.h”
#include “LM75B.h”

LM75B tmp(I2C_SDA, I2C_SCL);

int main ()
while (1) {
pc.printf(“%.2f celsius\r\n”,;




Using a serial terminal program you should see something like this

lm75 output
lm75 output



LM75 temperature sensor high speed I2C interface high precision development board module

This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views :