Hi, engineers from OpenMV.
I want to connect multi mlx90614 temperature sensors to OpeMV and I met some problem when I assigned unique address to them. I write a script in python below. Erase the address by setting them zeros (according to EEPROM memory address in datasheet, I attach it in attachments) and then write new address to them.
from pyb import I2C i2c=I2C(2,I2C.MASTER,baudrate=100000) #ir_1=MLX90614(i2c, addr=0x5A) def changeDirec (OldDirec, NewDirec): #print(i2c.mem_write( 0x2E ,OldDirec, 0X0E)) # send command for device to return address print('before:', i2c.mem_read(10, 0x5A, 0x0E, timeout = 20000)) i2c.mem_write( 0x00 ,OldDirec, 0x0E ,timeout =20000) # send zeros to erase i2c.mem_write(0x5B, OldDirec, 0x0E, timeout =20000) print('after:', i2c.mem_read(10, 0x5A, 0x0E, timeout = 20000)) #print('ok') changeDirec ( 0x5A , 0x5B ) #Change the address to the new value
and I have found some code for Arduino and I really want to try to rewrite them in python.Arduino - Leer multiples MLX90614 (termómetros infrarrojos) cambiando sus direcciones - Tecnología, Ofimática y Programación
Have you met situations like this? How would you change i2c address?
MLX90614.rar (1.07 MB)