15 กล้องความร้อน Arduino

โครงการ arduino ล่าสุดของฉันคือการสร้างกล้องความร้อนในราคาถูกโดยใช้เซ็นเซอร์ ir และฮาร์ดแวร์ pan / tilt บางอย่าง ถ้าคุณมองไปที่ภาพอุปกรณ์ทางด้านซ้ายจะมีตัวตรวจจับคลื่นเสียงอยู่ด้านบน 

อุปกรณ์ทำงานโดยการกวาดตารางคะแนนและรวบรวมภาพชิ้นส่วน เอาท์พุทประกอบด้วยสองภาพ: 1) ภาพอะคูสติกที่บอกระยะทางไปยังวัตถุในมุมมองและ 2) ภาพความร้อนที่ให้อุณหภูมิของวัตถุในมุมมอง ฉันใช้ gnuplot เพื่อประกอบภาพ ดูสคริปต์ด้านล่าง

ฉันวางแผนที่จะใช้ Finder ช่วงเพื่อกำหนดขนาดจุดของเครื่องอ่าน IR ขนาดจุด spot โดย dh_o / dL = 2sin (5) ตำแหน่ง dh_o คือการเปลี่ยนแปลงเส้นผ่านศูนย์กลางจุดและ dL คือการเปลี่ยนระยะห่างจากเซ็นเซอร์ไปยังวัตถุ ห้าเป็นค่าคงที่ตามมุมมอง 5degree ของเซ็นเซอร์ IR 

ฉันได้รับแนวคิดสำหรับโครงการจากเว็บไซต์นี้: http://www.cheap-thermocam.tk/

 

รายชื่อวัสดุ:
ความก้าวหน้าของการประกอบ:
  1. ประกอบ Pan / Tilt ด้วยเซอร์โว ใช้เซอร์โวที่มีขนาดปานกลางเนื่องจากมีขนาดเล็กมากเกินไปภายใต้ torqued สำหรับการดำเนินการเอียง (สังเกต jerkyness ในวิดีโอ) เซอร์โวต้อง 5V
  2. แนบตัวแปลงสัญญาณอัลตร้าโซนิคกับบอร์ดโปรโตรโดยวางสายผ่านรูและการบัดกรีทั้งสองด้าน (หลุมควรจัดให้อยู่บนบอร์ดทั้งสองข้าง) วางตำแหน่งเซนเซอร์อัลตราโซนิคไว้ตรงกลางของเมนบอร์ดเพื่อให้เซ็นเซอร์ ir ตรงกับศูนย์กลางของเซ็นเซอร์อัลตราโซนิก
  3. ติดตั้งเลเซอร์ติดกับ Pan / Tilt ฮาร์ดแวร์เพื่อให้ทั้งสองด้านของรูติดตั้งด้านขวาอยู่ด้านบนเพื่อเชื่อมต่อบอร์ด ฉันใช้สกรูที่เหลือจากเซอร์โวในการเชื่อมต่อเลเซอร์เมาท์ ฉันเจาะหลุมแรกที่มีขนาดเล็กกว่าเส้นผ่านศูนย์กลางเกลียวเล็กน้อย
  4. ผลักเลเซอร์ลงในเลเซอร์ติดทุกทาง หยุดและยุ่งกับเลเซอร์และแอ็พพลิเคเซอร์โวแบบง่ายๆ
  5. ตอนนี้ใช้สายไฟ 3V และสาย GND เพื่อออกจากสายพิเศษ ตัวแปลงสัญญาณแบบอัลตราโซนิคสามารถใช้ 3V หรือ 5V (ความละเอียดดีกว่า 5V) เซ็นเซอร์ IR สามารถใช้เวลา 3V เท่านั้น การสร้างของฉันใช้ 3V สำหรับทั้ง ir และ sonar
  6. ตอนนี้วาง senator ในอย่างระมัดระวังและเพียงแค่การประสานนำไม่ตัดแต่ง เรียกใช้ตัวต้านทานโอห์ม 4.7K ของคุณจากพลังงานไปยังด้านตรงข้ามของบอร์ดเหนือเซนเซอร์ ir
  7. ตอนนี้ฟอร์มการเชื่อมต่อระหว่างกันบนกระดาน
  8. เพิ่มสายไฟสามสายจากบอร์ดไปที่ arduino มีหนึ่งสำหรับเซ็นเซอร์อัลตราซาวด์และสองสำหรับเซ็นเซอร์ ir
  9. ติดเซ็นเซอร์เข้ากับที่ยึดเลเซอร์ ใช้รูที่ให้มากับที่ยึดเลเซอร์ ฉันยังใช้สกรูพิเศษจากเซอร์โวและเจาะรูที่ตรงกับบอร์ดเซนเซอร์ เป็นสิ่งสำคัญที่ทุกอย่างเป็นรูปสี่เหลี่ยม
  10. เชื่อมต่อสายเลเซอร์เข้ากับสายไฟ 3V (สายสีแดง) และ GND (สีขาว)
  11. เชื่อมต่อสายไฟสองเส้นและสายข้อมูลสามเส้นเข้ากับบอร์ดระดับกลาง (มีหนึ่งอันจากตู้วิทยุและตัดให้ครึ่งหนึ่งด้วยเลื่อยสายพาน) บอร์ดระดับกลางนี้จะอนุญาตให้คุณเปลี่ยนไปใช้หมุด arduino ฉันเพิ่มส่วนหัวของตัวผู้ (3 พิน) ลงในบอร์ดระดับกลางเพื่อรับขั้วต่อเซอร์โว ดังนั้นถ้าฉันเป่า servo ฉันไม่จำเป็นต้องประสานอีกครั้ง
  12. เมื่อใช้กระดานกลางคุณสามารถสร้างพื้นดินทั่วไปได้
  13. ตอนนี้ปรับเปลี่ยนกล่องภาพพลาสติกที่จะยอมรับเซอร์โวที่ด้านบนและสายที่จะมาถึงด้านบน ฉันพบจุดศูนย์กลางของด้านบนและตรวจสอบขนาดของเซอร์โวที่ด้านบนและเจาะรูและเอาออกจากรู จากนั้นฉันเจาะหลุมบางส่วนเพื่อยึดเข้ากับพลาสติกโดยใช้ฮาร์ดแวร์สำหรับติดตั้งบนเซอร์โว นอกจากนี้ฉันตัดส่วนสี่เหลี่ยมออกจากด้านข้างเพื่อยอมรับ USB และพลังงาน ฉันวาง arduino ไว้ในตู้และตรวจสอบรูปทรงทั่วไปและใช้อีกครั้งเพื่อรับมือกับการเลื่อย
  14. ฉันเพิ่ม standoffs ที่ด้านล่างของ arduino ของฉันและเพียงแค่ร้อนติดกาวยืนไม่ชอบกับสิ่งที่แนบและด้านล่างของ arduino
  15. ตอนนี้ฟีดสายไฟจากเซนเซอร์ผ่านรูไปยังบอร์ดระดับกลางและตัวประสาน นอกจากนี้ยังเพิ่มสายบนกระดานกลางเพื่อเชื่อมต่อกับ arduino
  16. ฉันเพิ่มกาวร้อนเข้ากับสายไฟ arduino เพื่อให้แน่ใจว่าไม่ได้ดึงออก
  17. ตอนนี้ปิดทุกอย่างขึ้นและเพิ่มกาวร้อนบางส่วนที่ขอบของกรงเพื่อให้ทุกอย่างเข้าด้วยกัน
  18. เสียบ USB และเปิดเครื่องและอัปโหลดโค้ดต่อไปนี้

