本网页已闲置超过3分钟,按键盘任意键或点击空白处,即可回到网页
最热资讯


亲,“电路城”已合并升级到更全、更大、更强的「新与非网」。点击查看「新与非网」
该系统是基于物联网的热报警系统,当检测到热异常时,会关闭设备并发送短信。
硬件部件:
软件应用程序:
电路图:
第 1 步 : 蜂鸣器标有“+”的引脚为正极引,它连接到 Bolt Wi-Fi 模块的 GPIO 1 端口。
第 2 步:蓝色和红色 LED 的较长脚是正极引脚,它们分别连接到 GPIO 端口 2 和 3。
第 3 步:蜂鸣器的“-”标记引脚和两个 LED 的较短脚是负极引脚,它们都连接到 Bolt Wi-Fi 模块的 GND(接地)端口。
第 4 步:LM35 传感器的引脚配置如下:
(注意:最好使用面包板进行连接,因为它可以防止 Bolt 模块中的电线过度拥挤。)
代码:(点击查看)
import device_info
from boltiot import Bolt, Sms
import json,time
max_temp = 55
min_temp = 25
mybolt = Bolt(device_info.api, device_info.dev_id)
sms = Sms(device_info.SID, device_info.token, device_info.my_no, device_info.from_no)
response = mybolt.isOnline()
power = json.loads(response)
if power['value']== "online":
while True:
print ("Reading sensor data...")
data = json.loads(mybolt.analogRead('A0'))
try:
temp = int(data['value'])*100/1024
print ("Sensor reading is "+str(temp)+" degree celsius")
if temp > max_temp:
print ("Contacting Twilio servers...")
response = sms.send_sms("HIGH TEMPERATURE ALERT! CURRENT TEMPERATURE IS "+str(temp))
print ("SMS status: "+str(response.status))
response2 = mybolt.analogWrite('1','250')
for i in range(1,8):
response3 = mybolt.digitalWrite('2','HIGH')
time.sleep(0.5)
response3 = mybolt.digitalWrite('2','LOW')
elif temp < min_temp:
print ("Contacting Twilio servers...")
response = sms.send_sms("LOW TEMPERATURE ALERT! CURRENT TEMPERATURE IS: "+str(temp))
print ("SMS status: "+str(response.status))
response2 = mybolt.analogWrite('1','50')
for i in range(1,8):
response3 = mybolt.digitalWrite('3','HIGH')
time.sleep(0.5)
response3 = mybolt.digitalWrite('3','LOW')
else:
print ("Temperature alright.")
response2 = mybolt.digitalWrite('1','LOW')
response3 = mybolt.digitalWrite('2','LOW')
response3 = mybolt.digitalWrite('3','LOW')
except Exception as e:
print ("Error!")
print (e)
time.sleep(10)
else:
print ("DEVICE OFFLINE..")
print ("MAKE SURE THE IOT MODULE HAS BEEN PLUGGED IN")
项目演示:
拆解: 130美元的声控家用设备Amazon Tap蓝牙音箱
2016-06-29
面临制造业流失,科技巨头跑路,创业公司倒闭的深圳,已不再是科技创业者的天堂?
2017-10-17
物联网连接技术:cellular还是LPWAN?
2018-11-16
物联网安全和Linux:为什么IncludeOS有其优势
2018-11-14
遥感技术的演变:实现物联网的承诺
2018-11-19
2019年你最值得入手的5款开发板
2019-08-21
小米米家生态中的3种温湿度传感器智能硬件比较,哪种最好?
2019-10-12
这套工业物联网解决方案把乐高变成了一座智慧城市
2019-06-24
【实战课】华为IoT物联网平台(7)NB-IoT芯片与模组介绍
2019-07-21
NODEMCU-物联网机器人
2019-08-01
讨论