0

I'm using a raspberry pi pico to read data from a SHT3x sensor using the I2C protocol. I'm quite new to (micro)python so I used this example. This example is for a regular Raspberry Pi since I didn't find any for the Pico. However, the SMBus library is not found. I assume it is just not available for micropython (I have version 1.17).

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'smbus'

There seems to be only one micropython wrapper for SMBus (as far as I found), this one. When I use this wrapper, the problem I have and don't understand is the following error:

Traceback (most recent call last):
  File "<stdin>", line 8, in <module>
  File "usmbus.py", line 50, in write_i2c_block_data
TypeError: object with buffer protocol required

Refering to this line function: writeto_mem(addr, register, data) (documentation). The data that I pass in is as follows

addr = 0x44
register = 0x2C
data = [0x06]

I understood that it has something to do with framebuffer in micropython not being supported, but I don't understand how to fix it. Can someone help me out? Or suggest me other solutions?

1 Answer 1

0

If the sensor supports I2C, you should be able to use the builtin MicroPython I2C support.

I also found a library for the SHT3x, by searching on the MicroPython forum.

Your Answer

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

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