主要使用arduino采集amg8833数据,在通过哈夫曼滤波得到根准确的数据,在oled上显示。
松下的这款AMG8833红外热像仪传感器是一个8x8的红外热传感器阵列。当连接到arduino时,它将通过I2C返回一组64个单独的红外温度读数。
定义参数:
RF24 radio(10, 9);
RF24Network network(radio);
const uint16_t this_node = 01;
const uint16_t master00 = 00;
const unsigned long interval = 10;
float pixels[AMG88xx_PIXEL_ARRAY_SIZE] ;
unsigned long last_sent;
void setup() {
Serial.begin(9600);
SPI.begin();
radio.begin();
network.begin(90, this_node);
radio.setDataRate(RF24_2MBPS);
bool status;
status = amg.begin();
if (!status) {
while (1);
}
delay(100);
}
void loop() {
int in1[]={29,58,0,0};
network.update();
delay(100);
unsigned long now = millis();
Serial.print(“now”);
Serial.println(now);
if (now - last_sent >= interval) {
last_sent = now;
Serial.print(“last_sent”);
Serial.println(last_sent);
float temp ;
float temp1 ;
float Hte PROGMEM=0;
float Lte PROGMEM=111110;
Serial.println(0);
temp=amg.readThermistor();
amg.readPixels(pixels);
delay(100);
Serial.println(1);
for(int i=1; i<=AMG88xx_PIXEL_ARRAY_SIZE; i++){
if(pixels[i-1]>Hte)
{
Hte= pixels[i-1];
}
if(pixels[i-1]<Lte)
{
Lte= pixels[i-1];
}
}
Serial.println(2);
delay(1000);
u8g.firstPage();
do {
//u8g.setFont(u8g_font_9x15);//u8g_font_unifont u8g_font_gdr25r
u8g.setFont(u8g_font_gdr14r);
u8g.setPrintPos(9, 25);
u8g.print(“H:”);
u8g.setPrintPos(30, 25);
u8g.print(Hte);
} while( u8g.nextPage() );
delay(100);
temp=Hte10;
temp1=Lte10;
Serial.print(“adata1:”);
Serial.println(Lte);
Serial.print(“adata0:”);
Serial.println(Hte);
in1[0] =temp; //int(temp) & 0xFF;
in1[1] =temp1; //int(temp) >> 8;
Serial.print(“Sending…”);
RF24NetworkHeader header(master00);
bool ok = network.write(header, &in1, sizeof(in1));
delay(200);
Serial.println(ok);
}
}
完成代码:https://download.csdn.net/download/taoye_11/88217991