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?

Bas de Jong
  • 13
  • 2
  • 4

1 Answers1

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.

nekomatic
  • 5,988
  • 1
  • 20
  • 27