รหัส Arduino:
โปรแกรมจะไม่เริ่มทำงานจนกว่าคุณจะเปิดการเชื่อมต่อแบบอนุกรมและกด '1' และ Enter จากนั้นจะร่างพื้นที่ที่น่าสนใจ หากต้องการดำเนินการต่อให้กด '1' และป้อนอีกครั้ง Arduino จะเริ่มเก็บข้อมูลในอาร์เรย์ 2 มิติที่จะส่งออกไปยังหน้าจอเมื่อเสร็จสิ้น
//Arduino Thermal Camera
#include <i2cmaster.h>
#include <Servo.h>

Servo mvert;
Servo mhorz;

// Pins: 7=sonar; 4&5=ir sensor; 8=vert servo; 9=horz servo
//
//
//
const int pwPin = 7;
const int dev = 0x5A<<1;

long count = 0;

///Servo Ranges
int home_p = 0;
int j_done = 0;
int even = 0;
int xskip = 1;
int yskip = 1;
int xstart = 60;
int xstop = 75;
int ystart = 80;
int ystop = 70;

const int xnum = abs(xstart-xstop)+1;
const int ynum = abs(ystart-ystop)+1;

double therm[16][11];
double acous[16][11];

void setup(){

//sonar pin
pinMode(pwPin, INPUT);

//Servo pins
mvert.attach(8);
mhorz.attach(9);

//Home position servos
mvert.write(xstart); //1485
mhorz.write(ystart);  //1530

Serial.begin(9600);
Serial.println("Setup...");

i2c_init(); //Initialise the i2c bus
PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups

}

