資料介紹
描述
目標(biāo):
創(chuàng)建有助于實(shí)現(xiàn)以下目標(biāo)的設(shè)備:
- 雖然允許制造商將藥片的溫度保持在 -40 到 -30 攝氏度之間,但藥片的溫度不得一次保持在 -33 到 -30 度之間超過 20 分鐘。
- 此外,制造商應(yīng)記錄用于生產(chǎn)片劑的冷卻室何時(shí)打開。
項(xiàng)目目標(biāo):
Capstone 項(xiàng)目的目標(biāo)如下。
A. 使用 Bolt 和 LM35 傳感器構(gòu)建溫度監(jiān)測系統(tǒng)電路。
- LM35 的 VCC 引腳連接到 Bolt Wifi 模塊的 5v。(白線)
- LM35 的輸出引腳連接到 Bolt Wifi 模塊的 A0(模擬輸入引腳)。(灰線)
- LM35 的 GND 引腳連接到 Gnd。(紫線)

B. 在 Bolt Cloud 上創(chuàng)建一個(gè)產(chǎn)品,以監(jiān)控來自 LM35 的數(shù)據(jù),并將其鏈接到您的 Bolt。


C. 編寫產(chǎn)品代碼,對 Bolt 發(fā)送的數(shù)據(jù)運(yùn)行多項(xiàng)式回歸算法。
帶著這個(gè)目標(biāo),奈杰爾先生成功地滿足了政府設(shè)定的第一個(gè)條件。使用預(yù)測數(shù)據(jù),只要圖表預(yù)測溫度將保持在 -33 和 -30 攝氏度范圍內(nèi)超過 20 分鐘,他就能夠及早采取行動(dòng)。


代碼 :
setChartLibrary('google-chart');
setChartTitle('Polynomial Regression');
setChartType('predictionGraph');
setAxisName('time_stamp','temp');
mul(0.0977);
plotChart('time_stamp','temp');
D. 將溫度監(jiān)測電路保持在冰箱內(nèi),關(guān)閉冰箱門,讓系統(tǒng)記錄溫度讀數(shù)約 2 小時(shí)。


E. 使用您在 2 小時(shí)內(nèi)收到的讀數(shù),設(shè)置冰箱內(nèi)溫度的界限。

