AMG8833 Infrared Sensor howto

Datasheet

Many pages of search returned an abridged datasheet that is only useful if you intent to use an external library.  

Basic I²C Connection

i2c connections for AMG8833

The AMG8833 seems to cope with a very basic / minimal I²C connection.  There are no passive components not show here.  3v3 is direct from a Raspberry Pi Zero 2W.  The AD0 line to ground chooses the 0x68 address.  If I left it floating to at v+ it responded on 0x69

# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

Hello World

The most basic thing I could think to do to check the sensor at least sort of works, a "Hello Word" if you will is to read the first byte of pixel data...  and.. it worked!

This is with the sensor on the breadboard pointing at the ceiling

# i2cget -y 1 0x68 128
0x6b

Holding my hand over it

# i2cget -y 1 0x68 128
0x79

Making sense of the numbers

# i2cget -y 1 0x68 128 
0x6b
# i2cget -y 1 0x68 129 
0x00

the high byte is 0, so no need to do anything complicated. 

0x6b is 0b0000_0110_1011 = decimal 107. 

Each integer increment is 0.25°C.

107 x 0.25°C = 26.75°C.  My hand would have been 30.25°C

Efficiencies

Reading the entire grid in bytes, is tedious... and slow... 389ms to read all 64 pixels (and this was the lo bytes ONLY).

Fetching all 64 lo bytesfetching just 1 byte

#!/bin/bash
for i in {0..63}; do
        lb=$(($i*2+128))
        lb=`i2cget -y 1 0x68 $lb `
        b=$(($lb))
        m=$(($i%8))
        if [ $m -eq 0 ]; then echo "" ; fi
        echo -n "$b,"
done
echo ""

Negative ° and 2's complement

Holding an item from the freezer over the sensor I read lb=0xfc hb=0x0f giving me

0b1111_1111_1100
-000_0000_0011 (take the sign and invert)
-000_0000_0100 (add 1)

gives you -4°C

But I'm too impatient to continue this in bash.

Python and block read

Fetching all 64 hi and lo bytes

<I'm going to come back to this with a higher resolution device>

Resources

Finding a full datasheet for this device is next to impossible.  I found a reference to it in a Github repoo and eventually found 

https://web.archive.org/web/20190515143031/https://www.digikey.com/eewiki/download/attachments/20938914/Grid-EYE%20Full%20Datasheet.pdf?version=1&modificationDate=1379517099720&api=v2

in the wayback machine from 2012!

I found this from a Digikey forum that dates from Jan 2023 post by rick_1976.  This is the most comprehesive source of data I could find and is enough to use the sensor.

After using this sensor for a few days (and it IS really easy to get working) I'm abandoning it because it's just too basic to be useful beyond a 2m range.