該項目具有檢測室內環境數據和發送電子郵件、開燈按鈕、體感照明屏等功能。
經過不斷的踩坑學習,初代簡易智能家居中控系統已經完成,大部分功能已經完成,但是有些功能WIO終端沒有實現。一方面是因為代碼量太大,會給WIO終端帶來很大的“壓力”;另一方面,我的技術還不夠,還得繼續學習,尋找解決方案。
首先介紹一下我最初的想法:
WIO終端是一款高度集成的開發板。它配備了液晶顯示屏、三個按鈕、一個五向開關、麥克風、揚聲器、加速度傳感器、紅外發射器等,甚至可以與樹莓派和 Jetson nano 結合使用。作為家居的“大腦”,這些硬件非常實用。因此,在智能家居的中控系統中,我選擇WIO終端作為這個系統的核心。
未來,家里應該有一個智能管家。這個智能管家就是我現在做的簡單版。有了它,您就可以在家中獲取準確實時的溫度、濕度、光照強度等數據。不僅如此,它還像一個“萬能”遙控器,可以幫助你控制家中的電器。當然,它應該像智能音箱一樣,能夠理解我們給它的指令并響應我們!
提前準備
在這個項目的過程中,我第一次使用了開發板WIO終端:
不知為何,在WIO終端上使用grow-temperature 濕度壓力氣體傳感器時,接收不到數據,只好轉身實現:
使用Django搭建一個簡單的數據中心(基于Grove——溫度濕度壓力氣體傳感器)
重回正軌,實現數據展示的主要功能:
使用WIO終端通過HTTP請求獲取并顯示傳感器實時數據
下一步就是完善其他三個功能,我主要通過python實現
完善系統功能
前面我簡單提到了一些WIO終端上沒有實現的功能的原因,具體原因我沒有細說。畢竟剛開始做,所以打算先實現功能。至于實現方式,我想在二代系統中改進一下
通過 WIO 端子輸出狀態
我要表達的狀態是讀取可配置按鈕的狀態(是否按下按鈕)和麥克風的數據(數據也可以代表狀態)
對于WIO終端來說,簡單的輸出這些數據還是比較簡單的
補充 setup() 中的管腳定義:
pinMode(WIO_MIC, INPUT);
pinMode(WIO_KEY_A, INPUT_PULLUP);
pinMode(WIO_KEY_B, INPUT_PULLUP);
pinMode(WIO_KEY_C, INPUT_PULLUP);
補充loop()中的if條件語句:
int val_first = analogRead(WIO_MIC);
int val_next = analogRead(WIO_MIC);
if (abs(val_first - val_next) >= 100){
Serial.println("send message!");
}
if (digitalRead(WIO_KEY_A) == LOW) {
Serial.println("A Key pressed");
}
if (digitalRead(WIO_KEY_B) == LOW) {
Serial.println("B Key pressed");
}
if (digitalRead(WIO_KEY_C) == LOW) {
Serial.println("C Key pressed");
}
當WIO終端連接PC時,PC會讀取串口的數據,并在讀取相應的輸出時采取相應的動作
至此,我們已經完成了關于 Arduino 的所有代碼。整理一下代碼,分享給大家。
#include
#include
#include"LIS3DHTR.h"
#include"Free_Fonts.h"
#include"TFT_eSPI.h"
TFT_eSPI tft;
LIS3DHTR lis;
WiFiClient client;
const char* ssid = "Your WiFi account";
const char* password = "Your WiFi password";
const char* server = "192.168.1.102"; // Server URL
String data;
float accelerator_readings[3];
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
delay(100);
pinMode(WIO_MIC, INPUT);
pinMode(WIO_KEY_A, INPUT_PULLUP);
pinMode(WIO_KEY_B, INPUT_PULLUP);
pinMode(WIO_KEY_C, INPUT_PULLUP);
lis.begin(Wire1);
lis.setOutputDataRate(LIS3DHTR_DATARATE_25HZ);
lis.setFullScaleRange(LIS3DHTR_RANGE_2G);
float x_raw = lis.getAccelerationX();
float y_raw = lis.getAccelerationY();
float z_raw = lis.getAccelerationZ();
accelerator_readings[0] = x_raw; //store x-axis readings
accelerator_readings[1] = y_raw; //store y-axis readings
accelerator_readings[2] = z_raw; //store z-axis readings
// Serial.print("Attempting to connect to SSID: ");
// Serial.println(ssid);
WiFi.begin(ssid, password);
tft.begin();
tft.setRotation(3);
tft.fillScreen(TFT_BLACK);
tft.setFreeFont(FMB12);
tft.setCursor((320 - tft.textWidth("Connecting to Wi-Fi.."))/2, 120);
tft.print("Connecting to Wi-Fi..");
// attempt to connect to Wifi network:
while (WiFi.status() != WL_CONNECTED) {
// Serial.print(".");
// wait 1 second for re-trying
delay(1000);
}
// Serial.print("Connected to ");
// Serial.println(ssid);
tft.fillScreen(TFT_BLACK);
tft.setCursor((320 - tft.textWidth("Connected!"))/2, 120);
tft.print("Connected!");
getFirstData();
}
void loop()
{
int val_first = analogRead(WIO_MIC);
float x_raw = lis.getAccelerationX();
float y_raw = lis.getAccelerationY();
float z_raw = lis.getAccelerationZ();
int val_next = analogRead(WIO_MIC);
if (abs(val_first - val_next) >= 100){
Serial.println("send message!");
}
if (digitalRead(WIO_KEY_A) == LOW) {
Serial.println("A Key pressed");
}
if (digitalRead(WIO_KEY_B) == LOW) {
Serial.println("B Key pressed");
}
if (digitalRead(WIO_KEY_C) == LOW) {
Serial.println("C Key pressed");
}
if (abs(accelerator_readings[0] - x_raw) >= 0.1 && abs(accelerator_readings[1] - y_raw) >= 0.1 && abs(accelerator_readings[2] - z_raw) >= 0.1){
// Turning on the LCD backlight
digitalWrite(LCD_BACKLIGHT, HIGH);
getFirstData();
delay(3000);
getLastData();
delay(3000);
}
else {
// Turning off the LCD backlight
digitalWrite(LCD_BACKLIGHT, LOW);
delay(500);
}
for (uint8_t i = 0; i<3; i++){
accelerator_readings[i] = 0.0; //this is used to remove the first read variable
}
accelerator_readings[0] = x_raw; //store x-axis readings
accelerator_readings[1] = y_raw; //store y-axis readings
accelerator_readings[2] = z_raw; //store z-axis readings
}
void getFirstData() {
// Serial.println("\nStarting connection to server...");
if (!client.connect(server, 9000)) {
// Serial.println("Connection failed!");
tft.fillScreen(TFT_BLACK);
tft.setCursor((320 - tft.textWidth("Connection failed!"))/2, 120);
tft.print("Connection failed!");
} else {
// Serial.println("Connected to server!");
// Make a HTTP request:
String postRequest =(String)("GET ") + "/ HTTP/1.1\r\n" + "Connection: close\r\n\r\n";
// Serial.println(postRequest);
client.print(postRequest);
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
// Serial.println("headers received");
break;
}
}
while(client.available())
{
String line = client.readStringUntil('\r');
data = line;
}
// Serial.println(data);
client.stop();
// Serial.println("closing connection");
}
//ArduinoJson to parse data, plesae check ArduinoJson for more info
const size_t capacity = JSON_OBJECT_SIZE(5) + 100;
DynamicJsonDocument doc(capacity);
deserializeJson(doc, data);
float temperature = doc["temperature"];
float pressure = doc["pressure"];
float humidity = doc["humidity"];
// -----------------LCD---------------------
tft.setFreeFont(FF17);
tft.setTextColor(tft.color565(224,225,232));
tft.drawString("Current Data At Home",20,10);
tft.fillRoundRect(10, 45, 300, 55, 5, tft.color565(40,40,86));
tft.fillRoundRect(10, 105, 300, 55, 5, tft.color565(40,40,86));
tft.fillRoundRect(10, 165, 300, 55, 5, tft.color565(40,40,86));
tft.setFreeFont(FM9);
tft.drawString("temperature:", 75, 50);
tft.drawString("pressure:",75, 110);
tft.drawString("humidity:",75, 170);
tft.setFreeFont(FMB12);
tft.setTextColor(TFT_RED);
tft.drawFloat(temperature,2 , 140, 75);
tft.setTextColor(tft.color565(224,225,232));
tft.drawFloat(pressure,2 , 140, 135);
tft.setTextColor(TFT_GREEN);
tft.drawFloat(humidity,2 , 140, 195);
tft.drawString("℃", 210, 75);
tft.drawString("KPa",210, 135);
tft.drawString("%",210, 195);
}
void getLastData() {
// Serial.println("\nStarting connection to server...");
if (!client.connect(server, 9000)) {
// Serial.println("Connection failed!");
tft.fillScreen(TFT_BLACK);
tft.setCursor((320 - tft.textWidth("Connection failed!"))/2, 120);
tft.print("Connection failed!");
} else {
// Serial.println("Connected to server!");
// Make a HTTP request:
String postRequest =(String)("GET ") + "/ HTTP/1.1\r\n" + "Connection: close\r\n\r\n";
// Serial.println(postRequest);
client.print(postRequest);
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
// Serial.println("headers received");
break;
}
}
while(client.available())
{
String line = client.readStringUntil('\r');
data = line;
}
// Serial.println(data);
client.stop();
// Serial.println("closing connection");
}
//ArduinoJson to parse data, plesae check ArduinoJson for more info
const size_t capacity = JSON_OBJECT_SIZE(5) + 100;
DynamicJsonDocument doc(capacity);
deserializeJson(doc, data);
float humidity = doc["humidity"];
float gas = doc["gas"];
String updataTime = doc["updataTime"];
// -----------------LCD---------------------
tft.setFreeFont(FF17);
tft.setTextColor(tft.color565(224,225,232));
tft.drawString("Current Data At Home",20,10);
tft.fillRoundRect(10, 45, 300, 55, 5, tft.color565(40,40,86));
tft.fillRoundRect(10, 105, 300, 55, 5, tft.color565(40,40,86));
tft.fillRoundRect(10, 165, 300, 55, 5, tft.color565(40,40,86));
tft.setFreeFont(FM9);
tft.drawString("humidity:", 75, 50);
tft.drawString("gas:",75, 110);
tft.drawString("updataTime:",75, 170);
tft.setFreeFont(FMB12);
tft.setTextColor(TFT_RED);
tft.drawFloat(humidity,2 , 140, 75);
tft.setTextColor(tft.color565(224,225,232));
tft.drawFloat(gas,2 , 140, 135);
tft.setTextColor(TFT_GREEN);
tft.drawString(updataTime , 30, 195);
tft.drawString("%", 210, 75);
tft.drawString("Kohms",210, 135);
}
上傳成功后,打開串口監視器:
接下來我們來看看Python的具體實現
使用Python讀取串口數據并做出相應決策
web端增加了保存數據的功能
因為我需要發送郵件,所以我先將傳感器接收到的數據存儲在一個TXT文本文件中。發送郵件時,我可以直接發送這個文本文件
在視圖中在 py 中:
def index(request):
datas = getDatas()
content = {
'temperature':datas[0],
'pressure':datas[1],
'humidity':datas[2],
'gas':datas[3],
'updataTime':datas[4],
}
jsonData = json.dumps(content)
with open("D:\TemperatureHumidityPressureGasData.txt", "w") as fp:
fp.write(jsonData)
return HttpResponse(jsonData)
主要變化是:
with open("D:\TemperatureHumidityPressureGasData.txt", "w") as fp:
fp.write(jsonData)
文件存放路徑可以修改為自己的路徑
打開文本文件,看能否保存成功:
通過紅外模塊控制小夜燈
小夜燈可以遙控控制:
因為WIO終端沒有紅外解碼功能,所以我又買了一個紅外模塊,編解碼合二為一。當然,我還需要一個usb-ttl串口轉換器:
其實這個想法很簡單。讀取遙控器對應按鍵發送的數據,然后用紅外模塊發送出去
可以使用串口調試助手進行解碼,更方便:
串行端口發送它接收到的任何內容。收貨時最好找個比較暗的地方多試幾次
以下是我收集的每個密鑰應該發送的數據(十六進制):
開燈
send_data = 'FD FD 30 03 53 4B 00 34 17 01 3B 02 65 00 26 00 1E 00 27 00 D9 09 26 00 8A 00 40 02 C3 17 26 00 00 00 21 00 FF FF FF FF 01 22 22 22 22 11 11 11 11 12 11 22 22 21 22 11 13 45 46 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 76 00 22 DF DF'
提亮
send_data = 'FD FD 30 03 52 47 00 34 16 01 3A 02 66 00 27 00 20 00 27 00 D9 09 25 00 8A 00 41 02 00 00 21 00 FF FF FF FF FF FF FF FF 01 22 22 22 22 11 11 11 12 21 11 22 21 12 22 11 13 45 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 76 3F 6D DF DF '
調光
send_data = 'FD FD 30 03 53 4B 00 34 16 01 3C 02 63 00 27 00 1F 00 27 00 DA 09 25 00 8B 00 3D 02 C4 17 24 00 00 00 20 00 FF FF FF FF 01 22 22 22 22 11 11 11 12 11 11 22 21 22 22 11 13 45 46 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 76 3F 2E DF DF '
要發送紅外線,只需再添加兩行:
send_data = bytes.fromhex(send_data) #先編碼,再發送
infrared_ser.write(send_data)
通過語音控制PC發送郵件
語音不是真正的語音識別。當WIO終端識別到環境音頻信號有波動時,會發送“send message!” 到串口,PC讀取后發送郵件
說話時,音頻信號會有明顯的波動:
發送電子郵件并不難。我把它封裝成一個方法,當時可以直接調用
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
def send():
# 第三方 SMTP 服務
mail_host="smtp.qq.com" #設置服務器
mail_user="" #用戶名
mail_pass="" #口令
sender = ''
receivers = [''] # 接收郵件,可設置為你的QQ郵箱或者其他郵箱
#創建一個帶附件的實例
message = MIMEMultipart()
message['From'] = Header("Wio Terimal", 'utf-8')
message['To'] = Header("溫濕度、大氣壓力、可燃氣體檢測數據", 'utf-8')
subject = '當前溫濕度、大氣壓力、可燃氣體檢測數據'
message['Subject'] = Header(subject, 'utf-8')
#郵件正文內容
message.attach(MIMEText('溫濕度、大氣壓力、可燃氣體檢測數據', 'plain', 'utf-8'))
# 構造附件,傳送當前目錄下的 test.txt 文件
att = MIMEText(open('D:\TemperatureHumidityPressureGasData.txt', 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
# 這里的filename可以任意寫,寫什么名字,郵件中顯示什么名字
att["Content-Disposition"] = 'attachment; filename="TemperatureHumidityPressureGasData.txt"'
message.attach(att)
server = smtplib.SMTP_SSL(mail_host, 465) # SMTP協議默認端口是25
server.set_debuglevel(1)
server.login(mail_user, mail_pass)
try:
server.sendmail(sender, receivers, message.as_string())
print ("郵件發送成功")
except smtplib.SMTPException:
print ("Error: 無法發送郵件")
此處的發送者和接收者可以編寫自己的電子郵件。嘗試發送電子郵件進行測試:
預覽此 TXT 文件:
通過語音合成回復用戶
Windows系統下,可以直接調用系統的語音包:
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
text = "輸入要語音合成的內容"
speaker.Speak(text)
完整的程序
代碼中的串口需要改成自己的串口:
Com14是WIO終端開發板
Com15是紅外模塊
Com19是seeeduino v4 2開發板
每次插上后,可能會因為電腦上的USB接口不夠,導致串口發生變化。我買了一個 USB 擴展塢
import serial
import re
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
def send():
# 第三方 SMTP 服務
mail_host="smtp.qq.com" #設置服務器
mail_user="2733821739@qq.com" #用戶名
mail_pass="" #口令
sender = '2733821739@qq.com'
receivers = ['2733821739@qq.com'] # 接收郵件,可設置為你的QQ郵箱或者其他郵箱
#創建一個帶附件的實例
message = MIMEMultipart()
message['From'] = Header("Wio Terimal", 'utf-8')
message['To'] = Header("溫濕度、大氣壓力、可燃氣體檢測數據", 'utf-8')
subject = '當前溫濕度、大氣壓力、可燃氣體檢測數據'
message['Subject'] = Header(subject, 'utf-8')
#郵件正文內容
message.attach(MIMEText('溫濕度、大氣壓力、可燃氣體檢測數據', 'plain', 'utf-8'))
# 構造附件,傳送當前目錄下的 test.txt 文件
att = MIMEText(open('D:\TemperatureHumidityPressureGasData.txt', 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
# 這里的filename可以任意寫,寫什么名字,郵件中顯示什么名字
att["Content-Disposition"] = 'attachment; filename="TemperatureHumidityPressureGasData.txt"'
message.attach(att)
server = smtplib.SMTP_SSL(mail_host, 465) # SMTP協議默認端口是25
server.set_debuglevel(1)
server.login(mail_user, mail_pass)
try:
server.sendmail(sender, receivers, message.as_string())
print ("郵件發送成功")
speaker = win32com.client.Dispatch("SAPI.SpVoice")
text = "Message sent successfully"
speaker.Speak(text)
except smtplib.SMTPException:
print ("Error: 無法發送郵件")
infrared_ser = serial.Serial('COM10', 9600, timeout=0.2)
Wio_terminal = serial.Serial('COM14', 115200, timeout=0.2)
# 接收返回的信息
while True:
strs = Wio_terminal.readline().decode('utf-8')
if strs.strip()!='':
print(strs)
if (re.match(r"C",strs)):
send_data = 'FD FD 30 03 53 4B 00 34 17 01 3B 02 65 00 26 00 1E 00 27 00 D9 09 26 00 8A 00 40 02 C3 17 26 00 00 00 21 00 FF FF FF FF 01 22 22 22 22 11 11 11 11 12 11 22 22 21 22 11 13 45 46 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 76 00 22 DF DF'
send_data = bytes.fromhex(send_data)
infrared_ser.write(send_data)
text = "OK executed"
speaker.Speak(text)
elif (re.match(r"B",strs)):
send_data = 'FD FD 30 03 52 47 00 34 16 01 3A 02 66 00 27 00 20 00 27 00 D9 09 25 00 8A 00 41 02 00 00 21 00 FF FF FF FF FF FF FF FF 01 22 22 22 22 11 11 11 12 21 11 22 21 12 22 11 13 45 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 76 3F 6D DF DF '
send_data = bytes.fromhex(send_data)
infrared_ser.write(send_data)
text = "Brightness up"
speaker.Speak(text)
elif (re.match(r"A",strs)):
send_data = 'FD FD 30 03 53 4B 00 34 16 01 3C 02 63 00 27 00 1F 00 27 00 DA 09 25 00 8B 00 3D 02 C4 17 24 00 00 00 20 00 FF FF FF FF 01 22 22 22 22 11 11 11 12 11 11 22 21 22 22 11 13 45 46 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 76 3F 2E DF DF '
send_data = bytes.fromhex(send_data)
infrared_ser.write(send_data)
text = "Brightness down"
speaker.Speak(text)
elif (re.match(r"send",strs)):
try:
send()
except:
text = "Failed to send mail. Please try again later"
speaker.Speak(text)
infrared_ser.close()
Wio_terminal.close()
未來的想法
目前的系統只是一個非常簡單的第一代版本。往后我們可能會考慮使用云平臺存儲傳感器采集的溫度、濕度、光照強度、紫外線強度等數據,制作一個APP,讓用戶出門在外就可以知道家里的情況。
-
智能家居
+關注
關注
1926文章
9513瀏覽量
184306 -
python
+關注
關注
56文章
4782瀏覽量
84453
發布評論請先 登錄
相關推薦
評論