Alright I've tried doing the I2C scan again
I am now trying to get it to work without even implementing any library specifically. Here's the code:And the output of the code is:
Worth to mention, my whole project is on a breadboard and I have not yet soldered the SHT30 board to the goldpins it came with so the connection might be a little loose. Other things I have/plan on having in my project are: a 2x16 I2C LCD Display, SIM800L GSM Module and a 4x3 Keypad
Alright I've tried doing the I2C scan again and got two results. One result was an array from 8 to 119 and the next result that I now consistently get (if it does find the device) isTry to get the I2C scan working first. If you get stuck, you will need to do step-by-step troubleshooting,, and we will try to assist.
.Found I2C devices: [68]
I am now trying to get it to work without even implementing any library specifically. Here's the code:
Code:
from machine import I2C, Pinimport time[quote][/quote]I2C_ADDRESS = 0x44MEASURE_CMD = b'\x2C\x10'i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=100000)def read_temperature_humidity(): try: i2c.writeto(I2C_ADDRESS, MEASURE_CMD) time.sleep_ms(100) data = i2c.readfrom(I2C_ADDRESS, 6) if len(data) == 6: temp_raw = data[0] << 8 | data[1] hum_raw = data[3] << 8 | data[4] temperature = -45 + (175 * temp_raw / 65535) humidity = 100 * hum_raw / 65535 return temperature, humidity else: raise Exception("Invalid response length") except OSError as e: print(f"I2C communication failed: {e}") return None, Nonedevices = i2c.scan()if I2C_ADDRESS in devices: temp, hum = read_temperature_humidity() if temp is not None: print(f"Temperature: {temp:.2f} °C") print(f"Humidity: {hum:.2f} %") else: print("Failed to read data from sensor")else: print("Sensor not detected")
So it seems that my Rpi Pico can't even read data from the sensor. At least now I can get the sensor to be seen at all, but I'm still stuck.MPY: soft reboot
I2C communication failed: [Errno 5] EIO
Failed to read data from sensor
Worth to mention, my whole project is on a breadboard and I have not yet soldered the SHT30 board to the goldpins it came with so the connection might be a little loose. Other things I have/plan on having in my project are: a 2x16 I2C LCD Display, SIM800L GSM Module and a 4x3 Keypad
Statistics: Posted by Dethress — Thu Oct 17, 2024 5:36 pm