Hi Everyone,
I am trying to build a thermal imaging scanner similar to these:
http://spill.tanagram.com/2010/11/24/diy-thermal-imaging-system-for-under-200/
I got some readings but it always seem to stop after some readings. I don't know where it gets stuck, but my guess would be there is some problem with the serial communication or something. Another concern I have is the usb port, the arduino program keeps telling me the board is not available at com port 3, I have to remove and reattach the usb cable to the board to continue. (is this related to my other problem?)
Thanks for your help in advance.
This is the output I get:
Starting
3,
7,
0,
5,
3,
3,
3,
4,
,
,
,
ï
,
,
?
,
,
,
11,
18,
12,
11,
12,
15,
7,
7,
13,
,
,
,
ï
,
//here it does not give any output, even pressing on the reset button on the board does nothing, the only thing that helps is removing and reattaching the usb cable after which I get:
Starting
26,
My code:
#include <Servo.h>
#include <Wire.h>
#define TPA81ADDR (0xd0>>1)
Servo MyServoX;
Servo MyServoY;
int CurrentPosX = 0;
int CurrentPosY = 0;
byte TempArray[8] = {'0','0','0','0','0','0','0','0'};
void setup()
{
Wire.begin();
MyServoX.attach(11);
MyServoY.attach(10);
Serial.begin(9600); //9600
Serial.println("Started");
}
void SetServosToZero()
{
MyServoY.write(0);
MyServoX.write(0);
delay(10);
}
void SetTempArrayToZero()
{
for (int i = 0 ; i < 8; i++)
{
TempArray[i] = '0';
}
}
void loop()
{
SetServosToZero();
for(int x = CurrentPosX ; x < 180 ; x += 5)
{
for (int y = CurrentPosY ; y < 140 ; y += 5)
{
MyServoY.write(y);
delay(15);
}
MyServoY.write(0);
MyServoX.write(x);
}
byte TempArray[8];
GetTemp();
byte b ;
for (int i = 0 ; i < 8; i++)
{
b = TempArray[i];
Serial.println(b);
Serial.println(",");
}
}
void GetTemp()
{
byte b;
for (int i = 0; i <= 8; i++)
{
Wire.beginTransmission(TPA81ADDR);
Wire.send((i +1));
Wire.endTransmission();
Wire.requestFrom(TPA81ADDR, (int) 1);
int Whiles;
boolean Breaked = false;
//Serial.println("Starting while loop");
while((Wire.available() < 1) && (Breaked == false))
{
if (Whiles > 10)
{
Breaked = true;
break;
}
Whiles++;
}
if (Breaked == false)
{
b = Wire.receive();
TempArray[i] = b;
Serial.print(b, DEC);
Serial.println(",");
}
}
}