After constantly stepping on the pit (learning), the initial generation of simple smart home central control system has been completed, and the functions filled in when applying for the project have been completed, but some functions are not realized by WIO terminal (on the one hand, because the amount of code is too large, it will put a lot of "pressure" on WIO terminal; on the other hand, my technology is not enough, so I have to continue to learn and find solutions).
First of all, let me introduce my initial idea:
WIO terminal is a highly integrated development board. It comes with a liquid crystal display, three buttons, a five way switch, microphone, speaker, acceleration sensor, infrared transmitter, etc. it can even be combined with raspberry pie and Jetson nano. As the "brain" of a home, these hardware are very practical. Therefore, in the central control system of smart home, I choose WIO terminal as the core of this system.
In the future, there should be an intelligent housekeeper at home. This intelligent housekeeper is the simple version I'm making now. With it, you can get accurate and real-time temperature, humidity, light intensity and other data at home. Not only that, it is also like a "universal" remote control, which can help you control the appliances in your home. Of course, it should be like a smart speaker that can understand the instructions we give it and respond to us!
preparation in advanceIn the process of this project, I used the development board WIO terminal for the first time:
Getting started guide for developers who use WIO terminal for the first time
I don't know why. When I use the grow - temperature humidity pressure gas sensor on WIO terminal, I can't receive the data, so I have to turn around to realize it:
Use Django to build a simple data center (based on Grove - temperature humidity pressure gas sensor)
Get back on track and realize the main functions of displaying data:
Use WIO terminal to obtain and display sensor real-time data through HTTP request
The next step is to improve the other three functions, which I mainly implement through python
Improve system functionsEarlier, I briefly mentioned the reasons for some functions that are not implemented on WIO terminal, but I didn't elaborate on the specific reasons. After all, I just started to do it, so I intend to implement the functions first. As for the implementation method, I want to improve it in the second generation system
Output status via WIO terminalThe status I want to express is to read the status of configurable buttons (whether to press the button or not) and the data of microphone (the data can also represent the status)
For WIO terminal, simply outputting these data is relatively simple
Supplement the pin definition in setup():
pinMode(WIO_MIC, INPUT);
pinMode(WIO_KEY_A, INPUT_PULLUP);
pinMode(WIO_KEY_B, INPUT_PULLUP);
pinMode(WIO_KEY_C, INPUT_PULLUP);Supplement the if conditional statement in loop():
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");
 }When WIO terminal is connected to the PC, the PC will read the data of the serial port and take corresponding actions when reading the corresponding output
So far, we've finished all the code about Arduino. Let's sort out the code and share it with you. For the code not mentioned in this article, please check it in the preliminary preparation
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
#include"LIS3DHTR.h"
#include"Free_Fonts.h"
#include"TFT_eSPI.h"
TFT_eSPI tft;
LIS3DHTR<TwoWire> 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);
}After successful upload, open the serial port monitor:
Next, let's take a look at the specific implementation of Python
Use Python to read serial port data and make corresponding decisions
The function of saving data is added on the web side
Because I need to send mail, I first store the data received by the sensor in a TXT text file. When sending mail, I can directly send this text file
In views In 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)The main changes are:
with open("D:\TemperatureHumidityPressureGasData.txt", "w") as fp:
        fp.write(jsonData) The file storage path can be modified to its own path
Open the text file to see if it can be saved successfully:
Control the small night light through the infrared module
The small night light is bought in a treasure and can be controlled by remote control:
Because WIO terminal has no infrared decoding function, I bought another infrared module, which combines coding and decoding. Of course, I also need a usb-ttl serial port converter:
In fact, the idea is very simple. Read the data sent by the corresponding key on the remote control, and then send it out with the infrared module
Serial port debugging assistant can be used for decoding, which is more convenient:
The serial port sends whatever it receives. When receiving, it's best to find a darker place and try several times
The following is the data I collected that should be sent by each key (hexadecimal):
turn on the light
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'Brighten
 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 'Dimming
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 ' To send infrared, just add two more lines:
send_data = bytes.fromhex(send_data) #先编码,再发送
infrared_ser.write(send_data) Send mail through voice control PC
Voice is not real speech recognition. When WIO terminal recognizes that the ambient audio signal fluctuates, it will send "send message!" to the serial port, The PC will send mail after reading it
When speaking, the audio signal will have obvious fluctuations:
It's not difficult to send e-mail. I encapsulated it into a method, which can be called directly at that time
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: 无法发送邮件")The sender and receiver here can write their own email. Try sending an email to test:
Preview this TXT file:
Reply to users through speech synthesis
Under Windows system, you can directly call the voice package of the system:
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
text = "输入要语音合成的内容"
speaker.Speak(text)Let's take a look at the complete program
Complete program
The serial port in the code needs to be changed to its own serial port:
Com14 is the WIO terminal development board
Com15 is an infrared module
Com19 is seeeduino v4 2 development board
After each plugging, the serial port may change because the USB interface on the computer is not enough. I bought a USB docking station
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()
Later ideas
the current system is only a very simple first generation version. In the later stage, we will consider using the cloud platform to store the temperature, humidity, light intensity, ultraviolet intensity and other data collected by the sensor, and make an app so that users can know the situation at home when they go out.
Zheng Bopei





Comments