F. 編寫一個(gè) Python 代碼,每 10 秒獲取一次溫度數(shù)據(jù),如果溫度超出您在目標(biāo)“E”中確定的溫度閾值,則發(fā)送電子郵件警報(bào)。
打開ubuntu服務(wù)器。
創(chuàng)建一個(gè)文件來存儲(chǔ)憑據(jù):
sudo nano email_conf.py
輸入以下代碼。
MAILGUN_API_KEY = 'This is the private API key which you can find on your Mailgun Dashboard'
SANDBOX_URL= 'You can find this on your Mailgun Dashboard'
SENDER_EMAIL = 'This would be test@your SANDBOX_URL'
RECIPIENT_EMAIL = 'Enter your Email ID Here'
API_KEY = 'This is your Bolt Cloud account API key'
DEVICE_ID = 'This is the ID of your Bolt device'
FRAME_SIZE = 10
MUL_FACTOR = 6
創(chuàng)建主代碼文件:
sudo nano capstone_project.py
輸入以下代碼。
import email_conf, json, time, math, statistics
from boltiot import Email, Bolt
max_limit = 52
min_limit = -52
while True:
response = mybolt.analogRead('A0')
data = json.loads(response)
if data['success'] != 1:
print("There was an error while retriving the data.")
print("This is the error:"+data['value'])
time.sleep(10)
continue
print ("This is the value "+data['value'])
sensor_value=0
try:
sensor_value = int(data['value'])
if sensor_value > max_limit or sensor_value < min_limit:
print("Making request to Mailgun to send an email")
temperature = (100*sensor_value)/1024
response = mailer.send_email("Alert!!", "The temperature of the refrigerator is " +str(temperature))
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text['message']))
except e:
print("There was an error while parsing the response: ",e)
continue
G. 修改 Python 代碼,同時(shí)進(jìn)行 Z 分?jǐn)?shù)分析,并在檢測到異常時(shí)打印“有人打開冰箱門”這一行。
H. 調(diào)整 Z-score 分析代碼,當(dāng)有人打開冰箱門時(shí),它會(huì)檢測到異常。
最終代碼:
import email_conf, json, time, math, statistics
from boltiot import Email, Bolt
max_limit = 52
min_limit = -52
def compute_bounds(history_data,frame_size,factor):
if len(history_data) return None
if len(history_data)>frame_size :
del history_data[0:len(history_data)-frame_size]
Mn=statistics.mean(history_data)
Variance=0
for data in history_data :
Variance += math.pow((data-Mn),2)
Zn = factor * math.sqrt(Variance / frame_size)
High_bound = history_data[frame_size-1]+Zn
Low_bound = history_data[frame_size-1]-Zn
return [High_bound,Low_bound]
mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID)
mailer = Email(email_conf.MAILGUN_API_KEY, email_conf.SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL)
history_data=[]
while True:
response = mybolt.analogRead('A0')
data = json.loads(response)
if data['success'] != 1:
print("There was an error while retriving the data.")
print("This is the error:"+data['value'])
time.sleep(10)
continue
print ("This is the value "+data['value'])
sensor_value=0
try:
sensor_value = int(data['value'])
if sensor_value > max_limit or sensor_value < min_limit:
print("Making request to Mailgun to send an email")
temperature = (100*sensor_value)/1024
response = mailer.send_email("Alert!!", "The temperature of the refrigerator is " +str(temperature))
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text['message']))
except e:
print("There was an error while parsing the response: ",e)
continue
bound = compute_bounds(history_data,email_conf.FRAME_SIZE,email_conf.MUL_FACTOR)
if not bound:
required_data_count=email_conf.FRAME_SIZE-len(history_data)
print("Not enough data to compute Z-score. Need ",required_data_count," more data points")
history_data.append(int(data['value']))
time.sleep(10)
continue
try:
if sensor_value > bound[0] or sensor_value < bound[1]:
print ("Someone has opened the refrigerator door.")
history_data.append(sensor_value);
except Exception as e:
print ("Error",e)
time.sleep(10)
輸出:
運(yùn)行代碼:
sudo python3 capstone_project.py


