How to use the MLX90614ESF-AAA TO-39 Temperature sensor?

henriksod

Member
Hello, I am making a robot that will be able to detect objects (lifeforms) from a distance based on the heat they emit. I have bought a MLX90614ESF-AAA (TO-39), which, as described by the vendor, should be able to do the task that I am after.

This is where I bought it from. Including some description and preferences of the component:
https://www.elfa.se/elfa3~se_sv/elfa/init.do?item=73-215-65&toc=19605

I didn't get a manual of any sort on how it is used, so I came here to ask you guys; how is the component used in terms of programming and using it on a picaxe and what are the possibilities with this component in terms of sending the data to the picaxe regarding finding and tracking an object? Also, I would really like to know what is the best wiring solution for this component to the picaxe if I've got a AXE408 Robot Shield and a
AXE401 PICAXE Shield Base?

I'm sorry if I confused anyone. I am really new to this kind of stuff and I actually can't find any guidelines on how to use this component anywhere whatsoever.

EDIT #1: I've found a document describing the sensor. Maybe it can help you to help me. What I want to know is how I should program this on a picaxe so the picaxe can use the data recieved by the sensor.
https://www1.elfa.se/data1/wwwroot/assets/datasheets/suMELEXIS_IR-tempsensor_EN.pdf

EDIT #2:
It's a temperature sensor, there is no spatial information in the output. Given that you are mounting on a robot, you could make the platform swing around to search what direction the strongest signal is. Unfortunately there's no meaningful "signal strength" output either, you get a temperature. So you could swing around to determine where maximum temperature is, as an approximation of the direction of your target.

These sensors can be used in multiple, have you considered an array of two/three/four to give you a sense of direction with less scanning?
Yes, thanks for mentioning that. I have actually thought about using two sensors which could help determining the direction in which the robot should look to face the object. The problem, though is that I am still stuck on how to connect this sensor to my PICAXE. I am using a PICAXE Instant Robot Shield and from what I read on the documentation and from what I am seeing on the shield, the S.12 pin which handles the hspi sdi / hi2c sda is used by the shield, so how will I manage to link the SDA to the picaxe? The same goes for the SCL. So, to make things short; how do I manage to connect the MLX90614ESF to a preassembled AXE408 Instant Robot Shield? I believe it has something to do with the BUFF 12 and BUFF 13, but I am not sure, since there are two inputs for each BUFF: + and -.

Here is the documentation:
http://www.picaxe.com/docs/axe408.pdf
 
Last edited:

russbow

Senior Member
The MLX series use I2C for communication so are very easy to interface with Picaxe.

Do a forum search for MLX* and you will get plenty of threads to help you.
 

henriksod

Member
Thank you for your replies. They are very appreciated. I have another question that I would like answered if you may; how will I connect the MLX90614ESF to the picaxe for Peter Anderson's code to work for example:
Code:
' MLX90614_1.Bas
'
' Continually measures and displays T_ambient and T_object.
'
' PICAXE-20X2               MLX90614ESF-AAA
'
' Term 11 SCL --------------- SCL
' Term 13 SDA --------------- SDA
'
' 4.7K resistors to +5 VDC on SDA and SCL
'
' Note that this is a direct interface with the PICAXE.  The Parallax and
' Sparkfun boards are not required.
' 
' copyright, Peter H Anderson, Baltimore, MD, Mar 12, 11

#picaxe 20x2
#Terminal 9600
#No_Table
#No_Data
#freq m4

Symbol Lo = B0
Symbol Hi = B1
Symbol PEC = B2
Symbol Status = B3
Symbol Whole = B4
Symbol Fract = B5
Symbol Val = W3
Symbol TC_100 = W4
Symbol SlaveAdr_2 = B10
Symbol RamLocation = B11
Symbol X = B12
Symbol N = B13
Symbol CRC8 = B14

Top:

    Hi2cSetup I2CMaster, 45, I2CSlow, I2CByte 

    SlaveAdr_2 = $00 * 2 ' use general slave adr

Again:

    RamLocation = $06 ' ambient temperature

    GoSub ReadRAM
    If Status = 1 Then
       TC_100 = Val * 2 - 27315
       SerTxD ("T_ambient = ") 
       GoSub DisplayTc
       
    Else
       SerTxD ("T_ambient - Error")
    End If

    SerTxD (",  ")

    RamLocation = $07 ' ambient temperature

    GoSub ReadRAM
    If Status = 1 Then
       TC_100 = Val * 2 - 27315
       SerTxD ("T_object = ") 
       GoSub DisplayTc
    Else
       SerTxD ("T_object - Error")  
    End If
      
    SerTxD (CR, LF)

    Pause 1000
    GoTo Again

