MLX90614 IR temperature sensor issues
fredsan42
Posts: 8
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.
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
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Parallax Tech Support·
did it help?
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
··
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
·
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...···
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.
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
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.
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
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
R