0

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 followingi2cdetect -y 1

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)

ERROR enter image description here

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

enter image description here

10
  • Check that the code is using bus 1 (GPIO 2/3) rather than bus 0 (GPIO 0/1). Some Python modules default to bus 0 and you need it to use bus 1.
    – joan
    Jul 13, 2023 at 20:58
  • Checked the library couldn’t find any information on the bus. I ran the code in cmd error happen when creating the object “sgp”nevertheless I declared bus 1 in the script. The sensor has I2C address of 0x59. import time import board import adafruit_sgp40 import smbus i2c = board.I2C() # uses board.SCL and board.SDA bus=smbus.SMBus(1) sgp = adafruit_sgp40.SGP40(i2c)
    – Zak
    Jul 13, 2023 at 22:37
  • 1
    DO NOT post illegible pictures of text post TEXT
    – Milliways
    Jul 13, 2023 at 22:46
  • @Milliways, I got you. Post was edited, tried to format it using “code” function it didn’t work for some reason. It’s a [Errno 121] Remote I/0 error
    – Zak
    Jul 13, 2023 at 23:04
  • 2
    @Seamus The software is reading the device directly. It does not need a driver.
    – joan
    Jul 14, 2023 at 7:31

1 Answer 1

0

You are unlikely to have damaged the Pi.

The Pi has on board 1.8k pullup to 3.3V so effectively you put 3.55V on the pins which would not have caused the substrate diodes to conduct.


While you may not have damaged the GPIO continuing to use excessive voltage will compromise logic levels.

You should remove the extraneous pullups.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.