ReadRAM:
      
    Hi2cin [SlaveAdr_2], RamLocation, (Lo, Hi, PEC)

    Val = Hi
    Val = Val * 256 + Lo
   
    'SerTxD ("Hello ", #TC_100, "  ", #PEC, CR, LF)
                        
    CRC8 = $00
    X = SlaveAdr_2
    GoSub CalcCRC8
    X = RamLocation
    GoSub CalcCRC8
    X = SlaveAdr_2 + 1
    GoSub CalcCRC8
    X = Lo
    GoSub CalcCRC8
    X = Hi
    GoSub CalcCRC8
    X = PEC
    GoSub CalcCRC8

    'SerTxD ("CRC = ", #CRC8, CR, LF)
    If CRC8 = 0 Then
       Status = 1 ' success
    Else
       Status = 0
    Endif
    
    Return

DisplayTc:

    Whole = TC_100 / 100
    Fract = TC_100 // 100

    SerTxD (#Whole, ".")
    If Fract < 10 Then
        SerTxD ("0")
    Endif
    SerTxD (#Fract)

    Return
   
CalcCRC8:

   X = X ^ CRC8
   For N = 0 to 7
      If X > 127 Then
         X = X * 2
         X = X ^ $07
      Else
         X = X * 2
      Endif
   Next
   CRC8 = X
   Return
I am pretty new to BASIC and PICAXE programming, so any help given is very appreciated!

One thing to note is that I am making a robot that will be able to just notice objects with a given temperature (37 degrees celsius for example) and to track that object from which direction it is leaving the sensor's field of view (if possible). How would I manage to do that in the easiest way using the MLX90614ESF?
 

eclectic

Moderator
Thank you for your replies. They are very appreciated. I have another question that I would like answered if you may; how will I connect the MLX90614ESF to the picaxe for Peter Anderson's code to work for example:
Code:
' MLX90614_1.Bas
'
' Continually measures and displays T_ambient and T_object.
'
' PICAXE-20X2               MLX90614ESF-AAA
'
' Term 11 SCL --------------- SCL
' Term 13 SDA --------------- SDA
?[/QUOTE]

Please see Manual 1, 

[URL]http://www.picaxe.com/docs/picaxe_manual1.pdf[/URL]

Page 30.

11 and 13 are also "legs"


e
 

rossko57

Senior Member
One thing to note is that I am making a robot that will be able to just notice objects with a given temperature (37 degrees celsius for example) and to track that object from which direction it is leaving the sensor's field of view (if possible). How would I manage to do that in the easiest way using the MLX90614ESF?
It's a temperature sensor, there is no spatial information in the output. Given that you are mounting on a robot, you could make the platform swing around to search what direction the strongest signal is. Unfortunately there's no meaningful "signal strength" output either, you get a temperature. So you could swing around to determine where maximum temperature is, as an approximation of the direction of your target.

These sensors can be used in multiple, have you considered an array of two/three/four to give you a sense of direction with less scanning?
 

henriksod

Member
It's a temperature sensor, there is no spatial information in the output. Given that you are mounting on a robot, you could make the platform swing around to search what direction the strongest signal is. Unfortunately there's no meaningful "signal strength" output either, you get a temperature. So you could swing around to determine where maximum temperature is, as an approximation of the direction of your target.

These sensors can be used in multiple, have you considered an array of two/three/four to give you a sense of direction with less scanning?
Yes, thanks for mentioning that. I have actually thought about using two sensors which could help determining the direction in which the robot should look to face the object. The problem, though is that I am still stuck on how to connect this sensor to my PICAXE. I am using a PICAXE Instant Robot Shield and from what I read on the documentation and from what I am seeing on the shield, the S.12 pin which handles the hspi sdi / hi2c sda is used by the shield, so how will I manage to link the SDA to the picaxe? The same goes for the SCL. So, to make things short; how do I manage to connect the MLX90614ESF to a preassembled AXE408 Instant Robot Shield? I believe it has something to do with the BUFF 12 and BUFF 13, but I am not sure, since there are two inputs for each BUFF: + and -.

Here is the documentation:
http://www.picaxe.com/docs/axe408.pdf
 
Last edited:

henriksod

Member
Bump. I am doing this for my exam project and need your help. If there is anything that seem unclear, please tell me and I will try to explain my situation further.
 

westaust55

Moderator
I believe that you will need to make the i2c connections at S.12 and S.13 for direct connection to the PICAXE i2c comms signal lines.
Do not connect via BUF 12 and BUF 13 as these have the darlington transistors and will prevent the bi-directional signals working.
Even for the points S.12 and S.13 there are 10 kOhm pull down resistors for the buffer (12 and 13) transistors which may affect the operation of the i2c comms bus. The usual i2c bus pull-up resistors on the i2c Clock and Data lines are typically 4k7 Ohm but you may need to try say 3k9 Ohm resistors to help overcome the influence of the 10 kOhm pull-down resistors on these two lines on the AXE408 Shield. Alternately look to removing these two 10 kOhm resistors.

Do not forget to remove the jumper/link H4 on the AXE401 board to isolate the LED that might also affect the i2c comms port.
also on the AXE401 board for i2c comms add the two 4k7 pull-up resistors in position R5 and R6 (i2c communication with the PICAXE system uses pins S.12 and S.13).
 
Last edited:

henriksod

Member
I believe that you will need to make the i2c connections at S.12 and S.13 for direct connection to the PICAXE i2c comms signal lines.
Do not connect via BUF 12 and BUF 13 as these have the darlington transistors and will prevent the bi-directional signals working.
Even for the points S.12 and S.13 there are 10 kOhm pull down resistors for the buffer (12 and 13) transistors which may affect the operation of the i2c comms bus. The usual i2c bus pull-down resistors on the i2c Clock and Data lines are typically 4k7 Ohm but you may need to try say 3k9 Ohm resistors to help overcome the influence of the 10 kOhm resistors on these two lines. Alternately look to removing these two 10 kOhm resistors.

Do not forget to remove the jumper/link H4 on the AXE401 board to isolate the LED that might also affect the i2c comms port.
also on the AXE401 board for i2c comms add the two 4k7 pullup resistors in position R5 and R6 (i2c communication with the PICAXE system uses pins S.12 and S.13).
Could I please get some sort of an illustration on what I have to do? I now know that I will have to solder on 4k7 resistors on the R5 and R6, and that I will need to remove the jumper on H4 to enable i2c, but I still don't get how I am supposed to use the S.12 and S.13 while they are used by the shield? Should I remove the pins from the shield using S.12 and S.13 or what should I do?
 

westaust55

Moderator
You could leave out the coresponding pins on the AXE408 shield and then buy some right angle header pins to bring the i2c comms out to the side direct from the AXE401 board.

It depends on how permanent your project is and whether you are willing to make some cuts on your AXE408 board.
I do not have an AXE408 to tell you where but it may be possible to isolate the S.12 and S.13 lines on the AXE408 board and then wire and solder direct to the AXE408 header pins.
 

henriksod

Member
Okay, thank you for giving me the direction. So, If I do as you said and skip the AXE408's 12 and 13, how will this affect the AXE408 board? Will it still work as before except for the BUFF 12 and 13?
 

henriksod

Member
Bump. Also, there are four pins on the MLX. How should I wire this correctly with the picaxe board? I now know that SDA goes to s.12 and SCL goes to s.13, but what about the VDD (Power Supply) and the VSS (Ground)? Where should I wire those pins for everything to work properly? Where are the counterparts for s.12 and s.13?
 

westaust55

Moderator
Based on the link you provided at post 1 you have a 5 V version but there is also a 3 V version.
https://www1.elfa.se/data1/wwwroot/assets/datasheets/suMELEXIS_IR-tempsensor_EN.pdf
YOU may wish to verify exactly which version you have purchased.

If you look on the AXE408 dastaheet it shows on the left side of the overall board terminal layout the pins for 5V, 3.3V and Gnd.
Depending on your version of sensor connect Vcc/Vdd to the AXE408 5V or 3V3 pins and the Vss/Gnd of the sensor to Gnd on the AXE408
 

henriksod

Member
Yeah, I've seen that. But they are soldered to pins that go down to the AXE401 below. I can't possibly use the same pin for multiple connections, can I?

Here's a picture:
bot.jpg
 
Last edited:

westaust55

Moderator
Okay, thank you for giving me the direction. So, If I do as you said and skip the AXE408's 12 and 13, how will this affect the AXE408 board? Will it still work as before except for the BUFF 12 and 13?
Yes, the rest of the AXE408 will work as normal.
 

westaust55

Moderator
Yeah, I've seen that. But they are soldered to pins that go down to the AXE401 below. I can't possibly use the same pin for multiple connections, can I?
Yes you can - those are power supply pins bringing power from the AXE401 to the AXE408 board.
It would be ideal if those pins were the longer type so you could place a section of header socket over them.

Alternatives are:
1. if you know you will not use the IR receiver, use the power supply pins assigned for that sensor ( if you have a 5V sensor)
2. As above if you do not in intend to use the ultrasonic range (ping) sensor
3. Find spare power supply pads with the correct voltage on the AXE401 board.

I do not have these boards and we do not know what other sensors you have/want to connect.
 

henriksod

Member
I've connected an ultrasonic sensor on the SRF005 slots, so that makes the PING slots available, right? Alright, so this is how I will connect the thermal sensor then:

SDA => s.12
SCL => s.13
VDD => PING 5V
VSS => PING 0V (GND)
 
Top