Dangerous Prototypes

Dangerous Prototypes => Bus Pirate Development => Topic started by: TitanMKD on October 11, 2011, 06:34:17 pm

Title: Buse Pirate v3.x/v4 Test I2C InfraRed Thermometer MLX90614
Post by: TitanMKD on October 11, 2011, 06:34:17 pm
Hi,

It is just a feedback test of my new InfraRed Thermometer MLX90614ESF with my Bus Pirate v3 (but it is the same for BPv4)

Test of InfraRed Thermometer MLX90614ESF-DAA (medical accuracy about 0.1°C for Ambient Temperature) with BusPirate I2C.
Code: [Select]
Init I2C+Internal PullUp+Power supplies+Scan I2C.
Vpu connected to +3.3V(PullUp).
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)
(1)>4
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz
(1)>3
I2C>W
Power supplies ON
I2C>P
Pull-up resistors ON
I2C>i
Bus Pirate v3b
Firmware v5.9 (r539)  Bootloader v4.2
DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)
http://dangerousprototypes.com
CFG1:0xFFDF CFG2:0xFF7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND    3.3V    5.0V    ADC    VPU    AUX    SCL    SDA    -      -
P      P      P      I      I      O      I      I      O      I
GND    3.29V  5.02V  0.00V  3.24V  H      H      H      H      H
Power supplies ON, Pull-up resistors ON, Open drain outputs (H=Hi-Z, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 8
a/A/@ controls CS pin
I2C (mod spd)=( 0 2 )
*----------*
I2C>(1)
Searching I2C address space. Found devices at:
0x00(0x00 W) 0x01(0x00 R) 0xB4(0x5A W) 0xB5(0x5A R)

Read Device Specification details
Code: [Select]
Read Word: Start+Slave Addr Write(0xB4)+Ack+Command+Ack+Start+Slave Addr Read(0xB5)+Ack+
          Read Data Byte Low+Ack+Read Data Byte High+Ack+Read PEC+Ack+Stop

PEC calculation includes all bits except the START, REPEATED START, STOP, ACK, and NACK bits. The PEC is a CRC-8 with polynomial X8+X2+X1+1. The Most Significant Bit of every byte is transferred first.

Command:
Opcode          Command
000x xxxx*      RAM Access
001x xxxx*      EEPROM Access
1111_0000**    Read Flags
1111_1111      Enter SLEEP mode
Note*: The xxxxx represent the 5 LSBits of the memory map address to be read/written.
Note**: Behaves like read command. The MLX90614 returns PEC after 16 bits data of which only 4 are
meaningful and if the MD wants it, it can stop the communication after the first byte. The difference between
read and read flags is that the latter does not have a repeated start bit. 
Flags read are: 
  Data[15] – EEBUSY – the previous write/erase EEPROM access is still in progress. High active.
Data[14] – Unused
Data[13] - EE_DEAD – EEPROM double error has occurred. High active.
Data[12] – INIT – POR initialization routine is still ongoing. Low active.
Data[11] – not implemented.
Data[10..0] – all zeros.
Flags read is a diagnostic feature. The MLX90614 can be used regardless of these flags.

EEPROM (32X16) (8.3.3 EEPROM ):
Name              Address    Write acces
Tomax            000h        Yes
Tomin            001h        Yes
PWMCTRL          002h        Yes
Ta range          003h        Yes
Emissivity correction coefficient  004h  Yes
Config Register1                  005h  Yes
Melexis reserved  006h        No
…  …  …
Melexis reserved  00Dh        No
SMBus address    00Eh        Yes
Melexis reserved  00Fh        Yes
Melexis reserved  010h        No
…  …  …
Melexis reserved  018h        No
Melexis reserved  019h        Yes
Melexis reserved  01Ah        No
Melexis reserved  01Bh        No
ID number        01Ch        No
ID number        01Dh        No
ID number        01Eh        No
ID number        01Fh        No

RAM (32x17) (8.3.4 RAM):
Name                Address    Read access
Melexis reserved    000h        Yes
…  …  …
Melexis reserved    005h        Yes
TA                  006h        Yes
TOBJ1              007h        Yes
TOBJ2              008h        Yes
Melexis reserved    009h        Yes
…  …  …
Melexis reserved    01Fh        Yes

TA = Ambient Temperature.
TOBJ1 = Object Temperature 1 or 2 if there is 2

Read Word RAM Object Temperature(TOBJ1=0x07):
[0xB4 0x07 [ 0xB5 r:3 ]
Code: [Select]
Result:
I2C>[0xb4 0x07 [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x07 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0xDF  ACK 0x3B  ACK 0xDE
NACK
I2C STOP BIT
TObject pointed on my hand => 0x3BDF * 0,02 => 15327 * 0,02=306,54 Kelvin => 306,54-273,15 = 33,39°C

Read Word RAM Ambient Temperature(TA=0x06):
[0xB4 0x06 [ 0xB5 r:3 ]
Code: [Select]
I2C>[0xb4 0x06 [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x06 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x72  ACK 0x3A  ACK 0x3E
NACK
I2C STOP BIT
Computation: 0x3A72 * 0,02 => 14962 * 0,02=299,24 Kelvin => 299,24-273,15 = 26.09°C

Read Word RAM Object Temperature(TOBJ1=0x07) multiple times:
Try to measure multiple time (4 times) temperature object with a delay of 100ms between each read:
[0xb4 0x07 [ 0xb5 r:3 ] %:100 [0xb4 0x07 [ 0xb5 r:3 ] %:100 [0xb4 0x07 [ 0xb5 r:3 ] %:100 [0xb4 0x07 [ 0xb5 r:3 ]

Result:
Code: [Select]
I2C>[0xb4 0x07 [ 0xb5 r:3 ] %:100 [0xb4 0x07 [ 0xb5 r:3 ] %:100 [0xb4 0x07 [ 0xb5 r:3 ] %:100 [0xb4 0x07 [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x07 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x3B  ACK 0x3C  ACK 0xDC
NACK
I2C STOP BIT
DELAY 100ms
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x07 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x43  ACK 0x3C ACK 0xD6
NACK
I2C STOP BIT
DELAY 100ms
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x07 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x4A  ACK 0x3C  ACK 0x6B
NACK
I2C STOP BIT
DELAY 100ms
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x07 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x52  ACK 0x3C  ACK 0x94
NACK
I2C STOP BIT

Read EEPROM Tomax for PWM
[0xb4 0x20 [ 0xb5 r:3 ]
Result:
Code: [Select]
I2C>[0xb4 0x20 [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x20 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x93  ACK 0x99  ACK 0xB2
NACK
I2C STOP BIT
=> Tomax = 0x9993 => 39315 * 0.01 = 393,15 Kelvin => 393,15-273,15=+120°C

Read EEPROM Tomin for PWM

[0xb4 0x21 [ 0xb5 r:3 ]
Result:
Code: [Select]
I2C>[0xb4 0x21 [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x21 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0xE3  ACK 0x62  ACK 0xE9
NACK
I2C STOP BIT
=> Tomin = 0x62E3 => 25315 * 0.01 = 253,15 Kelvin => 253,15-273,15=-20°C

Read Word EEPROM Emissivity correction coefficient(0x004):

[0xb4 0x24 [ 0xb5 r:3 ]
Code: [Select]
Result:
I2C>[0xb4 0x24 [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x24 ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0xFF  ACK 0xFF  ACK 0xD6
NACK
I2C STOP BIT

The address Emissivity contains the object em sivity (factory default 1.0 = 0xFFFF), 16 bit. is
Emissivity = dec2hex[ round( 65535 x e) ]
where dec2hex[ round( X ) ] represents decimal to hexadecimal conversion with round-off to nearest valu
(not truncation). In this case the physical emissivity values are e = 0.1…1.0.

Read Word EEPROM ID Number 1C, 1D, 1E ,1F:

[0xb4 0x3C [ 0xb5 r:3 ] [0xb4 0x3D [ 0xb5 r:3 ] [0xb4 0x3E [ 0xb5 r:3 ] [0xb4 0x3F [ 0xb5 r:3 ]
Result:
Code: [Select]
I2C>[0xb4 0x3C [ 0xb5 r:3 ] [0xb4 0x3D [ 0xb5 r:3 ] [0xb4 0x3E [ 0xb5r:3 ] [0xb4 0x3F [ 0xb5 r:3 ]
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x3C ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x0C  ACK 0x4C  ACK 0x3A
NACK
I2C STOP BIT
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x3D ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x99  ACK 0x92  ACK 0x98
NACK
I2C STOP BIT
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x3E ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x94  ACK 0x21  ACK 0x5B
NACK
I2C STOP BIT
I2C START BIT
WRITE: 0xB4 ACK
WRITE: 0x3F ACK
I2C START BIT
WRITE: 0xB5 ACK
READ: 0x84  ACK 0xB0  ACK 0xE4
NACK
I2C STOP BIT
Title: Re: Buse Pirate v3.x/v4 Test I2C InfraRed Thermometer MLX906
Post by: ian on October 12, 2011, 03:38:43 pm
Nice, complete demo. Thanks for sharing! I'll post it up.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01122082520session_write_close ( )...(null):0
20.01152214112ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01152214888Database_MySQL->query( ).../DatabaseHandler.php:119
40.05712353624Database_MySQL->error( ).../Db-mysql.class.php:273