Thermal Sensor
Thermal Sensor
The thermal/temperature sensor is perfect for projects like weather stations and home automation systems. Few sensors are this easy to set up on the Raspberry Pi. They’re the same size as a transistor and use only one wire for the data signal. They’re also extremely accurate and take measurements quickly. The only other component you need is a 4.7K Ohm or 10K Ohm resistor.
TECHNICAL SPECIFICATIONS
- -55°C to 125°C range
- 3.0V to 5.0V operating voltage
- 750 ms sampling
- 0.5°C (9 bit); 0.25°C (10 bit); 0.125°C (11 bit); 0.0625°C (12 bit) resolution
- 64 bit unique address
- One-Wire communication protocol
This is the location of the Temperature sensor on the board.
Following python code can be used to run the temperature sensor and display temperature on terminal.
1 2 3 4 5 6 7 8 9 10 |
import os import glob import time os.system('modprobe w1-gpio') os.system('modprobe w1-therm') base_dir = '/sys/bus/w1/devices/' device_folder = glob.glob(base_dir + '28*')[0] device_file = device_folder + '/w1_slave' |