0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

如何利用BME680实现智能家居控制中心的设计

科技观察员 来源:Wan Niu 作者:Wan Niu 2022-05-25 16:08 次阅读

该项目具有检测室内环境数据和发送电子邮件、开灯按钮、体感照明屏等功能。

经过不断的踩坑学习,初代简易智能家居中控系统已经完成,大部分功能已经完成,但是有些功能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);
}
上传成功后,打开串口监视器:

poYBAGKN4qmALf4mAADgyYiXGjg451.png

接下来我们来看看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)

文件存放路径可以修改为自己的路径

打开文本文件,看能否保存成功:

pYYBAGKN4r6AOnsFAAEt5HIlL-k222.png

通过红外模块控制小夜灯

小夜灯可以遥控控制:

poYBAGKN4sqARfrEAAOws0frMfM193.png

因为WIO终端没有红外解码功能,所以我又买了一个红外模块,编解码合二为一。当然,我还需要一个usb-ttl串口转换器

pYYBAGKN4tmAbygHAAbiumIPfwc284.png

其实这个想法很简单。读取遥控器对应按键发送的数据,然后用红外模块发送出去

可以使用串口调试助手进行解码,更方便:

poYBAGKN4uSAJYNHAALDFzPZQF0259.png

串行端口发送它接收到的任何内容。收货时最好找个比较暗的地方多试几次

以下是我收集的每个密钥应该发送的数据(十六进制):

开灯

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读取后发送邮件

说话时,音频信号会有明显的波动:

pYYBAGKN4vKAMuuEAAFJhWmgS7Y444.png

发送电子邮件并不难。我把它封装成一个方法,当时可以直接调用

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: 无法发送邮件")

此处的发送者和接收者可以编写自己的电子邮件。尝试发送电子邮件进行测试:

poYBAGKN4wGAOn_eAAIfd-d6XbI887.png

预览此 TXT 文件:

pYYBAGKN4w-ABPzXAAGDqeQjwBc677.png

通过语音合成回复用户

Windows系统下,可以直接调用系统的语音包:

import win32com.client

speaker = win32com.client.Dispatch("SAPI.SpVoice")
text = "输入要语音合成的内容"
speaker.Speak(text)

完整的程序

代码中的串口需要改成自己的串口:

pYYBAGKN4xuAd5X-AAGpKmRzoXk318.png

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

    文章

    9469

    浏览量

    183785
  • python
    +关注

    关注

    55

    文章

    4766

    浏览量

    84367
收藏 人收藏

    评论

    相关推荐

    BME680环境传感器的驱动设计与实现

    环境传感器是一类我们很常用的传感器。它可以方便我们获取压力、温度、湿度以及空气质量等数据。在这一篇中,我们将分析BME680环境传感器的功能,并设计和实现BME680环境传感器的驱动。
    发表于 12-08 15:41 2241次阅读
    <b class='flag-5'>BME680</b>环境传感器的驱动设计与<b class='flag-5'>实现</b>

    【开源】基于stm32的智能家居控制中心

    ` 本帖最后由 shaw.wang 于 2015-5-8 10:16 编辑 基于stm32和W5500的智能家居控制中心 HIKIT SC1是一款极具性价比的开发板,同时又是具备可扩展性
    发表于 05-07 16:22

    【EVB-335X-II申请】智能家居控制中心

    申请理由:本人从业于智能家居嵌入式开发,一直以来使用TI的产品开发BLE/ZIGBEE/WIFI等。之前智能控制中心方案是MSP430+ZIGBEE+BLUETOOTH+WIFI+LCD,但
    发表于 10-21 09:21

    BME680的参数资料

    产品技术参数资料Datasheet法例与合规 符合 符合声明产品详细信息BME680 是集成环境传感器,专门开发用于尺寸和低功耗为关键要求的移动应用和可穿戴产品。BME680 扩大 Bosch
    发表于 04-23 11:20

    如何利用stm32的HAL库实现BME680传感器输出IAQ?

    如何利用stm32的HAL库实现BME680传感器输出IAQ?为什么使用IAR而不使用stm32开发常用的keil呢?
    发表于 10-22 09:15

    为LED的Do Electronics GT倡议而打造的BME680模块

    描述这是为 LED 的 Do Electronics GT 倡议而打造的 BME680 模块,让危地马拉的年轻人唤醒了开发低成本电子设备的兴趣。代码https://github.com/teslalab/BME680
    发表于 07-28 06:33

    什么才能算是智能家居真正的控制中心

    德州仪器个人电子产品系统终端设备负责人随着智能家居的普及,现在我们有越来越多的房间都安装了配备有人工智能功能的智能音箱,它们的功能也基本上大同小异。但什么才能算是智能家居真正的
    发表于 11-09 07:14

    使用iic与bme680通信,Bme680数据读取不到是为什么

    使用iic与bme680通信,芯片的CHIP—ID都已经能够读取到了,但是读取不到温湿度和压力的数据?
    发表于 08-04 16:51

    STM32移植BME680传感器输出IAQ(室内空气质量)

    STM32移植BME680传感器输出IAQ(室内空气质量)
    发表于 11-21 18:06 24次下载
    STM32移植<b class='flag-5'>BME680</b>传感器输出IAQ(室内空气质量)

    基于BME680和Raspberry Pi Pico的气象站

    电子发烧友网站提供《基于BME680和Raspberry Pi Pico的气象站.zip》资料免费下载
    发表于 07-18 15:12 1次下载
    基于<b class='flag-5'>BME680</b>和Raspberry Pi Pico的气象站

    BME680天气监测装置开源分享

    电子发烧友网站提供《BME680天气监测装置开源分享.zip》资料免费下载
    发表于 07-21 11:59 4次下载
    <b class='flag-5'>BME680</b>天气监测装置开源分享

    Arduino BME680气体和THS空气质量监测器

    电子发烧友网站提供《Arduino BME680气体和THS空气质量监测器.zip》资料免费下载
    发表于 12-20 10:01 0次下载
    Arduino <b class='flag-5'>BME680</b>气体和THS空气质量监测器

    基于BME680的室内空气质量计

    在本方案中,我们将介绍如何在房间内制作一个非常简单的空气质量计。为此,我们使用包含 Bosch Sensortec 的 BME680 芯片的 GY-MCU680V1 传感器。BME680 是一种
    发表于 12-21 12:20 0次下载

    基于BME680的天气监测装置

    方案介绍天气监测装置BME680BME680 是第一款集成高线性度和高精度气体、压力、湿度和温度传感器的气体传感器。它专为移动应用和可穿戴设备而开发,其中尺寸和低功耗是关键要求。BME680 保证
    发表于 12-26 16:06 0次下载

    基于BME680的天气监测装置

    方案介绍BME680BME680 是第一款集成高线性度和高精度气体、压力、湿度和温度传感器的气体传感器。它专为移动应用和可穿戴设备而开发,其中尺寸和低功耗是关键要求。BME680 保证 - 根据特定
    发表于 12-27 16:41 0次下载