So I wanted to test a sensor I have on the pi, the sensor has on-board level switchers supports both 5V and 3.3V with a 10k pull-up resistor for both SCL/SDA, Mistakenly I wired the Vin into the 5V pin instead of the 3.3V pin. I measured the voltage at the SDA/SCL pins and read 3.6V. the sensor consumes 2.6 mA at 3.3V and 3.0 mA at 3.6V. I ran
i2cdetect -y 1 and returned the following
which is the default address of the sensor.
an error occurs when I run the following script(python3)
import time import board import adafruit_sgp40 i2c = board.I2C() # uses board.SCL and board.SDA sgp = adafruit_sgp40.SGP40(i2c) while True: # For compensated raw gas readings """ compensated_raw_gas = sgp.measure_raw( temperature=temperature, relative_humidity=humidity ) print("Raw Data:", compensated_raw_gas) """ # For Compensated voc index readings voc_index = sgp.measure_index( temperature=temperature, relative_humidity=humidity) print("VOC Index:", voc_index) print("") time.sleep(1)
connections were checked multiple times with a successful continuity test,I tested two sensors with the same error. both sensors are connected using STEMMA QT wires. Searched about the error and most sources say it is a physical connection issue however the sensor is detected. any help is highly appreciated, Thanks in advance
‘ Traceback (most recent call last):’ ‘File "/home/nada/Desktop/sensor.py", line 23, in <module>’ ‘sgp = adafruit_sgp40.SGP40(i2c)’ ‘File "/usr/local/lib/python3.9/dist-packages/adafruit_sgp40/_init_py",line 123, in _init_ self.initialize ()’ File "/usr/local/lib/python3.9/dist-packages/adafruit_sgp40/__init_ _py", line 146, in initialize self_test = self._read_word_from_command(de lay_ms=250) File "/usr/local/lib/python3.9/dist-packages/adafruit_sgp40/_init_-py',line 293, in _read_word_from_command 12c. readinto (replybuffer, end=-replylen) File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py",line 81, in readinto self.i2c.readfrom_into(self.device_address, buf, start=start, end=end) File "/usr/local/lib/python3.9/dist-packages/busiopy", line 193, in readfrom_into return self.. _i2c.readfrom_into(address, buffer, stop=stop) File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py",line59,inreadfrom_into readin = self._i2c_bus.read_bytes(address, end - start) File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureI0/smbus.py",line 170, in read_ bytes return self ._device.read(number) SError: [Errno 121] Remote I/0 error