Thermal Camera MLX90641 raspberry Pi 4 Grove Base Hat problem

Hi There,

I have purchased Raspberry pi 4, Grove Base HAT and Thermal Camera MLX90641,
and i following the step ini here :
https://wiki.seeedstudio.com/Grove-Thermal-Imaging-Camera-IR-Array/
but when i try to execute BasicReadings.py on the source example i got this error :
python3 BasicReadings.py
Traceback (most recent call last):
File “BasicReadings.py”, line 22, in
main()
File “BasicReadings.py”, line 6, in main
mlx = seeed_mlx9064x.grove_mxl90641()
File “/usr/local/lib/python3.7/dist-packages/seeed_mlx9064x.py”, line 746, in init
self._HammingDecode()
File “/usr/local/lib/python3.7/dist-packages/seeed_mlx9064x.py”, line 996, in _HammingDecode
raise RuntimeError(“check error”)
RuntimeError: check error

pi@raspberrypi:~/Downloads/Seeed_Python_MLX9064x/examples $ sudo ircamera I2C MLX90641
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’
Traceback (most recent call last):
File “/usr/local/bin/ircamera”, line 6, in
from seeed_python_ircamera import run
File “/usr/local/lib/python3.7/dist-packages/seeed_python_ircamera.py”, line 359, in
run()
File “/usr/local/lib/python3.7/dist-packages/seeed_python_ircamera.py”, line 352, in run
dataThread = DataReader(port,ChipType)
File “/usr/local/lib/python3.7/dist-packages/seeed_python_ircamera.py”, line 76, in init
self.dataHandle = seeed_mlx9064x.grove_mxl90641()
File “/usr/local/lib/python3.7/dist-packages/seeed_mlx9064x.py”, line 746, in init
self._HammingDecode()
File “/usr/local/lib/python3.7/dist-packages/seeed_mlx9064x.py”, line 1003, in _HammingDecode
raise RuntimeError(“cannot find check number”)
RuntimeError: cannot find check number

so how i can fix this??

Hi @sickgate:
can you give me a pic of the connection of MLX90641 and Grove Base HAT?

Hi, I am having a similar (if not the same) issue! When initializing the camera the code crashes here:

def _HammingDecode(self):
    parity = [0] * 5
    D = [0] * 16
    error = 0
    switcher = {
        16: 15,
        ...
        19: 0,
    }
    for addr in range(16,832):
        parity[0] = -1
        parity[1] = -1
        parity[2] = -1
        parity[3] = -1
        parity[4] = -1
        data = eeData[addr]
        mask = 1
        for i in range(16):
            D[i] = (data & mask) >> i
            mask = mask << 1
        parity[0] = D[0]^D[1]^D[3]^D[4]^D[6]^D[8]^D[10]^D[11]
        parity[1] = D[0]^D[2]^D[3]^D[5]^D[6]^D[9]^D[10]^D[12]
        parity[2] = D[1]^D[2]^D[3]^D[7]^D[8]^D[9]^D[10]^D[13]
        parity[3] = D[4]^D[5]^D[6]^D[7]^D[8]^D[9]^D[10]^D[14]
        parity[4] = D[0]^D[1]^D[2]^D[3]^D[4]^D[5]^D[6]^D[7]^D[8]^D[9]^D[10]^D[11]^D[12]^D[13]^D[14]^D[15]
        if (parity[0]!=0) or (parity[1]!=0) or (parity[2]!=0) or (parity[3]!=0) or (parity[4]!=0) :
            check = (parity[0]<<0) + (parity[1]<<1) + (parity[2]<<2) + (parity[3]<<3) + (parity[4]<<4)
            if (check > 15) and (check < 32):
                D[switcher[check]] = 1 - D[switcher[check]]
                if error == 0 :
                    raise RuntimeError("check error") # <--- CRASH HERE
                data = 0
                mask = 1
                for j in range(16):
                    data = data + D[j]*mask
                    mask = mask << 1
            else:
                raise RuntimeError("cannot find check number")

        eeData[addr] = data & 0x07FF

That’s line 996 of file seed_mlx9064.py.
Images you requested are here:

Hi @Lamba92
if you want to control mlx90641 you shound modify chip type to mlx90641 at the example code.

Indeed I am! I’m invoking seeed_mlx9064x.grove_mxl90641() to initialize the camera and the error pops up!

Hi @Lamba92:
thanks for your feedback . we will test it next week.