Yapay zekâ tarafından English dilinden çevrildi ·
Sorun tam olarak bu, ilk kurulumumda da aynı şeyi yapmıştım. I2C pinleri fiziksel pin 3 (BCM GPIO2, SDA) ve fiziksel pin 5 (BCM GPIO3, SCL). Sen SDA’yı aslında SCL olan GPIO3’e, SCL’yi ise fiziksel pin 29 olan ve hiç I2C olmayan GPIO5’e bağlamışsın. Bu yüzden veriyolunda yanıt veren bir cihaz yok ve boş tablo görüyorsun. Sensörlerin büyük ihtimalle sağlam.SDA’yı fiziksel pin 3’e, SCL’yi fiziksel pin 5’e taşı; o zaman BME280 için 0x77 (ya da SDO jumper’ına bağlı olarak 0x76) ve VEML7700 için 0x10 görmelisin. Pi’nin bu iki pinde zaten 1.8 kΩ pull-up dirençleri var ve breakout kartları da kendi dirençlerini ekliyor, o yüzden fazlasını ekleme.Okuma ve gönderme kısmı da kısa. Ben Adafruit CircuitPython sürücülerini ve paho’yu kullanıyorum:
import json, time, board, adafruit_bme280.basic as bme, adafruit_veml7700
import paho.mqtt.client as mqtt
i2c = board.I2C()
env = bme.Adafruit_BME280_I2C(i2c, address=0x77)
lux = adafruit_veml7700.VEML7700(i2c)
c = mqtt.Client(client_id="lab-env-01")
c.username_pw_set(TOKEN) # token as username, no password
c.tls_set()
c.connect(BROKER_HOST, 8883, 60)
c.loop_start()
while True:
msg = {"temp_c": round(env.temperature, 2), "rh": round(env.humidity, 1),
"pressure_hpa": round(env.pressure, 1), "lux": round(lux.lux, 1)}
c.publish("v1/telemetry", json.dumps(msg), qos=1)
time.sleep(30)
Düz bir nesne, bu yüzden Hermetry 30 saniyelik okumalar için alındığı zamanı damgalar, bu yeterli. Zaman damgası eklemek istersen payload kuralları burada: MQTT topics and payload reference.
That’s the problem, I did exactly the same thing on my first build. The I2C pins are physical pin 3 (that’s BCM GPIO2, SDA) and physical pin 5 (BCM GPIO3, SCL). You have SDA on GPIO3, which is actually SCL, and SCL on GPIO5, which is physical pin 29 and not I2C at all. So the bus has no device answering and you get the empty grid. The sensors are almost certainly fine.
Move SDA to physical pin 3 and SCL to physical pin 5, then you should see 0x77 (or 0x76, depends on the SDO jumper) for the BME280 and 0x10 for the VEML7700. The Pi has 1.8 kΩ pull-ups on those two pins already, and the breakouts add their own, so don’t add more.
Then reading and sending is short. I use the Adafruit CircuitPython drivers plus paho:
import json, time, board, adafruit_bme280.basic as bme, adafruit_veml7700
import paho.mqtt.client as mqtt
i2c = board.I2C()
env = bme.Adafruit_BME280_I2C(i2c, address=0x77)
lux = adafruit_veml7700.VEML7700(i2c)
c = mqtt.Client(client_id="lab-env-01")
c.username_pw_set(TOKEN) # token as username, no password
c.tls_set()
c.connect(BROKER_HOST, 8883, 60)
c.loop_start()
while True:
msg = {"temp_c": round(env.temperature, 2), "rh": round(env.humidity, 1),
"pressure_hpa": round(env.pressure, 1), "lux": round(lux.lux, 1)}
c.publish("v1/telemetry", json.dumps(msg), qos=1)
time.sleep(30)
Flat object, so Hermetry stamps it with the receive time, fine for 30 s readings. Payload rules are here if you want to add timestamps later: MQTT topics and payload reference.

