syouwa-taroのアイコン画像
syouwa-taro 2021年11月19日作成
製作品 製作品 閲覧数 2111
syouwa-taro 2021年11月19日作成 製作品 製作品 閲覧数 2111

検温付レーザーレーダー

検温付レーザーレーダー

概要

賞品で頂いた”レーザー距離計”で、以前作った超音波レーダーのarduinoソフト変更してレーザーに改造。超音波に比べ距離が延び(5倍:2m)検出も安定、反応も早い。メデタシ メデタシヽ(^o^)丿 
processingの勉強兼ね更に、コロナ禍の中レーダーにサーモデバイスを追加し、熱のある人だけを表示(検温レーダー)に挑戦。
説明動画では往復スキャンで、往は従来どおり反射物を全て表示、復は体温の高い人(=電気毛布を持った人)だけを表示。

仕組み

レーザー距離計と同じ方向に、狭指向性〈5°)赤外温度計を向け、対象物の温度を計測し熱がある時だけレーザー距離計の対象物距離を表示し、熱がない時は対象物表示を行わない。

材料

部品 部品名
マイコン NANO (amazon ¥500~)
レーザー距離計 AE-VL53L 秋月
Thermopile GY_906 (amazon ¥1500~¥2000)
サーボモーター SG90 (amazon ¥300~ )
フレネルレンズ(5°) ( 以前は焦伝型赤外センサキットに同梱されていましたが今は別のレンズになったよう 秋月)

回路図

検温機能付レーザー距離計レーダー

ソースコード

ArduinoRadar

#include <Servo.h> #include <Wire.h> #include <VL53L1X.h> #include <Adafruit_MLX90614.h> Adafruit_MLX90614 mlx = Adafruit_MLX90614(); Servo myServo; VL53L1X sensor; void setup() { myServo.attach(12); //12ピンにサーボモーターを取り付ける //VL53L1X setup Serial.begin(9600); //processing と合わせる Wire.begin(); Wire.setClock(400000); //use 400 kHz I2C mlx.begin(); sensor.setTimeout(500); if (!sensor.init()) { //Serial.println("Failed to detect and initialize sensor!"); while (1); } sensor.setDistanceMode(VL53L1X::Long); sensor.setMeasurementTimingBudget(50000); sensor.startContinuous(50); } void loop() { //往 サーボモータを15から165度回転させる for(int i=15;i<=165;i++){ myServo.write(i); delay(10); Serial.print(i); //現在の角度をシリアルポートに送信します Serial.print(","); //インデックス作成のためにProcessing IDEで、後で必要とされる前の値のすぐ隣に追加文字を送信する Serial.print(sensor.read()/50); //シリアルポートに距離の値を送ります /50:40div=50cm Serial.print("."); //インデックス作成のためにProcessing IDEで、後で必要とされる前の値のすぐ隣に追加文字を送信する(データの終わりを示すための文字) } //復 前の行を165度から15度まで繰り返す for(int i=165;i>15;i--){ //Serial.println( (mlx.readObjectTempC()) ); //サーモセンサ温度データーを調べるdebug用 注debugの時processingは表示されない myServo.write(i); if ( (mlx.readObjectTempC() ) > 19.9 ) { //熱ある/なし閾値はデバイス 距離に応じ実測して決める 通常37℃より低い delay(10); Serial.print(i); Serial.print(","); Serial.print(sensor.read()/50); // 10:div=50cm:div Serial.print("."); } else { delay(30); Serial.print(i); Serial.print(","); Serial.print(41); //out of range:dummy data set >40(=200cm):no object Serial.print("."); } } }

Processing3Radar

