Shop OBEX P1 Docs P2 Docs Learn Events
MLX90614 IR temperature sensor issues — Parallax Forums

MLX90614 IR temperature sensor issues

fredsan42fredsan42 Posts: 8
edited 2009-05-29 05:59 in Accessories
I recently bought an MLX90614 infrared temperature sensor, but I can't seem to get it to respond to any commands. I'll note that I'm not using a BASIC Stamp, but I've got the MLX hooked up to +5V, GND, and the SIG line is connected to another chip, which is doing serial I/O at 2400bps. With an oscilloscope, I verified that the serial I/O looks correct to the best of my understanding, but the MLX doesn't respond to any commands.

I've tried doing a reset of the chip and then sending the 5 bytes: 0x0, "!ID", 0x5A, but the chip never responds. I've also tried sending a few other slave addresses, including 0x00, but still, nothing happens after I send the signal. Does the MLX expect 0V-5V for the serial I/O? Is there anything else I might be missing that would be automatic with a BASIC Stamp? Should all chips respond to 0x00?

Thanks.

Comments

  • dandreaedandreae Posts: 1,375
    edited 2009-02-13 16:33
    Yes, the MLX90614 infrared temperature sensor does expect the 0 to 5 volts for the serial·communication.



    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • Alex_NYAlex_NY Posts: 3
    edited 2009-04-22 17:37
    You have to write to the EEPROM first. [noparse][[/noparse]0,"!TEMW",$5A,$2E,$1A,"z"]. Then after cycling, you have to send 0,"!TEMc",$5A,$07.

    did it help?
  • will85irocwill85iroc Posts: 13
    edited 2009-05-01 00:04
    im also having trouble getting the module to respond, im using a pic16f767:
    here's what i'm sending at 9600 bps (bit-bang):

    1. set my i/o for output (xmit)
    2.·brief wait...· about 50ms
    3. xmit '0'
    4. xmit '!'
    5. xmit 'T'
    6. xmit 'E'
    7. xmit 'M'
    8. xmit 'R'
    9. xmit 0x5a
    10. xmit 0x07
    11. set my i/o for input (rcv)
    12. rcv byte1
    13. rcv byte2
    14. rcv byte3
    ·with my logic probe i get a constant 'low', the module is not xmitting anything back....
    fyi-im sending each byte with a start and stop bit...· any pic/assembly language programmers that could lead me in the right direction?
    i can post my routines if needed, thnx

    ··
  • will85irocwill85iroc Posts: 13
    edited 2009-05-01 11:31
    i think i got it work, i took out the 'reset' routine at the beginning of my program and now im getting something bk. ill check the output string and post it..·· btw, i measured a can of pop, my cell phone and a piece of ice, about 5=6" away..
    not sure if its correct yet, but we'll see....
    i left the module in default mode: i sent out '0' '!' 'T' 'E' 'M' 'R' '0x5a' '0x07' and rcv'd 3 bytes bk
    yeah.gif·
  • will85irocwill85iroc Posts: 13
    edited 2009-05-20 00:15
    hello again, for all pic users using assembly...cool.gif

    i finally got·the modules to work! i can now measure various·objects and get·somewhat accurate temps back from the module.

    i will post a schematic and block diagram of the program tomorrow in pdf....

    btw, does anyone know how far the 90 degree modules can·read? i've been measuring different things from about 6-8" ...

    thanks...···yeah.gif
  • ruperthartruperthart Posts: 17
    edited 2009-05-26 06:29
    I haven't made the device work. I need help.

    I have tried everything. I tried Alex's suggestions. I have tried the demo notes. I have tried not setting default values. I have tried setting the slave and xslave settings to all the examples I have seen. I have tried 2400 and 9600, both normal and inverted. I have never got a temperature reading that changed when I put my finger in front of the sensor.

    Does ANYONE have any simple code that actually works that they could post?

    The demo programs are too complicated and I just need a reading then I can add more complexity if I need it. Even Humanaido says you have to rewrite the programs anyway. Hope somebody can help!
    Thanks.
  • will85irocwill85iroc Posts: 13
    edited 2009-05-27 01:13
    after initializing your pic (uc), immediately 'set' your signal line (make high). also, tie the reset line to +5v. next, xmit '0' (zero) '!' 'T' 'E' 'M' in ascii caps. this alerts the module that you will be optioning it. next, send 'W' (write), 0x5a (default slave address), 0x2e (slaves eeprom address), 0x5a (leave 0x5a, u can always change..) and last, xmit 'C' (for continuos temp readings). wait about 10 ms (this is optional)...
    now, to rcv a temperature reading: xmit '0' '!' 'T' 'E' 'M' 'R' (read), 0x5a, 0x07 (temp address) then the module will xmit back 3 byte.
    the first byte the module xmits out is the low (lsb) byte for temp, followed by the high (msb) byte for temp and lastly the 'pec' bye (error correction). you can ignore the pec byte for now.
    **** note, when xmitting/rcving data into the module, it is in ascii format, lsb first ****
    ex.
    xmit 0x00 ; 0
    xmit 0x21 ; !
    xmit 0x54 ; T
    xmit 0x45 ; E
    xmit 0x4d ; M
    xmit 0x57 ; W - write
    xmit 0x5a ; current slave address
    xmit 0x2e ; eeprom location
    xmit 0x5a ; keep slave id the same
    xmit 0x43 ; C - continuos reading
    brief wait...
    xmit 0x00 ; 0
    xmit 0x21 ; !
    xmit 0x54 ; T
    xmit 0x45 ; E
    xmit 0x4d ; M
    xmit 0x52 ; R - read
    xmit 0x5a ; slave
    xmit 0x07 ; temp address
    ;
    rcv ; low byte
    rcv ; high byte
    rcv ; pec byte
  • will85irocwill85iroc Posts: 13
    edited 2009-05-27 01:25
    if your using a bit-bang format like me, 4800 bps is a good rate. if your using an on chip uart, 9600 is also good.
    remember, xmit and rcv lsb bit first and your signal line should start high and end high. i ignored 'rst' pin becuase it kept freezing the module, i had to power down and back up to get to get it to work again.
    when i measured a piece of ice from freezer i was getting around 2 degrees celcius, my hand measured around 30 degrees c and a can of soda around 9.
  • ruperthartruperthart Posts: 17
    edited 2009-05-28 07:21
    Ok, happy people, here is my code. I am using a PIC with Mbasic from Basic Atom. I still get nothing but zeroes.
    My guess is that initalizing the pic, setting signal high and setting input high etc are where the issue is. I could perhaps have fried the chip of course......Any ideas, folks? I am on version 43 and this is getting somewhat annoying. Hope some genius can help!
    Best, Rupert

    =========================================================================

    '
    [noparse][[/noparse] I/O Definitions ]

    Reset CON 3
    Alr CON 2
    Sensor CON 1

    '
    [noparse][[/noparse] Variables ]

    temperature VAR Word
    tempL VAR temperature.LOWBYTE
    tempH VAR temperature.HIGHBYTE
    pec VAR Byte

    Init:
    LOW Reset
    pause 50
    INPUT Reset

    Input sensor

    setSlaveAddress:
    SEROUT sensor,n2400,[noparse][[/noparse]0,"!TEMW",$5A,$2E,$5A,"C"]
    pause 10

    getTemperature:
    SEROUT Sensor,n2400,[noparse][[/noparse]0,"!TEMR",$5A,$07]
    pause 10
    SERIN Sensor,n2400,[noparse][[/noparse]tempL,tempH,pec]
    pause 10
    ' return

    displayTemperature:
    serout s_out,i2400,[noparse][[/noparse]DEC tempL, " , ",DEC tempH, 10,13]

    end
  • will85irocwill85iroc Posts: 13
    edited 2009-05-28 10:25
    hey rupert, donot reset the module using the reset then 50ms delay. just ignore the reset and tie to vcc. from my testing , doing a reset will cause the exact trouble your having... all zeros... initialize your pic and xmit the bytes givin earlier in this post. good luck
  • ruperthartruperthart Posts: 17
    edited 2009-05-28 21:47
    Thaks, friend, but still no joy. Have eliminated the reset low, and have in fact connected the rest pin of the device with a wire to 5V. No luck yet, still getting zeroes. Am assuming I have fried device somehow and have ordered another one. Maybe I will get it to work someday.

    Here's modified code:
    ' =========================================================================

    '
    [noparse][[/noparse] I/O Definitions ]

    Reset CON 3
    Alr CON 2
    Sensor CON 1

    '
    [noparse][[/noparse] Variables ]

    temperature VAR Word
    tempL VAR temperature.LOWBYTE
    tempH VAR temperature.HIGHBYTE
    pec VAR Byte

    Init:
    ' LOW Reset
    ' pause 50
    ' INPUT Reset

    ' Input sensor

    setSlaveAddress:
    SEROUT sensor,n2400,[noparse][[/noparse]0,"!TEMW",$5A,$2E,$5A,"C"]
    pause 10

    getTemperature:
    SEROUT Sensor,n2400,[noparse][[/noparse]0,"!TEMR",$5A,$07]
    pause 10
    SERIN Sensor,n2400,[noparse][[/noparse]tempL,tempH,pec]
    pause 10
    ' return

    displayTemperature:
    serout s_out,i2400,[noparse][[/noparse]DEC tempL, " , ",DEC tempH, 10,13]

    end
  • will85irocwill85iroc Posts: 13
    edited 2009-05-28 21:56
    you may bit bang the pic. your uart maynot be sEt correct ly... ill post a portion of my code tomorrow
  • will85irocwill85iroc Posts: 13
    edited 2009-05-28 22:56
    since the module xmits & rcv's on same I/o, make sure your changing the port pin to an input in your rcv routine
  • ruperthartruperthart Posts: 17
    edited 2009-05-29 05:59
    Hmm, I just copied the code. I will try. Look fwd to your code. And, hey, thanks!

    R
Sign In or Register to comment.