Hey everyone,
I have been working on this for a while now and nothing seems to be functioning properly. I managed to get my hands on two, four by four (16) pixel thermopile arrays and am attempting to make one of them work with my Arduino Mega. I wrote some code that I thought should work properly to read the sensor values into an array. The thing is, the sensor values make absolutely no sense when I hold up a lighter to the left or right side of the sensor. I attached my code, a picture of the sensor and the sensor datasheet to the message. If anyone can help me out it would be extremely appreciated.
The code runs as expected, and the average temperature reading goes up when a lighter is in front of the sensor, its just that if holding the lighter to the left or right does not correlate with heat increases on the left and right pixels. Or maybe it does, but my code jumbled up the pixels somehow. :~
The info regarding the timing and such is on page 5 of the datasheet, and the rest of the somewhat useful info is on 3,7, and 17.
Can someone skim over my code to see what I could possibly be doing wrong? Or perhaps suggest a new way to read the values properly?
Thanks so much
Reset is connected to pin 4 on the sensor
Chi is connected to pin 3 on the sensor
Sample is connected to pin 2
ThermoIn is connected to pin 5 (AOUT)
byte readThermo(){
digitalWrite(Reset, LOW); //resets sensor so the sensor starts on pixel 1
delayMicroseconds(40);
digitalWrite(Reset, HIGH);
delayMicroseconds(500); // waits for analog output to finish outputting ambient temperature and go on to pixel 1
for(int a = 0; a<=15; a++){ //for loop for reading 16 pixel values
while(counter < 6 ){ //this is used to sense when enough sample pulses have gone by
State = digitalRead(Sample);
if(State != LastState){ // also used to count how many pulses have gone by on the sample pin
counter++;
}
LastState = State;
}
Thermo[a] = analogRead(ThermoIn); //reads analog input to array [a]
digitalWrite(Chi, LOW); //triggers the sensor to move on to the next pixel.
delayMicroseconds(10);
digitalWrite(Chi,HIGH);
counter = 0;
}
send_data(); //this is used to readout the data in another function
}
The code runs as expected, and the average temperature reading goes up when a lighter is in front of the sensor, its just that if holding the lighter to the left or right does not correlate with heat increases on the left and right pixels
I would not expect it to. I would test it by covering up some pixels with a sheet of metal or foil and see if that makes a difference.
I'll try to cover half the sensor and see what happens. I'm not sure how well it will work because the whole thing is packaged in a very tiny metal TO-46 package (or something similar, dont know the exact type).
Without a lens to focus an image onto the sensor array you will get no positional information. At these wavelengths then you normally have a silicon or germanium lens. have you got a lens? Is it in focus?
As well, after covering up the left and right half and testing the sensor my code can still not tell where the lighter is. The pixel values outputted to the serial monitor make no sense when compared to the position of the lighter. The average value of all the pixels still goes up though.
Yes I would expect you need a lens and that it would have to be in focus before you could begin to generate an image.
It looks exactly the same as the one found on this page:
They don't look much lens like to me.
Normally a thermal camera has a rotating shutter giving an alternating blank then image data. Each pixel is then measured and the two readings are subtracted to get an image value. This removes absolute differences and stops the whole array from heating up to the average ambient in the image.
Have you asked the people you got it from if they have an applications sheet for this sensor?
Wow, Ok that makes sense. I'll contact them and ask for an application sheet.
What type of lense would you reccomend? Would a Fresnel lense from a motion sensor or something similar to that work? I'm thinking that it has to be a convex lense, am I correct?