Interfacing IR Temperature Sensor with Raspberry Pi 3 ๐ก️
Infrared temperature sensors are non-contact sensors that detect the temperature of objects by sensing emitted infrared radiation. Today, we’ll learn how to interface an IR sensor (like MLX90614) with a Raspberry Pi 3. ๐
๐ง Components Required
| Component | Quantity |
|---|---|
| Raspberry Pi 3 | 1 |
| IR Temp Sensor (MLX90614) | 1 |
| Jumper Wires | 4 |
| Breadboard (optional) | 1 |
๐ช Pin Connections
| Sensor Pin | Raspberry Pi Pin | Pin Number |
|---|---|---|
| VCC | 3.3V | Pin 1 |
| GND | Ground | Pin 6 |
| SDA | GPIO 2 (SDA) | Pin 3 |
| SCL | GPIO 3 (SCL) | Pin 5 |
Figure: IR Sensor connected to Raspberry Pi 3
⚙️ Enabling I2C on Raspberry Pi
- Open terminal:
sudo raspi-config - Go to Interfacing Options > I2C and enable it.
- Reboot your Raspberry Pi.
๐ป Python Code
import smbus
import time
bus = smbus.SMBus(1)
address = 0x5A
def read_temp():
raw_ambient = bus.read_word_data(address, 0x06)
raw_object = bus.read_word_data(address, 0x07)
temp_ambient = (raw_ambient * 0.02) - 273.15
temp_object = (raw_object * 0.02) - 273.15
return temp_ambient, temp_object
try:
while True:
ambient, obj = read_temp()
print(f"Ambient: {ambient:.2f}°C | Object: {obj:.2f}°C")
time.sleep(1)
except KeyboardInterrupt:
print("Stopped")
๐ Summary
This setup allows contactless temperature measurement, ideal for COVID screening booths, industrial monitoring, and smart home devices! ๐ฅ❄️
Raspberry Pi 3 เคธเคน IR เคคाเคชเคฎाเคจ เคธेเคจ्เคธเคฐ เคเคธे เคोเคกाเคฏเคे ๐ก️ (เคฎเคฐाเค ी)
IR (Infrared) เคคाเคชเคฎाเคจ เคธेเคจ्เคธเคฐ เคนे เคธंเคชเคฐ्เคเคตिเคฐเคนिเคค เคธेเคจ्เคธเคฐ เค เคธเคคाเคค เคे เคตเคธ्เคคूंเคชाเคธूเคจ เคเคค्เคธเคฐ्เคिเคค เคนोเคฃाเคฐे เคเคจ्เคซ्เคฐाเคฐेเคก เคฐेเคกिเคเคถเคจ เคฎोเคूเคจ เคคाเคชเคฎाเคจ เคฎोเคเคคाเคค. เคเคฒा เคนे Raspberry Pi 3 เคธोเคฌเคค เคเคธे เคोเคกाเคฏเคे เคคे เคถिเคूเคฏा. ๐
๐ง เคฒाเคเคฃाเคฐे เคธाเคนिเคค्เคฏ
| เคธाเคนिเคค्เคฏ | เคช्เคฐเคฎाเคฃ |
|---|---|
| Raspberry Pi 3 | 1 |
| IR เคคाเคชเคฎाเคจ เคธेเคจ्เคธเคฐ (MLX90614) | 1 |
| เคंเคชเคฐ เคตाเคฏเคฐ | 4 |
| เคฌ्เคฐेเคกเคฌोเคฐ्เคก (เคชเคฐ्เคฏाเคฏी) | 1 |
๐ เคตाเคฏเคฐिंเค เคोเคกเคฃी
| เคธेเคจ्เคธเคฐ เคชिเคจ | Raspberry Pi เคชिเคจ | เคชिเคจ เค्เคฐเคฎांเค |
|---|---|---|
| VCC | 3.3V | เคชिเคจ 1 |
| GND | GND | เคชिเคจ 6 |
| SDA | GPIO2 (SDA) | เคชिเคจ 3 |
| SCL | GPIO3 (SCL) | เคชिเคจ 5 |
⚙️ I2C เคธुเคฐू เคเคฐเคฃे
- เคเคฐ्เคฎिเคจเคฒ เคเคเคกा:
sudo raspi-config - Interfacing Options > I2C เคฏेเคฅे เคाเคเคจ I2C เคธुเคฐू เคเคฐा.
- Pi เคฐीเคฌूเค เคเคฐा.
๐ป Python เคोเคก
เคाเคฒीเคฒ เคोเคก เคตाเคชเคฐूเคจ เคเคชเคฃ เคธेเคจ्เคธเคฐเคเคกूเคจ เคคाเคชเคฎाเคจ เคตाเคू เคถเคเคคो:
# เคตเคฐीเคฒ เคंเค्เคฐเคी เคोเคก เคฏेเคฅे เคตाเคชเคฐू เคถเคเคคा (เคคेเค เคเคนे)
๐ เคธाเคฐांเคถ
เคนा เคธेเคจ्เคธเคฐ เคตाเคชเคฐूเคจ เคเคชเคฃ เคोเคฃเคค्เคฏाเคนी เคตเคธ्เคคूเคा เคคाเคชเคฎाเคจ เคจ เคธ्เคชเคฐ्เคถ เคเคฐเคคा เคฎोเคू เคถเคเคคो. เคนा เคช्เคฐोเคेเค्เค เคธ्เคฎाเคฐ्เค เคนोเคฎ, เคंเคกเคธ्เค्เคฐिเคฏเคฒ เคธेเคซ्เคी, เคต เคนॉเคธ्เคชिเคเคฒ เคธ्เค्เคฐीเคจिंเคเคธाเค ी เคเคชเคฏुเค्เคค เคเคนे! ๐ฅ๐ฅ
Comments