99精品伊人亚洲|最近国产中文炮友|九草在线视频支援|AV网站大全最新|美女黄片免费观看|国产精品资源视频|精彩无码视频一区|91大神在线后入|伊人终合在线播放|久草综合久久中文

電子發(fā)燒友App

硬聲App

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>使用Bolt和LM35傳感器構(gòu)建溫度監(jiān)測系統(tǒng)電路

使用Bolt和LM35傳感器構(gòu)建溫度監(jiān)測系統(tǒng)電路

2022-12-16 | zip | 0.32 MB | 次下載 | 免費(fèi)

資料介紹

描述

目標(biāo):

創(chuàng)建有助于實現(xiàn)以下目標(biāo)的設(shè)備:

  • 雖然允許制造商將藥片的溫度保持在 -40 到 -30 攝氏度之間,但藥片的溫度不得一次保持在 -33 到 -30 度之間超過 20 分鐘。
  • 此外,制造商應(yīng)記錄用于生產(chǎn)片劑的冷卻室何時打開。

項目目標(biāo):

Capstone 項目的目標(biāo)如下。

A. 使用 Bolt 和 LM35 傳感器構(gòu)建溫度監(jiān)測系統(tǒng)電路。

  • LM35 的 VCC 引腳連接到 Bolt Wifi 模塊的 5v。(白線)
  • LM35 的輸出引腳連接到 Bolt Wifi 模塊的 A0(模擬輸入引腳)。(灰線)
  • LM35 的 GND 引腳連接到 Gnd。(紫線)
pYYBAGOX5eeAeanZAADWooKF7OQ518.png
?

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

pYYBAGOX5fWAfuF-AAEV296cocA729.png
?
pYYBAGOX5fmAXUltAAD3nAVBmpU215.png
?

C. 編寫產(chǎn)品代碼,對 Bolt 發(fā)送的數(shù)據(jù)運(yùn)行多項式回歸算法。

帶著這個目標(biāo),奈杰爾先生成功地滿足了政府設(shè)定的第一個條件。使用預(yù)測數(shù)據(jù),只要圖表預(yù)測溫度將保持在 -33 和 -30 攝氏度范圍內(nèi)超過 20 分鐘,他就能夠及早采取行動。

poYBAGOX5f6Ab35OAAFJUnSGPMc030.png
?
pYYBAGOX5gKARKz5AAEwRydCNh0643.png
?

代碼 :

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 小時。

pYYBAGOX5gaAQkPuAABUUbLSpJo807.png
?
poYBAGOX5giANQFGAABAuz3NJ6A429.png
?

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

pYYBAGOX5haAAj3qAAFBFjkfOqQ309.png
?

F. 編寫一個 Python 代碼,每 10 秒獲取一次溫度數(shù)據(jù),如果溫度超出您在目標(biāo)“E”中確定的溫度閾值,則發(fā)送電子郵件警報。

打開ubuntu服務(wù)器。

創(chuàng)建一個文件來存儲憑據(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 代碼,同時進(jìn)行 Z 分?jǐn)?shù)分析,并在檢測到異常時打印“有人打開冰箱門”這一行。

H. 調(diào)整 Z-score 分析代碼,當(dāng)有人打開冰箱門時,它會檢測到異常。

最終代碼:

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
poYBAGOX5hyANYhcAAEj4UGqZGY228.png
?
pYYBAGOX5iCAHCSBAAFKq7davKU526.png
?

?


下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1DD3118電路圖紙資料
  2. 0.08 MB   |  1次下載  |  免費(fèi)
  3. 2AD庫封裝庫安裝教程
  4. 0.49 MB   |  1次下載  |  免費(fèi)
  5. 3PC6206 300mA低功耗低壓差線性穩(wěn)壓器中文資料
  6. 1.12 MB   |  1次下載  |  免費(fèi)
  7. 4網(wǎng)絡(luò)安全從業(yè)者入門指南
  8. 2.91 MB   |  1次下載  |  免費(fèi)
  9. 5DS-CS3A P00-CN-V3
  10. 618.05 KB  |  1次下載  |  免費(fèi)
  11. 6海川SM5701規(guī)格書
  12. 1.48 MB  |  次下載  |  免費(fèi)
  13. 7H20PR5電磁爐IGBT功率管規(guī)格書
  14. 1.68 MB   |  次下載  |  1 積分
  15. 8IP防護(hù)等級說明
  16. 0.08 MB   |  次下載  |  免費(fèi)

本月

  1. 1貼片三極管上的印字與真實名稱的對照表詳細(xì)說明
  2. 0.50 MB   |  103次下載  |  1 積分
  3. 2涂鴉各WiFi模塊原理圖加PCB封裝
  4. 11.75 MB   |  89次下載  |  1 積分
  5. 3錦銳科技CA51F2 SDK開發(fā)包
  6. 24.06 MB   |  43次下載  |  1 積分
  7. 4錦銳CA51F005 SDK開發(fā)包
  8. 19.47 MB   |  19次下載  |  1 積分
  9. 5PCB的EMC設(shè)計指南
  10. 2.47 MB   |  16次下載  |  1 積分
  11. 6HC05藍(lán)牙原理圖加PCB
  12. 15.76 MB   |  13次下載  |  1 積分
  13. 7802.11_Wireless_Networks
  14. 4.17 MB   |  12次下載  |  免費(fèi)
  15. 8蘋果iphone 11電路原理圖
  16. 4.98 MB   |  6次下載  |  2 積分

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935127次下載  |  10 積分
  3. 2開源硬件-PMP21529.1-4 開關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設(shè)計
  4. 1.48MB  |  420064次下載  |  10 積分
  5. 3Altium DXP2002下載入口
  6. 未知  |  233089次下載  |  10 積分
  7. 4電路仿真軟件multisim 10.0免費(fèi)下載
  8. 340992  |  191390次下載  |  10 積分
  9. 5十天學(xué)會AVR單片機(jī)與C語言視頻教程 下載
  10. 158M  |  183342次下載  |  10 積分
  11. 6labview8.5下載
  12. 未知  |  81588次下載  |  10 積分
  13. 7Keil工具M(jìn)DK-Arm免費(fèi)下載
  14. 0.02 MB  |  73815次下載  |  10 積分
  15. 8LabVIEW 8.6下載
  16. 未知  |  65989次下載  |  10 積分