Capteur de température LM75A avec LCD1602 I2C
Na boyekoli oyo, tokoyekola ndenge ya kosalela sensor ya température LM75A mpo na kolakisa ba lectures ya température na Celsius mpe Fahrenheit na écran LCD1602 na kosalela communication I2C. LM75A ekoki komeka température kobanda -55°C kino +125°C, oyo esengeli mpo na ba applications ndenge na ndenge. Soki mise en place esili, okokoka komona ba lectures ya température na tango ya solo na écran LCD.


Mpo na projet oyo, tokosalela sensor LM75A mpe module LCD1602 oyo esangani na I2C, oyo epesaka possibilité ya kosala câblage pete mpe kosalela ba pins mingi te na Arduino. Likanisi ezali ya kosala système oyo etángaka température na tango nyonso mpe elakisaka yango na LCD. Soki osengeli na ndimbola na eteni songolo ya processus, tala vidéo ya boyekoli (na vidéo na 00:00).
Hardware Explication
Ba composants ya minene mpo na projet oyo ezali sensor ya température LM75A mpe écran LCD1602. LM75A ezali sensor ya température I2C oyo epesaka ba lectures ya température ya malamu. Esololaka na Arduino na ba fils mibale kaka, SDA (ligne ya données) mpe SCL (ligne ya horloge), oyo esalaka ete ezala pete mpo na kosangisa na ba projets na yo.
LCD1602 ezali écran ya bapasá 16x2 oyo ekoki kolakisa bapasá kino 32 na mbala moko. Na kosalela interface I2C, tokoki kokamba yango na ba fils mibale mosusu, oyo ekitisaka mingi processus ya câblage. Fonctionnalité ya backlight ya LCD ekoki mpe kopesa boyebi malamu na ba environnements oyo pole ezali moke.
Détails ya Datasheet
| Fabricant | Texas Instruments |
|---|---|
| Numéro ya partie | LM75A |
| Tension ya logique/IO | 2.7 V kino 5.5 V |
| Tension ya alimentation | 2.7 V kino 5.5 V |
| Courant ya sortie (na canal) | N/A |
| Courant ya pointe (na canal) | N/A |
| Directive ya fréquence PWM | N/A |
| Seuils ya logique ya entrée | 0.3 * Vcc (moké), 0.7 * Vcc (monene) |
| Chute ya tension / RDS(on) / saturation | N/A |
| Limites ya thermique | Fonctionnement: -55°C kino +125°C |
| Package | SOT-23 |
| Notes / variantes | Ezali na ba adresses I2C ebele |
- Kokamba ete alimentation ya malamu ezala (2.7 V kino 5.5 V).
- Kosalela ba résistances ya pull-up na ba lignes SDA mpe SCL soki esengeli.
- Kotala configuration ya adresse I2C mpo na ba appareils ebele.
- Kokamba ete ba fils ezala moké mpo na kokitisa interférence.
- Kotala gamme ya température: -55°C kino +125°C.
- Kosalela moniteur ya série mpo na kobuka ba lectures ya température.
- Kokamba ba états ya erreur na code na ndenge ya malamu.
- Kozala na bokebi na ba besoins ya puissance ya écran.
Instructions ya Câblage

