摘要:設(shè)計(jì)一款基于Arduino的車載測雪系統(tǒng),旨在實(shí)現(xiàn)對冬季冰雪路面數(shù)據(jù)的實(shí)時(shí)采集和監(jiān)測。采用ArduinoUnoR3作為控制器,通過超聲波傳感器和溫濕度傳感器采集積雪深度數(shù)據(jù)和溫濕度數(shù)據(jù),并由液晶1602實(shí)時(shí)顯示數(shù)據(jù),為駕駛員冰雪天氣安全行駛提供參考依據(jù)。通過軟件仿真采集積雪深度數(shù)據(jù)和溫濕度數(shù)據(jù),計(jì)算測量數(shù)據(jù)的誤差,分析測量的準(zhǔn)確性,從而驗(yàn)證該測雪系統(tǒng)設(shè)計(jì)的可行性。
關(guān)鍵詞:車載測雪系統(tǒng)Arduino控制器傳感器
中圖分類號:U463.6
DesignofanArduino-BasedVehicleSnowMeasurementDataSystem
ZHANGMan1LIWei2WANGWenshuai1FENGZhu1WANGZhiqiang1CUIHaibin1WANGJiangbei1
1.HarbinPetroleumUniversity,HarbinCity,HeilongjiangProvince,150028China;2.ComprehensiveInformationSecurityCenteroftheStaffDepartmentoftheArmedPoliceHeilongjiangCorps,HarbinCity,HeilongjiangProvince,150028China
Abstract:Inthisstudy,anArduino-basedvehiclesnowmeasurementsystemisdesigned,aimingtoachievereal-time?WgmjSxmtuHF1EGh4gTzYSB1Fy3nOuqN5yNVed4rRoy8=;datacollectionandmonitoringofwintericeandsnowroadconditions.ThesystemusesArduinoUnoR3asthecontroller,collectsdataofsnowdepth,temperatureandhumiditythroughultrasonicsensorsandtemperatureandhumiditysensors.Italsodisplaysthedatainreal-timeona1602LCDscreen,providingreferenceforsafedrivinginsnowyweatherforthedriver.Itcollectssnowdepthdataandtemperatureandhumiditydatathroughsoftwaresimulation,calculatesmeasurementdataerrors,analyzestheaccuracyofthemeasurements,andthusverifiesthefeasibilityofthesnowmeasurementsystemdesign.
KeyWords:Vehicle;Snowmeasurementsystem;Arduinocontroller;Sensor
我國東北地區(qū)大地冰雪覆蓋的時(shí)間較長,下雪結(jié)冰具有不確定性,給路面交通帶來安全隱患。突如其來的下雪和結(jié)冰給車輛行進(jìn)帶來困擾。本文設(shè)計(jì)一種用于冬季冰雪頻繁地區(qū)路面檢測的系統(tǒng),能根據(jù)測得的溫濕度數(shù)據(jù)確定行駛路面四周是否結(jié)冰,根據(jù)超聲波測距原理測得雪地厚度,為車輛平穩(wěn)行駛,確定雪地行駛路線提供參考依據(jù),為有清雪能力的車輛提供數(shù)據(jù)支持。氣象局采用積雪深度來衡量降雪強(qiáng)度,積雪深度是指積雪表面到下墊面的垂直深度[1]。
1總體設(shè)計(jì)
監(jiān)測系統(tǒng)必備電源,電源模塊負(fù)責(zé)提供系統(tǒng)需要的各種供電電壓[2],本設(shè)計(jì)采用直流5V的電源模塊。如圖1所示,本文選用ArduinoUnoR3作為控制器,ArduinoUNOR3是一款基于ATmega328P的微控制器板[3]。選用數(shù)字溫濕度傳感器DHT22測量環(huán)境的溫度、濕度。DHT22適用于道路積雪監(jiān)測系統(tǒng)中對溫濕度數(shù)據(jù)的采集,選用超聲波傳感器HC-SR04測量積雪深度,監(jiān)測積雪情況。表1描述了各傳感器的工作參數(shù),包括測量范圍、測量精度、工作電壓范圍、工作溫度范圍等。根據(jù)系統(tǒng)設(shè)計(jì)要求,傳感器是安裝在車底盤,工作在戶外,因此有環(huán)境溫度要求。
2系統(tǒng)工作原理
本設(shè)計(jì)分四步驟工作,分別為傳感器測量、數(shù)據(jù)處理、數(shù)據(jù)顯示和輸出、系統(tǒng)控制。車載測雪系統(tǒng)采用超聲波傳感器測量車下方積雪深度,溫濕度傳感器測量當(dāng)前溫濕度。Arduino采集傳感器數(shù)據(jù),根據(jù)預(yù)定的算法和邏輯處理數(shù)據(jù)。Arduino會(huì)將距離數(shù)據(jù)轉(zhuǎn)換為實(shí)際的雪深度數(shù)值,并根據(jù)采集的溫濕度情況。通過LCD顯示屏呈現(xiàn)給駕駛員。硬件的具體連接如圖2所示。
3超聲波傳感器測量原理
超聲波探頭發(fā)射一組超聲波脈沖,并由處理器記下初始發(fā)射時(shí)間[4],通過計(jì)算收到回波所需時(shí)間,來計(jì)算距離的。由于傳感器安裝高度固定,通過連續(xù)測量即可實(shí)現(xiàn)對雪深的
監(jiān)測[5]。假設(shè)超聲波在空氣中的速度在恒定不變的前提下,得到數(shù)學(xué)表達(dá)式:
式(1)中:s為距離;v為超聲波速度(空氣中數(shù)值為343m/s);Δt為從發(fā)送到收到回波的時(shí)間差。
4軟件平臺及硬件支持
本設(shè)計(jì)采用Arduino2.2作為編程平臺,Proteus8.15作為硬件繪制和仿真平臺。
4.1系統(tǒng)程序
#include<LiquidCrystal_I2C.h>
#include<microDS18B20.h>
MicroDS18B20<12>sensor;
LiquidCrystal_I2Clcd(0x27,16,2);
#defineHC_TRIG3
#defineHC_ECHO2
uint32_tmyTimer1;
#defineALPHA0.2
floatfilteredDistance=0;
inttemper;
voidsetup(){
Serial.begin(9600);
lcd.init();
BJiyq3S/lJhUdHoAHfkmvg==lcd.backlight();
pinMode(HC_TRIG,OUTPUT);
pinMode(HC_ECHO,INPUT);
temper=sensor.getTemp();
}
voidloop(){
floatdist=getDist(temper);
floatfilteredDistance=getFilteredDistance(dist);
Serial.print(dist);
Serial.print("");
Serial.print(filternWfpJTvClGRRLRYQgCtc+Q==edDistance);//выводим
Serial.print("");
Serial.println(temper);
delay(50);
if(millis()-myTimer1>=1000)
{
myTimer1=millis();
lcd.setCursor(0,0);
lcd.print("");
lcd.setCursor(0,0);
lcd.print(filteredDistance);
}
}
floatgetDist(intt){
digitalWrite(HC_TRIG,HIGH);
delayMicroseconds(10);
digitalWrite(HC_TRIG,LOW);
uint32_tus=pulseIn(HC_ECHO,HIGH);
return(us*(t*6/10+330)/2000ul/10);
}
floatgetFilteredDistance(floatnewDistance){
filteredDistance=(ALPHA*newDistance)+((1-ALPHA)*filteredDistance);
returnfilteredDistance;
}
{
"version":1,
"author":"ValeraGribov",
"editor":"wokwi",
"parts":[
{"type":"wokwi-Arduino-uno","id":"uno","top":0.6,"left":-115.8,"attrs":{}},
{"type":"wokwi-lcd1602","id":"lcd1","top":16, "left":236,"attrs":{"pins":"i2c"}},
{
"type":"wokwi-hc-sr04",
"id":"ultrasonic1",
"top":-228.9,
"left":197.5,
"attrs":{"distance":"18"}
},
{"type":"board-ds18b20","id":"temp1","top":-279.53,"left":4.08,"attrs":{}},
{
"type":"wokwi-resistor",
"id":"r1",
"top":-177.6,
"left":37.85,
"rotate":90,
"attrs":{"value":"5000"}
}
]
"connections":[
["lcd1:VCC","uno:5V","red",["h-28.8","v163.3","h-172.8"]],
["lcd1:GND","uno:GND.2","black",["h-19.2","v182.4","h-163.2"]],
["lcd1:SDA","uno:A4","green",["h-48","v201.8","h-67.2","v-9.6"]],
["lcd1:SCL","uno:A5","green",["h-19.2","v182.7","h-76.8"]],
["ultrasonic1:VCC","uno:5V","red",["v48","h-403.2","v374.4","h182.4","v-9.6"]],
["ultrasonic1:GND","uno:GND.1","black",["v19.2","h-298.8","v28.8"]],
["ultrasonic1:TRIG","uno:3","green",["v67.2","h-0.4"]],
["ultrasonic1:ECHO","uno:2","green",["v86.4","h-0.8"]],
["temp1:GND","uno:GND.1","black",["v0"]],
["temp1:VCC","uno:5V","red",["v9.6","h38.4","v-86.4","h-220.8","v576","h211.2"]],
["temp1:DQ","uno:12","green",["v0"]],
["temp1:DQ","r1:2","green",["v0"]],
["r1:1","temp1:VCC","red",["h0","v0","h-38.4","v-28.8"]]
],
"dependencies":{}
}
4.2積雪深度和溫濕度數(shù)據(jù)仿真測量結(jié)果
以2023年11月6日哈爾濱地區(qū)暴雪天氣數(shù)據(jù)為例,戶外溫度-9℃,相對濕度85%,積雪深度25cm。用前述數(shù)據(jù)作為本研究的輸入數(shù)據(jù),如圖3、圖4所示,當(dāng)戶外積雪深度輸入數(shù)據(jù)為25cm時(shí),超聲波傳感器測得積雪深度數(shù)據(jù)為24cm,誤差為1cm。當(dāng)戶外溫濕度輸入數(shù)據(jù)分別為-9℃、85%時(shí),溫濕度傳感器測得溫度數(shù)據(jù)為-9℃,濕度數(shù)據(jù)為85%。仿真測量基本準(zhǔn)確。
5結(jié)語
本設(shè)計(jì)為車輛駕駛員提供行車路上積雪深度和戶外環(huán)境溫濕度,為冰雪路面行車提供參考依據(jù)。
本研究實(shí)現(xiàn)了車載測雪系統(tǒng)功能,為冬季行車提供積雪數(shù)據(jù)信息。通過溫濕度傳感器判斷行駛路面是否結(jié)冰。選用超聲波傳感器回波反射測量車下雪地深度數(shù)據(jù)。
本文設(shè)計(jì)的是一種應(yīng)用于冬季冰雪道路的測雪系統(tǒng),通過電腦軟件仿真驗(yàn)證測雪系統(tǒng)設(shè)計(jì)的可行性,從獲得的數(shù)據(jù)來看,超聲波測深度存在一定誤差,相對誤差為0.4%,為可以接受范圍。溫濕度傳感器測量仿真測量結(jié)果基本正確。
qExiJTKrHS8hB442bvdkFQ==本文軟件仿真驗(yàn)證結(jié)果有一定的局限性,天氣轉(zhuǎn)暖積雪消融,超聲波傳感器無法到真實(shí)環(huán)境測量驗(yàn)證,獲取真實(shí)數(shù)據(jù)。該系統(tǒng)在車輛底盤的準(zhǔn)確位置還有待進(jìn)一步校正。
參考文獻(xiàn)
[1]劉威.鐵路沿線激光雪深計(jì)研究與設(shè)計(jì)[D].南京:南京信息工程大學(xué),2021.
[2]胡敏.基于邊緣AI的雪面識別技術(shù)研究與應(yīng)用[D].南京:南京信息工程大學(xué),2021.
[3]黃業(yè)源,李守曉.基于Arduino與Blinker云平臺的溫室大棚環(huán)境監(jiān)控及自動(dòng)灌溉系統(tǒng)設(shè)計(jì)[J].物聯(lián)網(wǎng)技術(shù),2024,14(1):26-28,33.
[4]孟慶偉,張磊,蒲莉莉.超聲波自動(dòng)化積雪深度測量與分析[J].測繪與空間地理信息,2021,44(9):102-105,109.
[5]周鵬,楊帥,楊斌,等.人工觀測與超聲波傳感器測量雪深的差異及其影響因素[J].貴州農(nóng)業(yè)科學(xué),2020,48(6):139-142.