HI, engineers from OPENMV!

I am a newcomer and I just met some problems when connecting my openmv to a mlx90614 temperature sensor. i guess it is the connection problem since I have try to i2c.scan() and no valid address returned.

this is my code and how i connect the wires.

# This example is to get the ambient temperature and object temperature by the I2C bus
# Hardware : MLX90614, OpenMV
# connect I2C
#   MLX90614  OpenMV
#   VCC       VCC
#   GND       GND
#   SCL       SCL
#   SDA       SDA

from pyb import I2C
import time
_MLX90614_IIC_ADDR   = (0x5A)
_MLX90614_TA         = (0x06)
_MLX90614_TOBJ1      = (0x07)

class MLX90614:
  def __init__(self,i2c,addr=_MLX90614_IIC_ADDR):

  def getObjCelsius(self):
    return self.getTemp(_MLX90614_TOBJ1)	#Get celsius temperature of the object

  def getEnvCelsius(self):
    return self.getTemp(_MLX90614_TA)    #Get celsius temperature of the ambient

  def getObjFahrenheit(self):
    return (self.getTemp(_MLX90614_TOBJ1) * 9 / 5) + 32  #Get fahrenheit temperature of the object

  def getEnvFahrenheit(self):
    return (self.getTemp(_MLX90614_TA) * 9 / 5) + 32 #Get fahrenheit temperature of the ambient

  def getTemp(self,reg):
    temp = self.getReg(reg)*0.02-273.15             #Temperature conversion
    return temp

  def getReg(self,reg):
    data = self.i2c.mem_read(3,self.addr,reg)               #Receive DATA
    result = (data[1]<<8) | data[0]
    return result


while True:
  print("Object  %s *C"% ir.getObjCelsius())        #print celsius of Object
  print("Object  %s *F"% ir.getObjFahrenheit())     #print fahrenheit of Object
  print("Ambient %s *C"% ir.getEnvCelsius())        #print celsius of Ambient
  print("Ambient %s *F"% ir.getEnvFahrenheit())     #print fahrenheit of Ambient


Hi, you need pull up resistors on the I2C lines. The OpenMV Cam doesn’t pull the lines up by default. I2C Scan should work once you do that.

Thank you very much for your reply. I check my sensor and it is integrated with pull up resistors.


I think you’re connecting VIN to VIN, that’s the power input pin on the OpenMV cam. You should connect the sensor’s VIN to 3.3/vout.

Thank you very much!!! It really fixes my problem!! OpenMV is really a easy-to-use product!