LM75 Temperature Sensor module is a delta-sigma analog to digital converter. The cost-effective device consumes less power and is highly precise. An over-temperature protection circuit is integrated to sink the current that shut down in the module in case of over the limit temperature. LM75 communicates the data using the I2C interface. To connect multiple hosts to the same bus, three address pins are available for the purpose.
It is a popular temperature sensor among the hobbyist and is included in many small electronics projects. This post presents the pin configurations, pinout diagram specifications, features interfacing with Arduino, and applications of a LM75 temperature sensor module.
LM75 PinoutThis Temperature sensor module consists of LM75 IC. Moreover, it has pull-up resistors, a coupling capacitor for smoothing and a status LED for power indication. The pinout of the convenient LM75 Temperature Sensor module is as shown:
Pin ConfigurationThe pin configuration in tabular are detailed below:
Pin Number Pin Name Function 8 VCC Positive power supply pin 4 GND Reference potential pin 2 SCL Open drain Serial Clock pin. An I2C line to carry clock signals and must be connected to a pull-up resistor. But module has built-in pull resistors. Therefore, does not require external pull-up resistors. 1 SDA Open drain Serial Data pin An I2C line to carry data transmission and must be connected to a pull-up resistor. But module has built-in pull resistors. Therefore, does not require external pull-up resistors. 3 OS Over temperature Shutdown Output pin Features & SpecificationsThe functional diagram of LM75 Temperature Sensor for better understanding of the internal circuitry is as shown below:
LM75 Interfacing with ArduinoThis section deals with the interfacing of the LM75A Temperature sensor to Arduino UNO microcontroller. But you can use other Arduino boards also which have at least one I2C port.
Connection DiagramBefore going to the programming section, First, download the LM75 Arduino library and install it on the Arduino IDE software. It is very convenient to use the prewritten library specifically for the module and add it to the sketches to perform the commands. Download the LM75 Arduino Library from this link:
After that, follow these steps to install the library: Sketch >Include Library> Add .ZIP Library. Moreover, you can check this video to know how to install a new library in Arduino IDE:
Arduino CodeThis code takes temperature measurement and prints it on Arduino serial monitor.
#include <inttypes.h>
#include <Wire.h>
#include <lm75.h>
TempI2C_LM75 Temperature = TempI2C_LM75(0x48,TempI2C_LM75::nine_bits);
void setup()
{
Serial.begin(9600);
Serial.println("Start");
Serial.print("Actual temp ");
Serial.print(Temperature.getTemp());
Serial.println(" oC");
delay(2000);
}
void loop()
{
Serial.print(Temperature.getTemp());
Serial.println(" oC");
delay(2000);
}
How does the code work?
In this section, we will see how the above given Arduino code works.
Include librariesFirst, we include the required libraries i.e. “LM75.h” for temperature sensor, “Wire.h” for I2C protocol support. Also, create an instance of TempI2C_LM75 with the name “Temperature” to get the temperature value from the LM75 sensor module.
#include <inttypes.h>
#include <Wire.h>
#include <lm75.h>
TempI2C_LM75 Temperature = TempI2C_LM75(0x48,TempI2C_LM75::nine_bits);
Void Setup
The setup loop initializes the Serial monitor with a baud rate of 9600bps. It will also display the introductory messages on Arduino serial monitor screen.
void setup()
{
Serial.begin(9600);
Serial.println("Start");
delay(2000);
}
Inside the loop() function, we get a temperature sample from LM75 and print it on Arduino serial monitor after every 2 seconds.
void loop()
{
Serial.print(Temperature.getTemp());
Serial.println(" oC");
delay(2000);
}
Upload the code to Arduino board. After successful compilation and uploading, you will temperature value on Arduino serial monitor.
ApplicationsRelated Articles:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4