void loop(){

int i,j,jt;
int hpos,vpos,hpos2,vpos2;
double tempData1 = 0x0000; // zero out the data
double sonrData1 = 0x0000;

if(Serial.available()){

if(home_p == 0){
i = 0;
Serial.flush();
Serial.println("Sweeping Viewing Space");
Serial.println("Enter 1 to confirm space");
mvert.write(ystart);
mhorz.write(xstart);
delay(30);
do
{
//This will sweep through window of view
for(int hpos=xstart;hpos<=xstop;hpos++){
mvert.write(ystart);
mhorz.write(hpos);
delay(20);
}
for(int vpos=ystart;vpos>=ystop;vpos--){
mvert.write(vpos);
mhorz.write(xstop);
delay(20);
}
for(int hpos=xstop;hpos>=xstart;hpos--){
mvert.write(ystop);
mhorz.write(hpos);
delay(20);
}
for(int vpos=ystop;vpos<=ystart;vpos++){
mvert.write(vpos);
mhorz.write(xstart);
delay(20);
}
i=Serial.read();
}while (i<=0);
Serial.println("Starting Calculation");
home_p=1;
}

if(j_done == 0){
for(int i=ystart;i>=ystop;i-=yskip){
for(int j=xstart;j<=xstop;j+=xskip){
if(even == 0){
jt = j;
mhorz.write(j);
delay(20);
}
else{
jt=xstop-(j-xstart);
mhorz.write(jt);
delay(20);
}

sonrData1 = readSonar(1);
tempData1 = readMLX(1);

//58uS per cm
double cm = sonrData1;
double celcius = tempData1 - 273.15;
//double fahrenheit = (celcius*1.8) + 32;

//Serial.print("temp,dist,i,j: ");
//Serial.print(celcius);
//Serial.print(", ");
//Serial.print(cm);
//Serial.print(", ");
//Serial.print(ystart-i);
//Serial.print(", ");
//Serial.println(xstop-jt);
//Serial.print("Fahrenheit,inches: ");
//Serial.println(fahrenheit,inches);
therm[xstop-jt][ystart-i] = celcius;
acous[xstop-jt][ystart-i] = cm;
delay(400); // wait a second before printing again
}
mvert.write(i);
delay(20);
if(even == 0){
even = 1;
}else{
even = 0;
}
}
//Output data
Serial.println("Outputting Data");
for(int j=0;j<ynum;j++){
for(int i=0;i<xnum;i++){
Serial.print(therm[i][j]);
Serial.print(", ");
Serial.print(acous[i][j]);
Serial.print(", ");
Serial.print(i);
Serial.print(", ");
Serial.println(j);
Serial.flush();
}
Serial.println(" ");
}
j_done = 1;
}
}}

double readMLX(int Tt) {

int data_low = 0;
int data_high = 0;
int pec = 0;

i2c_start_wait(dev+I2C_WRITE);
i2c_write(0x07);

// read
i2c_rep_start(dev+I2C_READ);
data_low = i2c_readAck(); //Read 1 byte and then send ack
data_high = i2c_readAck(); //Read 1 byte and then send ack
pec = i2c_readNak();
i2c_stop();

//This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
double tempData = 0x0000; // zero out the data
int frac; // data past the decimal point

// This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
tempData = (double)(((data_high & 0x007F) << 8) + data_low);
tempData = (tempData * tempFactor)-0.228;

return tempData;
}

double readSonar(int St) {

long pulse;

//Used to read in the pulse that is being sent by the MaxSonar device.
//Pulse Width representation with a scale factor of 147 uS per Inch.
pulse = pulseIn(pwPin, HIGH);

double sonrData = (double) ((pulse)/58.0);

return sonrData;
}

Gnuplot code:
I will fix this but for now copy and paste the data outputted to the screen from the code above to a file called data.txt. It is the temperature in celcius, distance in cm and x-y coordinate. Now create another file call _plot.gnu and paste the code below into that file. Then execute the gnuplot script by typing gnuplot ./_plot.gnu . Make sure the data.txt and _plot.gnu are in the same folder.

If you have a fancier way to plotting the data send me a comment.

set term postscript enhanced color
set pm3d map
set size square

set title 'Thermal Image'
set output "thermal.eps"
splot 'data.txt' using 4:3:1 title 'Celcius'

set title 'Acoustic Image'
set output "sonar.eps"
splot 'data.txt' using 4:3:2 title 'Cenimeters'

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

Flowchart

12เครื่องวัดความเร็วอะนาล็อกใช้ Arduino และเซ็นเซอร์ IR

10อัลตราโซนิกเซนเซอร์ตรวจจับระยะไกลใน ARDUINO พร้อม TINKERCAD