Shop OBEX P1 Docs P2 Docs Learn Events
MLX90614 sensor driver — Parallax Forums

MLX90614 sensor driver

Paul BakerPaul Baker Posts: 6,351
edited 2008-11-03 19:42 in Propeller 1
Here is a driver for the MLX90614 non-contact temperature sensor. MLX90614_test.spin is the top level object. A 1 kOhm resistor must be used between the sensor RST pin and the Propeller, or the device won't work (though I've found using the device in non-sleep mode operation, as is done in this driver, can·leave the RST line·unconnected).·

The object will be posted in the normal places when I have gotten an internal review.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer

Parallax, Inc.

Comments

  • ratronicratronic Posts: 1,451
    edited 2008-09-20 03:09
    Thanks Paul !

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fix it, if it ain't broke·
    D Rat


    Dave Ratcliff· N6YEE
  • JamesxJamesx Posts: 132
    edited 2008-10-13 15:08
    Nice! This is just what I was looking for.

    I recently purchased a MLX90614 module from Parallax, and it works pretty much as advertised. But it has whetted my interest in MORE. Now I'm trying to figure out how to have a Propeller drive it instead of the SX-helper. This driver from looks like just the item.

    By the way, the PBasic software examples that Parallax makes available with the MLX90614 module do not work properly. The calculations of the Celsius values (integer and decimal) are incorrect. If anyone's interested I can provide a working solution.

    Jim
  • TimmooreTimmoore Posts: 1,031
    edited 2008-10-13 17:50
    Jamesx, If you mean hooking the MLX90614 sensor SMBUS directly to the prop rather than connecting the SX serial interface to the prop, it does work but from experience check the max times in the datasheet, the sensor has max clock times as well as min clk times and you have to obey them. The normal I2C code from obex will not work, it doesn't follow the max times. The other thing to be careful with is putting it on a bus with I2C devices, talking to a I2C device will often put the MLX90614 to sleep, the wakeup procedure is in the datasheet but it might be easier to put it on separate pins.
  • JamesxJamesx Posts: 132
    edited 2008-10-13 19:23
    Timmore: I was mixed up about the code that was posted here, as it is but a version of the PBasic program that accesses the MLX90614 module. It is not the spin/pasm driver I had hoped for.

    You refer to such a driver: I wonder if by chance do you have a spin/pasm driver for the MLX90614 that you'd consider posting?

    Jim
  • TimmooreTimmoore Posts: 1,031
    edited 2008-10-13 20:45
    ok, heres an archive of the driver and test code. Several things to be careful of
    1. I have changed several of the other modules since I used this test code, so its possible that I broke this code, though I haven't changed the MLX driver. In particular I got the I2cscan working with the MLX and I have since changed it. I believe its working since it detects the mlx in another project I am using it in but YMMV.
    2. The MLX I got didn't have a SMBUS address configured. If you look at the start of the mlx test code you can see some WriteEEProm calls commented out. These calls programs the normal SMBUS address, if you have the same problem, check this.
    3. I had so many problems with this sensor, I ended up powering it from a prop pin so I could power it down and up easy. I haven't had any problems doing this but its something to watch.
    4. The MLX90614Object is in another project and has been running without problems so many of the problems i had may have just been getting the driver correct.
    Couple of other comments
    1. The code is all in spin and I started from the Basic_I2C_Driver but inlined a lot of code to meet the timing requirements of the SMBus
    2. The conversion code is from Pauls MLX code
  • JamesxJamesx Posts: 132
    edited 2008-10-14 00:35
    Timmoore

    Thanks. It looks like a good place to start. I'll let you know when I get it working (might be a couple of weeks, given everything).

    Jim
  • JamesxJamesx Posts: 132
    edited 2008-11-03 19:42
    Timmore

    Your MLX90614 drivers are a good place to start. I used the file you uploaded to turn on the device. There are a couple of things that don't quite make sense, but I'm making progress:

    -the drivers work, and temperature can be measured
    -the MLX90614 documentation suggests the factory-set SMBus address for the devices is preset at $5A. I couldn't contact them at that address, but it did work at $00, $01, $02, $03. As I read it, it should only have worked at $00, and maybe $5A, so I'm not sure what's going on here.
    -Using the code in MLX90614Object to write to the EEPROM doesn't seem to work--I'm chipping away at it though, and am hopeful of success.

    Got any ideas about the device addressing or writing to EEPROM?

    Thanks,

    Jim
Sign In or Register to comment.