News:

;) This forum is the property of Proton software developers

Main Menu

MLX90614 using problem

Started by oguztkn, Sep 20, 2021, 08:33 PM

Previous topic - Next topic

oguztkn

Hi,

I am trying to use the MLX90614 sensor. But I couldn't find any sample project. How are temperature calculations done? Can you help me please.

pic:16f627


oguztkn

Yes, but I could not do it.

START:

I2CRead SDA, SCL, $B4, $04, [DEGER[0]]
PAUSE 100
I2CRead SDA, SCL, $B4, $05, [DEGER[1]]
PAUSE 100
I2CRead SDA, SCL, $B4, $06, [DEGER[2]]
PAUSE 100
I2CRead SDA, SCL, $B4, $07, [DEGER[3]]
PAUSE 100
I2CRead SDA, SCL, $B4, $08, [DEGER[4]]

tempk = ((DEGER[3] << 8))
tempk=tempk + DEGER[2]
temp = (((tempk * 9)/5) +32);

SEROUT2 PORTB.1,84,[Dec tempk,13,10]


incoming data is inconsistent. 18121,22922,20910,19202, etc.

normnet

The SEROUT2 line is tempk in place of temp if that helps at all.

Hopefully you aren't exceeding the variable tempk within the calculation?

Also you shouldn't require parenthesis on both the far left and right of the calculations.

normnet

#4
Have you studied SMBus communication with MLX90614?

Pseudo code example: Reading RAM address 0x07 (Tobj1)
1. Send START bit
2. Send Slave Address (0x00* for example) + Rd\-Wr bit**
3. Send Command (0b000x_xxxx + 0b0000_0111 -> 0b0000_0111)
4. Send Repeated START_bit
5. Send Slave Address + Rd\-Wr bit**
6. Read Data Byte Low (master must send ACK bit)
7. Read Data Byte High (master must send ACK bit)
8. Read PEC (master can send ACK or NACK)
9. Send STOP bit



Frizie


SYMBOL MLX_Dta1  = PORTB.0    ;I: Datapin  of the MLX90614
SYMBOL MLX_Clk   = PORTB.1    ;Q: Clockpin of the MLX90614
SYMBOL MLX_Adres = 0          ;Adres of the MLX90614, infra-red (contactless) digital temperature-sensor
SYMBOL MLX_Ta    = $06        ;T-A    Temperature Ambient, internal temperatuur of the sensor
SYMBOL MLX_Tobj1 = $07        ;T-Obj1 Temperature Object, temperature of the object to be measured

DIM Celsius      AS WORD      ;Contains the degrees Celsius, can rise above 255°C, thus WORD!
DIM SensorTemp   AS WORD      ;Measured Kelvin temperature from the MLX90614 temperature sensor

I2CIN MLX_Dta1, MLX_Clk, MLX_Adres, MLX_Tobj1, [SensorTemp.LOWBYTE, SensorTemp.HIGHBYTE]

Celsius = (SensorTemp / 50) - 273     ;Convert measured temperature in Kelvin to Celsius


The example above measures the temperature of the object.
The object to be measured must not be hotter than 380°C.
It is also possible to measure the temperature of the sensor itself (it must not exceed 125 degrees Celsius).
Then fill in:


I2CIN MLX_Dta1, MLX_Clk, MLX_Adres, MLX_Ta, [SensorTemp.LOWBYTE, SensorTemp.HIGHBYTE]


Regards,
Frizie.
Ohm sweet Ohm | www.picbasic.nl

oguztkn

Quote from: Frizie on Sep 21, 2021, 07:17 AMSYMBOL MLX_Dta1  = PORTB.0    ;I: Datapin  of the MLX90614
SYMBOL MLX_Clk   = PORTB.1    ;Q: Clockpin of the MLX90614
SYMBOL MLX_Adres = 0          ;Adres of the MLX90614, infra-red (contactless) digital temperature-sensor
SYMBOL MLX_Ta    = $06        ;T-A    Temperature Ambient, internal temperatuur of the sensor
SYMBOL MLX_Tobj1 = $07        ;T-Obj1 Temperature Object, temperature of the object to be measured

DIM Celsius      AS WORD      ;Contains the degrees Celsius, can rise above 255°C, thus WORD!
DIM SensorTemp   AS WORD      ;Measured Kelvin temperature from the MLX90614 temperature sensor

I2CIN MLX_Dta1, MLX_Clk, MLX_Adres, MLX_Tobj1, [SensorTemp.LOWBYTE, SensorTemp.HIGHBYTE]

Celsius = (SensorTemp / 50) - 273     ;Convert measured temperature in Kelvin to Celsius


The example above measures the temperature of the object.
The object to be measured must not be hotter than 380°C.
It is also possible to measure the temperature of the sensor itself (it must not exceed 125 degrees Celsius).
Then fill in:


I2CIN MLX_Dta1, MLX_Clk, MLX_Adres, MLX_Ta, [SensorTemp.LOWBYTE, SensorTemp.HIGHBYTE]


Regards,
Frizie.

Thank you for answer. its work. But 34,32,29. i want to appear 33.4, 32.6. How ?

flosigud

I would try:

DIM Celsius      AS Float

oguztkn

Thank you. it is work. Last questions: How go to sleep this module ?