Enable I2C on your Raspberry
sudo raspi-config
- Interfacing Options
I2C - > Enable
Load I2C Kernel Module by default
vi /etc/modules and add
i2c-bcm2708
i2c-dev
raspi-config already added /boot/config
dtparam=i2c_arm=on
reboot
apt-get install python-smbus
apt-get install i2c-tools
Wiring:
Link zum Shop
BME280 (GND) -> Raspberry GND
BME280 (VCC) -> Raspberry 3V (PIN 1)
BME280 (SDA/SDI) -> Raspberry GPIO 2 (PIN 3)
BME280 (SCL/SCK) -> Raspberry GPIO 3 (PIN 5)
Testing I2C
i2cdetect -y 1
should give you something like:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
Python-Script:
Ausgabe:
temp : 20.56
pressure : 1012.95 hPa
hum : 43.97