Altium
Arduino Projects

LM75 with Arduino, LM75 I2C, LM75A Arduino Library, CJMCU-75 temperature sensor

How to connect LM75 or CJMCU-75 temperature sensor with Arduino

LM75 Temperature Sensor:

LM75

LM75 with Arduino, LM75 I2C, LM75A Arduino Library, CJMCU-75 temperature sensor- In this article, you will learn how to make a temperature monitoring system using I2C supported LM75 or CJMCU-75 or LM75A sensor module, Arduino Nano, I2C supported SSD1306 Oled display module, and a 5V buzzer.

So far, I have covered majority of the temperature sensors, including DHT11 Temperature and Humidity Sensor, BMP180 Temperature, pressure, and Altitude sensor, DS18b20 one-wire digital temperature sensor, MLX90614 infrared temperature sensor, MAX6675 K-type thermocouple, and so many other sensors.

LM75

I have these different types of sensors which I have already used in basic, intermediate, and advanced level projects. Every temperature sensor has got unique features on the basis of which it is used in different projects.



If you want to monitor temperature and humidity then you can use the popular DHT11 sensor.

If you want to measure or monitor the temperature of the water or any other liquid then you can use the DS18b20 one-wire waterproof digital temperature sensor.

If along with the temperature, you also want to measure pressure and altitude then you can use BMP180 sensor.

If you want to measure the temperature of humans, animals, or other objects without physical contact then you can use the MLX90614 infrared temperature sensor. Using this sensor, you can make a non-contact thermometer or temperature monitor for patients, for example, the Covid patients. MLX90614 is insanely fast and accurate. Recently, I used it with the ESP8266 WiFi module and I designed myself an IoT temperature monitoring system.

If you want to measure high temperatures up to 1000 degrees Celsius then you can use the MAX6675 amplifier board and K-type thermocouple.

So, this was a brief introduction to these different types of temperature sensors, and now you can decide yourself which temperature sensor you need for your project. Anyway, let’s get back to our original topic.

Before I am going to explain the features, specifications, it’s interfacing with the Arduino, and programming. First, let’s watch the LM75A temperature sensor in action.




Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.

LM75

I have connected the LM75 temperature sensor, Oled display module, and the 5V buzzer as per the circuit diagram which I will explain in a minute. I have done it’s programming in a way that it displays the temperature in Celsius and Fahrenheit on the Oled display module. Besides this, I have also added a limit; so whenever the temperature exceeds that limit the buzzer will immediately turn ON.

On the Oled display module, you can see temperature in Celsius and Fahrenheit. This is the ambient temperature, its 4th of June 2022 while I am testing this project. Nowadays the weather in Pakistan is really hot.  Anyway, now I am going to place this sensor somewhere, where the sunlight will directly fall on the temperature sensor.

LM75

Just look at the temperature, the global warming is really destroying this planet and this is because of the excessive Carbon dioxide emission. Now, let’s go ahead and apply some heat to check if the buzzer will turn ON. Right now the temperature threshold value is 45 Celsius.



LM75

I applied heat to the LM75A temperature sensor and as soon as the temperature crossed the threshold value of 45 Degrees Celsius the buzzer turned ON. For the practical demonstration watch video tutorial given at the end of this article. I am sure by now, you might have got an idea of how does this system work. So, without any further delay let’s get started!!!

Amazon Links:

Arduino Nano

SSD1306 Oled display Module

LM75A I2C supported Temperature Sensor

5V buzzer

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



LM75 Temperature Sensor:

LM75

This is the CJMCU-75 I2C supported temperature sensor which is also known as LM75 or LM75A temperature sensor. With this temperature sensor, you can read temperature in both Celsius and Fahrenheit. The temperature range is from -55 Celsius to +125 degree Celsius.

The LM75A is an industrial standard digital temperature sensor with an integrated sigma-delta analog-to-digital converter (ADC). The LM75A provides 9-bit digital temperature readings with an accuracy of ±2°C from –25°C to 100°C and with an accuracy of ±3°C over –55°C to 125°C.

The LM75A operates with a single supply from 2.7 V to 5.5 V. Due to this wide range of input voltages it can be easily used with 3.3V compatible controller boards like esp8266, ESP32, etc., and 5V compatible controller boards.

LM75