?
- LM35高精度攝氏溫度傳感器數(shù)據(jù)表
- 使用MSP-EXP430F5529、LM35 LCD102x64的溫度傳感器
- 基于NodeMCU的物聯(lián)網(wǎng)項(xiàng)目連接LM35溫度傳感器
- 如何將LM35溫度傳感器上傳到云端
- 使用Bolt和LM35傳感器構(gòu)建溫度監(jiān)控系統(tǒng)
- 使用溫度傳感器LM35來控制伺服電機(jī)速度 3次下載
- 如何使用Arduino和LM35傳感器制作溫度計(jì)
- 使用LM35溫度傳感器監(jiān)測食品行業(yè)冷庫的溫度
- 使用LM35和BoltIoT WiFi模塊持續(xù)監(jiān)測溫度
- 使用單片機(jī)實(shí)現(xiàn)溫度傳感器LM35全量程應(yīng)用測試的C語言實(shí)例免費(fèi)下載 33次下載
- Arduino的LM35溫度傳感器實(shí)驗(yàn)程序和工程文件免費(fèi)下載 27次下載
- LM35溫度傳感器的電路原理圖和PCB資料免費(fèi)下載 68次下載
- LM35精密溫度傳感器的數(shù)據(jù)手冊免費(fèi)下載 37次下載
- 如何使用蜂鳴器和LM35溫度傳感器設(shè)計(jì)溫度報(bào)警器的詳細(xì)資料概述 59次下載
- 基于LM35溫度傳感器的溫控系統(tǒng)設(shè)計(jì)
- 集成溫度傳感器LM3911構(gòu)成的恒溫控制電路 5030次閱讀
- 基于LM35D的溫控加熱器電路圖 1.1w次閱讀
- LM35溫度傳感器功能換為攝氏溫度值及設(shè)計(jì)思路 2.7w次閱讀
- 基于采用AT89S51單片機(jī)和LM35溫度傳感器的溫度采集顯示系統(tǒng)設(shè)計(jì) 4821次閱讀
- LM35與ICL7107構(gòu)成的溫度計(jì)電路圖 1.6w次閱讀
- 集成溫度傳感器AD590_LM35及其測量電路 2.8w次閱讀
- 基于LM35和51單片機(jī)的溫度采集數(shù)碼管顯示系統(tǒng) 1.4w次閱讀
- 基于LM35的單片機(jī)溫度采集顯示系統(tǒng) 8756次閱讀
- 基于LM35溫度傳感器的高精度恒溫控制系統(tǒng) 1w次閱讀
- 基于LM35溫度傳感器的溫控系統(tǒng)設(shè)計(jì) 8291次閱讀
- lm35測溫電路圖大全(二款lm35測溫電路設(shè)計(jì)) 2.4w次閱讀
- lm35怎么用(lm35工作原理及內(nèi)部結(jié)構(gòu)_應(yīng)用電路圖) 6.1w次閱讀
- LM35溫度傳感器應(yīng)用及特性 1.2w次閱讀
- 低溫傳感器 1916次閱讀
- 溫度傳感器 3248次閱讀
下載排行
本周
- 1山景DSP芯片AP8248A2數(shù)據(jù)手冊
- 1.06 MB | 532次下載 | 免費(fèi)
- 2RK3399完整板原理圖(支持平板,盒子VR)
- 3.28 MB | 339次下載 | 免費(fèi)
- 3TC358743XBG評估板參考手冊
- 1.36 MB | 330次下載 | 免費(fèi)
- 4DFM軟件使用教程
- 0.84 MB | 295次下載 | 免費(fèi)
- 5元宇宙深度解析—未來的未來-風(fēng)口還是泡沫
- 6.40 MB | 227次下載 | 免費(fèi)
- 6迪文DGUS開發(fā)指南
- 31.67 MB | 194次下載 | 免費(fèi)
- 7元宇宙底層硬件系列報(bào)告
- 13.42 MB | 182次下載 | 免費(fèi)
- 8FP5207XR-G1中文應(yīng)用手冊
- 1.09 MB | 178次下載 | 免費(fèi)
本月
- 1OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234315次下載 | 免費(fèi)
- 2555集成電路應(yīng)用800例(新編版)
- 0.00 MB | 33566次下載 | 免費(fèi)
- 3接口電路圖大全
- 未知 | 30323次下載 | 免費(fèi)
- 4開關(guān)電源設(shè)計(jì)實(shí)例指南
- 未知 | 21549次下載 | 免費(fèi)
- 5電氣工程師手冊免費(fèi)下載(新編第二版pdf電子書)
- 0.00 MB | 15349次下載 | 免費(fèi)
- 6數(shù)字電路基礎(chǔ)pdf(下載)
- 未知 | 13750次下載 | 免費(fèi)
- 7電子制作實(shí)例集錦 下載
- 未知 | 8113次下載 | 免費(fèi)
- 8《LED驅(qū)動(dòng)電路設(shè)計(jì)》 溫德爾著
- 0.00 MB | 6656次下載 | 免費(fèi)
總榜
- 1matlab軟件下載入口
- 未知 | 935054次下載 | 免費(fèi)
- 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
- 78.1 MB | 537798次下載 | 免費(fèi)
- 3MATLAB 7.1 下載 (含軟件介紹)
- 未知 | 420027次下載 | 免費(fèi)
- 4OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234315次下載 | 免費(fèi)
- 5Altium DXP2002下載入口
- 未知 | 233046次下載 | 免費(fèi)
- 6電路仿真軟件multisim 10.0免費(fèi)下載
- 340992 | 191187次下載 | 免費(fèi)
- 7十天學(xué)會(huì)AVR單片機(jī)與C語言視頻教程 下載
- 158M | 183279次下載 | 免費(fèi)
- 8proe5.0野火版下載(中文版免費(fèi)下載)
- 未知 | 138040次下載 | 免費(fèi)
評論