1、Adafruit AMG8833 8x8 Thermal Camera SensorCreated by Justin CooperLast updated on 2017-06-28 08:38:07 PM UTC2388910101112141415161718191922232324242425262830303031Guide ContentsGuide ContentsOverviewPinoutsPower Pins:Logic pins:AssemblyPrepare the header strips:Add the breakout board:And Solder!Wiri
2、ng Initialize the sensor usingstatus = amg.begin();if (!status) Serial.println(“Could not find a valid AMG88xx sensor, check wiring!“);while (1);to read the pixels you will need an array to place the readings into. Once you have one, youcan call readPixels. Make sure the array you create is big enou
3、gh by using the pre-definedAMG88xx_PIXEL_ARRAY_SIZE macro.float pixelsAMG88xx_PIXEL_ARRAY_SIZE;amg.readPixels(pixels); Adafruit Industries https:/ Page 18 of 31Arduino Thermal CameraTo make your Arduino into a cool thermal camera, we can add a small display.In this example we use an Adafruit 1.44“ C
4、olor TFT. With some code changes, you can useother size displays but a color display is best of course.Adafruit 1.44“ Color TFT LCD Display with MicroSD Card breakoutPRODUCT ID: 2088This lovely little display breakout is the best way to add a small, colorful and bright displayto any project. Since t
5、he display uses 4-wire SPI to communicate and has its own.http:/adafru.it/dXl$14.95IN STOCKKeep your AMG8833 breakout wired as you already have it from the Wiring & Test sectionabove, and add your TFT like this Adafruit Industries https:/ Page 19 of 31Once everything is all wired up, load up File-Ex
6、amples-Adafruit_AMG88xx-thermal_camHit upload and you should have a simple thermal camera! Adafruit Industries https:/ Page 20 of 31 Adafruit Industries https:/ Page 21 of 31Raspberry Pi Thermal CameraThe Raspberry Pi also has an i2c interface, and even better has processing capability tointerpolate
7、 and filter the sensor output. By adding processing power, you can turn the 8x8output into what appears to be a higher-resolution display.Were using a PiTFT 2.8“ and a Pi Cobbler but the code can be adapted to output to theHDMI display - were using pygame to draw to the framebuffer.You can use any R
8、aspberry Pi computer, from Pi A+ to Pi 3 or even a Pi Zero, but wehappen to have a Pi 3 on our desk set up already so were using that. Adafruit Industries https:/ Page 22 of 31Raspberry Pi 3 - Model B - ARMv8 with 1G RAMPRODUCT ID: 3055Did you really think the Raspberry Pi would stop getting better?
9、 At this point, we sound likea broken record, extolling on the new Pis myriad improvements like were.http:/adafru.it/scY$39.95IN STOCKPiTFT Plus Assembled 320x240 2.8“ TFT + Resistive TouchscreenPRODUCT ID: 2298Is this not the cutest little display for the Raspberry Pi? It features a 2.8“ display wi
10、th320x240 16-bit color pixels and a resistive touch overlay. The plate uses the high.http:/adafru.it/eZS$34.95IN STOCK Adafruit Industries https:/ Page 23 of 31Assembled Pi T-Cobbler Plus - GPIO BreakoutPRODUCT ID: 2028This is the assembled version of the Pi T-Cobbler Plus. It only works with the Ra
11、spberry PiModel Zero, A+, B+, Pi 2,Pi 3! (Any Pi with 2x20 connector) The Raspberry Pi has landed.http:/adafru.it/xgf$7.95IN STOCKSetup PiTFTIf you have not done so already, the first thing you will need to do is setup your PiTFT.Instructions on how to do so can be found in this guide (http:/adafru.
12、it/sha).Install Python SoftwareOnce your PiTFT is all set up, and you have Internet access set up, lets install somesoftware we will need. First make sure your Pi package manager is up to date.sudo apt-get updateNext, we will install the Raspberry Pi library and Adafruit_GPIO which is our hardwarein
13、terfacing layersudo apt-get install -y build-essential python-pip python-dev python-smbus gitgit clone https:/ Adafruit_Python_GPIOsudo python setup.py installFinally, install both pygame and scipy. Pygame lets us draw easily to a screen using Adafruit Industries https:/ Page 24 of 31Finally, instal
14、l both pygame and scipy. Pygame lets us draw easily to a screen usingpython, well use that to make the display work. Scipy is a powerful scientific/dataprocessing library that we can use to magically turn the 8x8 = 64 pixel array into somethingthat looks more like a 32x32 = 1024 pixel array. Wow, is
15、nt digital signal processing cool?sudo apt-get install -y python-scipy python-pygamesudo pip install colour Adafruit_AMG88xxEnable I2CWe need to enable the I2C bus so we can communicate with the sensor.sudo raspi-configselect Advanced options, enableI2C, and then finish. Adafruit Industries https:/
16、Page 25 of 31Once I2C is enabled, run sudo shutdown -h now to turn off the Pi and prepare for wiringWiring Up SensorWith the Pi powered off, we can wire up the sensor to the Pi Cobbler like this:Connect Vin to the 3V or 5V power supply (either is fine)Connect GND to the ground pin on the CobblerConn
17、ect SDA to SDA on the CobblerConnect SCL to SCL on the CobblerYou can also use direct wires, we happen to have a Cobbler ready. remember you can plugthe cobbler into the bottom of the PiTFT to get access to all the pins! Adafruit Industries https:/ Page 26 of 31Now you should be able to verify that
18、the sensor is wired up correctly by asking the Pi todetect what addresses it can see on the I2C bus:sudo i2cdetect -y 1 Adafruit Industries https:/ Page 27 of 31It should show up under its default address (0x69). If you dont see 69, check your wiring,did you install I2C support, etc?Run example code
19、At long last, we are finally ready to run our example codecd /git clone https:/ Adafruit_AMG88xx_python/examplessudo python thermal_cam.pyIf you have everything installed and wired up correctly, you should see a nice thermalcamera image. Cool tones (blue and purple) are cooler temperatures, and warm
20、er tones(yellow, red) are warmer temperatures.If your image seems to be flipped on the screen, try changing the orientation of theAMG8833 breakout on the breadboard.If youre interested int he details, and want to know more about how we made 64 pixels looklike many more, its called bicubic interpolat
21、ion (http:/adafru.it/xgA) (hat tip to OSHpark forthe idea (http:/adafru.it/xgB)!) Adafruit Industries https:/ Page 28 of 31 Adafruit Industries https:/ Page 29 of 31DownloadsDocumentsAMG8833 datasheet (http:/adafru.it/xgE)AMG8833 Arduino Driver (http:/adafru.it/xfw)Fritzing object in the Adafruit Fritzing library (http:/adafru.it/aP3)AMG8833 python driver (http:/adafru.it/xgF)AMG8833 CircuitPython Driver (http:/adafru.it/xha)AMG8833 breakout PCB files (EAGLE format) (http:/adafru.it/xhb)Schematicclick to enlarge Adafruit Industries https:/ Page 30 of 31