Communication is accomplished over a 2-wire interface which operates up to 400 kHz. LM75A has three selectable logic address pins A0, A1, and A2, allowing up to eight LM75A devices to operate on the same 2-wire bus. A0, A1, and A2 can be used to set an I2C address. You can short any of these address pins with the VCC or ground. This way you will be able to connect 8 temperature sensors without any address conflict.

The LM75A has a dedicated over-temperature output (O.S.) with programmable limit and hysteresis.

LM75A temperature sensor can be used in base stations, electronic test equipment, office electronics, personal computers, Environmental Monitoring, and any other system in which thermal management is critical to performance. Now, let’s take a look at the circuit diagram.



LM75A interfacing with Arduino:

LM75

The SCL and SDA pins of the LM75A temperature sensor and Oled display module are connected together and then connected with the Arduino A5 and A4 pins. A5 is the SCL and A4 is the SDA. While the VCC and GND pins are connected with the Arduino 5V and GND pins.

The 5V buzzer is controlled using D3 pin of the Arduino. We use 2n2222 NPN transistor and a 10K ohm resistor to control the 5V buzzer. The transistor and resistor make the driver circuit.

On the left side is the 5V regulated power supply based on the LM7805 voltage regulator. The output of the 5V regulated power supply is connected with the Vin pin of the Arduino. Since I am using 7805 voltage regulator, so I can use voltages between 7 and 28 volts to power up the Arduino. Due to this wide input voltage range, I can use a 12V adaptor, a battery, solar panel etc. to power up the Arduino.




Required Libraries for LM75:

Before, you start the programming, first of all, make sure you download all the necessary libraries. The Adafruit_GFX.h and Adafruit_SSD1306.h libraries I have been using for quite a long time and I have already explained how to download and use these libraries.

Download: Adafruit_GFX.h

Download: Adafruit_SSD1306.h

You will also need the LM75A library.

Download LM75A 

LM75

To add this library simply click on the Sketch menu and then go to Include Library and click on the Add ZIP library… browse to the desired location and select the zip folder and then finally click on the open button.

As I have already added this library so I will click on the cancel button.



LM75A Arduino programming:

#include <SPI.h>              // include libraries
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <LM75A.h>

// Create I2C LM75A instance
LM75A lm75a_sensor(false,  // A0 LM75A pin state (connected to ground = false)
                   false,  // A1 LM75A pin state (connected to ground = false)
                   false); // A2 LM75A pin state (connected to ground = false)
// Equivalent to "LM75A lm75a_sensor;"


#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int buzzer = 3;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
  Serial.println("Temperatures will be displayed every second:");
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  delay(2000);
  display.clearDisplay();
  display.setTextColor(WHITE);
  pinMode(buzzer, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  float temperature_in_degrees = lm75a_sensor.getTemperatureInDegrees();

  if (temperature_in_degrees == INVALID_LM75A_TEMPERATURE)
  {
    Serial.println("Error while getting temperature");
  }
  else
  {
    Serial.print("Temperature: ");
    Serial.print(temperature_in_degrees);
    Serial.print(" degrees (");
    Serial.print(LM75A::degreesToFahrenheit(temperature_in_degrees));
    Serial.println(" fahrenheit)");

       if ( temperature_in_degrees >= 45 )
 {
  digitalWrite( buzzer, HIGH);
  Serial.println(" Temperature Alert! ");
 }

    if ( temperature_in_degrees < 45 )
 {
  digitalWrite( buzzer, LOW);
 }
 
display.clearDisplay();
  display.setCursor(25,0);  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.println(" Temperature");
  display.setCursor(10,20);
  display.setTextSize(2);
  //display.print("C: ");
  display.print(temperature_in_degrees);
  display.print((char)247);
  display.print("C");
 
  display.setCursor(10,45);
  display.setTextSize(2);
  //display.print("F: ");
  display.print(LM75A::degreesToFahrenheit(temperature_in_degrees));
  display.print((char)247);
  display.print("F");
    display.display();
  }



  delay(1000);


}

The purpose of this program is to read the temperature in Celsius and Fahrenheit; And to check if the temperature has above or below the threshold value. If the temperature has exceeded 45 degrees Celsius then turn ON the buzzer and if the temperature is below 45 degrees Celsius then turn OFF the buzzer. Besides this I also print the temperature values on the Oled display module. So, that’s all about the programming.



Watch Video Tutorial:

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published.

Back to top button