Mpo na kosangisa sensor ya température LM75A mpe LCD1602, banda na kosangisa alimentation. Singa pin VCC ya LM75A mpe LCD1602 na pin 5V na Arduino. Na sima, singa pin ya terre (GND) ya ba modules mibale na pin GND na Arduino.
Na sima, singa ba lignes ya communication I2C. Pin SDA ya LM75A esengeli kosangisama na pin A4 na Arduino, ntango pin SCL esengeli kosangisama na pin A5. Oyo epesaka possibilité ya communication I2C kati na sensor mpe Arduino. Kamba ete ba connexions ezala ya libende mpo na kopekisa ba erreurs ya communication.
Ba Exemples ya Code & Explication
Na code, tobandi na kosangisa ba bibliothèques ya liboso mpo na sensor LM75A mpe écran LCD1602. Eteni oyo elandaka elakisaki ndenge ya kosala instance ya sensor LM75A:
LM75A lm75a_sensor(false, false, false);
Ligne oyo ebandisaka objet ya sensor LM75A. Ba paramètres ya booléen correspondent na ba pins A0, A1, mpe A2 ya LM75A, oyo epesaka possibilité ya ba adresses I2C ndenge na ndenge soki esengeli.
Na sima, tosengeli moniteur ya série mpe tobandisaka écran LCD:
void setup(void) {
Serial.begin(9600);
lcd.begin();
lcd.backlight();
lcd.print("Robojax LM75A");
}
Awa, tobandisaka communication ya série na 9600 baud mpe tobandisaka écran LCD. Backlight ezali ya kopelama, mpe message ya liboso ekomami na écran.
Na boucle ya principale, totángaka température na tango nyonso mpe tolakisaka yango:
float temperature_in_degrees = lm75a_sensor.getTemperatureInDegrees();
if (temperature_in_degrees == INVALID_LM75A_TEMPERATURE) {
Serial.println("Error while getting temperature");
}
Eteni oyo ezongisaka température na sensor. Soki lecture ezali ya mabe, message ya erreur etindamaka na moniteur ya série. Sinon, température ekoki kosalelama mpe kolakisa na LCD.
Démonstration / Nini Okoki Kozela
Soki nyonso esili kosangisama mpe code ekomami, okoki komona ba lectures ya température na écran LCD1602, oyo ekotambola kati na Celsius mpe Fahrenheit. Soki sensor LM75A ezali kosala malamu, ekokomisa à jour température oyo elakisami na seconde nyonso. Soki ezali na ba problèmes, lokola polarité oyo ebongwanaki to câblage ya mabe, tala ba connexions mpe kamba ete ba pins ya malamu esalelami (na vidéo na 00:00).
/*
* \brief Show temperature in degrees Celsius and Fahrenheit every second
*
* \author Quentin Comte-Gaz <quentin@comte-gaz.com>
* \date 8 July 2016
* \license MIT License (contact me if too restrictive)
* \copyright Copyright (c) 2016 Quentin Comte-Gaz
* \version 1.0
*
* Modified by Ahmad Shamshiri on July 12, 2018 at 22:40 for Robojax.com
* in Ajax, Ontario, Canada
* Watch video instructions for this code: https://youtu.be/hVo_msVMlaI
For this sketch, you need to connect:
VCC to 3.3V or 5V and GND to GND of the Arduino
SDA to A4 and SCL to A5
*/
#include <LM75A.h>
// Create I2C LM75A instance
LM75A lm75a_sensor(false, //A0 LM75A pin state
false, //A1 LM75A pin state
false); //A2 LM75A pin state
// Equivalent to "LM75A lm75a_sensor;"
// start of settings for LCD1602 with I2C
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
// end of settings for LCD1602 with I2C
void setup(void)
{
Serial.begin(9600);
Serial.println("Robojax LM75A Test");
// initialize the LCD
lcd.begin();
lcd.backlight();
lcd.print("Robojax LM75A");
lcd.setCursor(0,1);
lcd.print("Demo");
delay(2000);
}
void loop()
{
lcd.clear();// clear previous values from screen
// Robojax.com LM75A Test
float temperature_in_degrees = lm75a_sensor.getTemperatureInDegrees();
if (temperature_in_degrees == INVALID_LM75A_TEMPERATURE) {
Serial.println("Error while getting temperature");
} else {
Serial.print("Temp: ");
Serial.print(temperature_in_degrees);
Serial.print(" C (");
float tmpF = LM75A::degreesToFahrenheit(temperature_in_degrees);
Serial.print(tmpF);
Serial.println(" F)");
lcdDisplay(
// to print Celsius:
0, // character 0
0, // line 0
"Celsius: ",
// to print Celsius
11, // character 10
0, // line 0
temperature_in_degrees
);
lcdDisplay(
// to print Fahrenheit:
0, // character 0
1, // line 1
"Fahrenheit: ",
// to print Fahrenheit
11, // character 9
1, // line 0
tmpF
);
}
delay(1000);
}
/*
* lcdDisplay(int tc, int tr, String title, int vc, int vr, float value)
* displays value and title on LCD1602
* How to use:
* If you want to display: "Voltage: 13.56mV" starting from the first character
* on the second row.
* use:
* lcdDisplay(0, 1, "Voltage: ", 13.56)
*
* tc is the character number (0)
* tr is the row number in the LCD (1)
* title is the text ("Voltage:")
* vc is the character number for the value
* vr is the row number for the value
* value is the value (13.56)
*/
void lcdDisplay(int tc, int tr, String title, int vc, int vr, float value)
{
// Robojax.com LCD1602 for LM75A Demo
lcd.setCursor (tc,tr); //
lcd.print(title);
lcd.setCursor (vc,vr); //
lcd.print(value);
}
Nko o na nki.
-
AmazonBuy LCD1602-I2C from Amazonamzn.to
-
AmazonPurchase LM75A from Amazonamzn.to
-
eBayPurchase LCD1602-I2C from eBayebay.us
-
AliExpressPurchase 10pcs LCD1602-I2C from AliExpresss.click.aliexpress.com
Mokili na bisika
-
L'extérieurLM75A datasheet from NXPnxp.com
-
L'extérieurLM75A datasheet from TIti.com
-
L'extérieurLM75A library from GitHubgithub.com
Fichiers📁
Fritzing File
-
LM75 Temperature Sensor
Temperature Sensor - LM75.fzpz0.01 MB
Mabala a mangwe
-
LM75A datasheet from Philips
robojax-LM75A_temperature_senssor_datasheet_philips.pdf0.13 MB -
LM75A library from Robojax.com
robojax-LM75A_temperature_sensor.zip0.56 MB