/* Arduino Radar */ import processing.serial.*; import java.awt.event.KeyEvent; import java.io.IOException; Serial myPort; String angle=""; String distance=""; String data=""; String noObject; float pixsDistance; int iAngle, iDistance; int index1=0; PFont orcFont; void setup() { size (1920, 1080); //*adjust to PC displaysize smooth(); myPort = new Serial(this,"COM5", 9600); //*adjust to PCport myPort.bufferUntil('.'); orcFont = loadFont("MS-Gothic-30.vlw"); //*set up font Processing3_Platform by tool } void draw() { fill(98,245,31); textFont(orcFont); noStroke(); fill(0,4); rect(0, 0, width, height-height*0.065); fill(98,245,31); drawRadar(); drawLine(); drawObject(); drawText(); } void serialEvent (Serial myPort) { data = myPort.readStringUntil('.'); data = data.substring(0,data.length()-1); index1 = data.indexOf(","); angle= data.substring(0, index1); distance= data.substring(index1+1, data.length()); iAngle = int(angle); iDistance = int(distance); } void drawRadar() { pushMatrix(); translate(width/2,height-height*0.074); noFill(); strokeWeight(2); stroke(98,245,31); arc(0,0,(width-width*0.0625),(width-width*0.0625),PI,TWO_PI); arc(0,0,(width-width*0.297),(width-width*0.297),PI,TWO_PI); arc(0,0,(width-width*0.531),(width-width*0.531),PI,TWO_PI); arc(0,0,(width-width*0.765),(width-width*0.765),PI,TWO_PI); line(-width/2,0,width/2,0); line(0,0,(-width/2)*cos(radians(30)),(-width/2)*sin(radians(30))); line(0,0,(-width/2)*cos(radians(60)),(-width/2)*sin(radians(60))); line(0,0,(-width/2)*cos(radians(90)),(-width/2)*sin(radians(90))); line(0,0,(-width/2)*cos(radians(120)),(-width/2)*sin(radians(120))); line(0,0,(-width/2)*cos(radians(150)),(-width/2)*sin(radians(150))); line((-width/2)*cos(radians(30)),0,width/2,0); popMatrix(); } void drawObject() { pushMatrix(); translate(width/2,height-height*0.074); strokeWeight(9); stroke(255,10,10); pixsDistance = iDistance*width*0.469*0.025; if(iDistance < 40){ line(pixsDistance*cos(radians(iAngle)),-pixsDistance*sin(radians(iAngle)), (width-width*0.505)*cos(radians(iAngle)),-(width-width*0.505)*sin(radians(iAngle))); } popMatrix(); } void drawLine() { pushMatrix(); strokeWeight(9); stroke(30,250,60); translate(width/2,height-height*0.074); line(0,0,(width-width*0.505)*cos(radians(iAngle)),-(width-width*0.505)*sin(radians(iAngle))); popMatrix(); } void drawText() { pushMatrix(); if(iDistance > 40) { noObject = "Out of Range"; } else { noObject = "In Range"; } fill(0,0,0); noStroke(); rect(0, height-height*0.0648, width, height); fill(98,245,31); textSize(20); text("50cm",width-width*0.433,height-height*0.0833); text("100cm",width-width*0.316,height-height*0.0833); text("150cm",width-width*0.199,height-height*0.0833); text("200cm",width-width*0.082,height-height*0.0833); textSize(30); text("Object: " + noObject, width-width*0.875, height-height*0.035); text("Angle: " + iAngle +" °", width-width*0.48, height-height*0.035); text("Distance: ", width-width*0.26, height-height*0.035); if(iDistance < 40) { text(" " + iDistance*5 +" cm", width-width*0.109, height-height*0.035); //iDistance } textSize(20); fill(98,245,60); translate((width-width*0.4994)+width/2*cos(radians(30)),(height-height*0.0907)-width/2*sin(radians(30))); rotate(-radians(-60)); text("30°",0,0); resetMatrix(); translate((width-width*0.503)+width/2*cos(radians(60)),(height-height*0.0888)-width/2*sin(radians(60))); rotate(-radians(-30)); text("60°",0,0); resetMatrix(); translate((width-width*0.507)+width/2*cos(radians(90)),(height-height*0.0833)-width/2*sin(radians(90))); rotate(radians(0)); text("90°",0,0); resetMatrix(); translate(width-width*0.513+width/2*cos(radians(120)),(height-height*0.07129)-width/2*sin(radians(120))); rotate(radians(-30)); text("120°",0,0); resetMatrix(); translate((width-width*0.5104)+width/2*cos(radians(150)),(height-height*0.0574)-width/2*sin(radians(150))); rotate(radians(-60)); text("150°",0,0); popMatrix(); }

ソフト説明
size (1920, 1080); // adjust to PC displaysize
PC・DESKTOP→ディスプレイ設定→ディスプレイ解像度のsizeを入力

myPort = new Serial(this,"COM5", 9600); // adjust to PCport
"COM5"はPCーNANO・USB接続したときのPORTに変更

orcFont = loadFont("MS-Gothic-30.vlw"); //set up font Processing3_Platform by tool
proccessing3:ツール→フォント作成→MS-Gothic選択 サイズ30設定→OK

説明動画

ここに動画が表示されます

参考にさせて頂いた資料

ArduinoとProcessingとのシリアル通信を学習してみました
GY-906 (赤外線温度センサ MLX90614) を Arduino で利用する方法
赤外線温度計を作ろう
距離センサーとは?Arduinoとの互換性を言えば、どれを選ぶ?距離測定センサーの種類と選択方法

結果

レーザー距離計は言葉は難しそうですが、arduinoの工作例を真似するだけで動き、性能も超音波に比べ改善できました。一方赤外温度デバイスは体温が低い値になってしまいます。原因として①赤外線温度計を作ろうに放射率補正が必要という解説があります。デバイスに設定出来るようですが難しいようです。②一般的にthermopileは赤外発光面積で電圧が出るため、距離が離れ面積が小さくなると温度が低く出ます。今回狭指向性(5度)のレンズをつけ改善はしているようです。
離れたところの体温を正確に測ることは出来ず、検温機能レーダーは無理でしたが、人と物を見分ける事は出来そうです。
敷居の高いprocessingでしたが、遊びながら学習出来よい教材でした。

1
ログインしてコメントを投稿する