DZR
July 31, 2018, 12:42am
21
And this is the Arduino Code:
/***************************************************************************
This is a library for the AMG88xx GridEYE 8x8 IR camera
This sketch tries to read the pixels from the sensor
Designed specifically to work with the Adafruit AMG88 breakout
----> http://www.adafruit.com/products/3538
These sensors use I2C to communicate. The device’s I2C address is 0x69
Adafruit invests time and resources providing this open source code,
please support Adafruit andopen-source hardware by purchasing products
from Adafruit!
Written by Dean Miller for Adafruit Industries.
BSD license, all text above must be included in any redistribution
***************************************************************************/
#include <Wire.h>
#include <Adafruit_AMG88xx.h>
Adafruit_AMG88xx amg;
float pixels[AMG88xx_PIXEL_ARRAY_SIZE];
void setup() {
Serial.begin(115200);
Serial.println(F(“AMG88xx pixels”));
bool status;
// default settings
status = amg.begin();
if (!status) {
Serial.println("Could not find a valid AMG88xx sensor, check wiring!");
while (1);
}
Serial.println("-- Pixels Test --");
Serial.println();
delay(100); // let sensor boot up
}
void loop() {
//read all the pixels
amg.readPixels(pixels);
Serial.print("[");
for(int i=1; i<=AMG88xx_PIXEL_ARRAY_SIZE; i++){
Serial.print(pixels[i-1]/10);
Serial.print(", ");
if( i%8 == 0 ) Serial.println();
}
Serial.println("]");
Serial.println();
//delay a second
delay(1000);
}Preformatted text
Preformatted text
aigos
July 31, 2018, 1:32am
22
Here’s my arduino code for the amg8833, note, in the processing code, match “COM3” or whatever number to what the serial port is in the Arduino IDE
#include <Wire.h>
#include <Adafruit_AMG88xx.h>
Adafruit_AMG88xx amg;
float pixels[AMG88xx_PIXEL_ARRAY_SIZE];
float Tmax = 36.0; //what max and min temps are (actually 0-80)
float Tmin = 16.0;
float valMax = 5.0; //values that processing uses to map the colors
float valMin = 1.0;
float range = (Tmax - Tmin); //used to normalize to range 2
float range2 = (valMax - valMin);
float pix;
int resetPin = 12;
void setup() {
digitalWrite(resetPin, HIGH);
delay(200);
pinMode(resetPin, OUTPUT);
Serial.println("RESET");
Serial.begin(115200);
bool status;
// default settings
status = amg.begin();
if (!status) {
Serial.println("Could not find a valid AMG88xx sensor, check wiring!");
while (1);
}
delay(100); // let sensor boot up
}
void loop() {
//read all the pixels
amg.readPixels(pixels);
for (int i = 0; i < AMG88xx_PIXEL_ARRAY_SIZE; i++) {
pix = (abs((pixels[i] - Tmin)) / range);
if (pix >= 0 && pix <= 1) {
Serial.print(((pix * range2) + valMin), 3);
Serial.print(',');
} else {
delay(10);
digitalWrite(resetPin, LOW);
}
}
Serial.println();
//delay a second
delay(100);
}
aigos
July 31, 2018, 1:33am
23
#include <Wire.h>
#include <Adafruit_AMG88xx.h>
Adafruit_AMG88xx amg;
float pixels[AMG88xx_PIXEL_ARRAY_SIZE];
float Tmax = 36.0; //what max and min temps are (actually 0-80)
float Tmin = 16.0;
float valMax = 5.0; //values that processing uses to map the colors
float valMin = 1.0;
float range = (Tmax - Tmin); //used to normalize to range 2
float range2 = (valMax - valMin);
float pix;
int resetPin = 12;
void setup() {
digitalWrite(resetPin, HIGH);
delay(200);
pinMode(resetPin, OUTPUT);
Serial.println("RESET");
Serial.begin(115200);
bool status;
// default settings
status = amg.begin();
if (!status) {
Serial.println("Could not find a valid AMG88xx sensor, check wiring!");
while (1);
}
delay(100); // let sensor boot up
}
void loop() {
//read all the pixels
amg.readPixels(pixels);
for (int i = 0; i < AMG88xx_PIXEL_ARRAY_SIZE; i++) {
pix = (abs((pixels[i] - Tmin)) / range);
if (pix >= 0 && pix <= 1) {
Serial.print(((pix * range2) + valMin), 3);
Serial.print(',');
} else {
delay(10);
digitalWrite(resetPin, LOW);
}
}
Serial.println();
//delay a second
delay(100);
}
jb4x
July 31, 2018, 5:12am
24
@DZR please can you format your code as @kfrajer asked?
You can still edit your code to do so.
Thanks
DZR
July 31, 2018, 5:29pm
25
I thought I had done that. See above. “Preformatted text”
1 Like
DZR
August 1, 2018, 5:27pm
26
Ok. I think I followed your instructions from your email. Thank you for the reply. I appreciate any help.
1 Like
DZR
August 2, 2018, 11:27pm
27
Can someone help me please?
aigos
August 2, 2018, 11:44pm
28
In the line “Pixels[i-1]/10” You’ll want to change that to ((Pixels[i-1]/20)+1). Because, as I said, you want a number between 1 and 5 and the range it can read is from 0-80, so you should only expect those values. and just dividing by 10 alone doesnt properly normalize it