how to change i2c device address (Multi mlx90614 sensors)

Discussion related to "under the hood" OpenMV topics.
Raul_
Posts: 7
Joined: Fri Jan 11, 2019 8:19 am

how to change i2c device address (Multi mlx90614 sensors)

Postby Raul_ » Tue Jan 22, 2019 4:48 am

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.

Code: Select all

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.https://ofimatica-programacion.blogspot ... 90614.html

Have you met situations like this? How would you change i2c address?
Attachments
MLX90614.rar
(1.07 MiB) Downloaded 42 times
User avatar
kwagyeman
Posts: 3207
Joined: Sun May 24, 2015 2:10 pm

Re: how to change i2c device address (Multi mlx90614 sensors)

Postby kwagyeman » Tue Jan 22, 2019 12:07 pm

Um, what's the issue you are having? If the camera does the I2C action to change the address... then you are find right?
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 14 guests