Home > Consumer Electronics >Home Appliances Circuit > How to use BME680 to design a smart home control center

How to use BME680 to design a smart home control center

Source: InternetPublisher:狂妄火龙果 Keywords: Smart Home Python Updated: 2024/12/13

    The project has the functions of detecting indoor environment data and sending emails, turning on the light button, and body sensing lighting screen.

    After continuous trial and error, the first generation of simple smart home central control system has been completed, and most of the functions have been completed, but some functions are not implemented in WIO terminal. On the one hand, it is because the amount of code is too large, which will bring great "pressure" to WIO terminal; on the other hand, my technology is not enough, and I have to continue learning and looking for solutions.

    First, let me introduce my initial thoughts:

    WIO Terminal is a highly integrated development board. It is equipped with an LCD display, three buttons, a five-way switch, a microphone, a speaker, an accelerometer, an infrared transmitter, etc. It can even be used in combination with Raspberry Pi and Jetson nano. As the "brain" of the home, these hardware are very practical. Therefore, in the central control system of the smart home, I chose WIO Terminal as the core of this system.

    In the future, there should be a smart housekeeper at home. This smart housekeeper is a simple version of what I am doing now. With it, you can get accurate and real-time data such as temperature, humidity, light intensity, etc. at home. Not only that, it is also like a "universal" remote control that can help you control the electrical appliances in your home. Of course, it should be like a smart speaker, able to understand the instructions we give it and respond to us!


In the process of this project, I used the development board WIO terminal for the first time :

    For some reason, when using the grow-temperature humidity pressure gas sensor on the WIO terminal, no data is received, so I had to turn around and implement:

    Use Django to build a simple data center (based on Grove - temperature, humidity, pressure and gas sensor)

    Get back on track and realize the main functions of data display:

    Use the WIO terminal to obtain and display real-time sensor data through HTTP requests

    The next step is to improve the other three functions, which I mainly implement through Python

Improve system functions
I briefly mentioned the reasons why some functions are not implemented on the WIO terminal before, but I did not elaborate on the specific reasons. After all, it is just the beginning, so I plan to implement the functions first. As for the implementation method, I want to improve it in the second generation system.

The state I want to express through the WIO terminal output state
is to read the state of the configurable button (whether the button is pressed) and the data of the microphone (data can also represent the state)

    For the WIO terminal, it is relatively simple to simply output this data

    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 the WIO terminal is connected to the PC, the PC will read the data from the serial port and take appropriate actions when reading the corresponding output.

    So far, we have completed all the codes about Arduino. Let's organize the codes and share them with you.

    #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(" Starting 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 " + "Connection: close ";
// Serial.println(postRequest);
client.print(postRequest);

while (client.connected()) {
 String line = client.readStringUntil(' ');
 if (line == " ") {
// Serial.println("headers received");
break;
 }
}

while(client.available ())
{
String line = client.readStringUntil(' ');
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 ("
Starting 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 " + "Connection: close ";
// Serial.println(postRequest);
client.print(postRequest);

while (client.connected()) {
 String line = client.readStringUntil(' ');
 if (line == " ") {
// Serial.println("headers received");
break;
 }
}

while(client.available ())
{
String line = client.readStringUntil(' ');
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 uploading successfully, open the serial monitor:

poYBAGKN4qmALf4mAADgyYiXGjg451.png

    Next, let's look at the specific implementation of Python

Use Python to read serial port data and make corresponding decisions

    The web version adds the function of saving data

    Because I need to send an email, I first store the data received by the sensor in a TXT text file. When sending an email, I can directly send this text file

    In the view 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 your own path

    Open the text file to see if it can be saved successfully:

pYYBAGKN4r6AOnsFAAEt5HIlL-k222.png

Control the night light through infrared module

    Night light can be controlled by remote control:

poYBAGKN4sqARfrEAAOws0frMfM193.png

    Because the WIO terminal does not have infrared decoding function, I bought an infrared module, which combines the codec and the encoder in one. Of course, I also need a USB-TTL serial port converter:

pYYBAGKN4tmAbygHAAbiumIPfwc284.png

    In fact, the idea is very simple. Read the data sent by the corresponding button of the remote control, and then send it out using the infrared module

    You can use the serial port debugging assistant for decoding, which is more convenient:

poYBAGKN4uSAJYNHAALDFzPZQF0259.png

    The serial port sends whatever it receives. It is best to try it a few times in a darker place when receiving the goods.

    Here is the data I've gathered each key should send (in hex):

Turn on the lights

    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 light, just add two more lines:

    send_data = bytes.fromhex(send_data) #Encode first, then send
infrared_ser.write(send_data)

Send emails via voice control

    The voice recognition is not real voice recognition. When the WIO terminal recognizes that the ambient audio signal fluctuates, it will send "send message!" to the serial port, and the PC will read it and send an email.

    When speaking, the audio signal will have obvious fluctuations:

pYYBAGKN4vKAMuuEAAFJhWmgS7Y444.png

    Sending an email is not difficult. I encapsulated it into a method and then called it directly.

    import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header

    def send():
 # Third-party SMTP service
 mail_host="smtp.qq.com" #Set up the server
 mail_user="" #Username
 mail_pass="" #Password

    sender = ''
 receivers = [''] # Receive emails, can be set to your QQ mailbox or other mailbox

    #Create an instance with attachments
 message = MIMEMultipart()
 message['From'] = Header("Wio Terimal", 'utf-8')
 message['To'] = Header("Temperature and humidity, atmospheric pressure, combustible gas detection data", 'utf-8')
 subject = 'Current temperature and humidity, atmospheric pressure, combustible gas detection data'
 message['Subject'] = Header(subject, 'utf-8')

    #Mail body content
 message.attach(MIMEText('temperature and humidity, atmospheric pressure, combustible gas detection data', 'plain', 'utf-8'))

    # Construct an attachment and send the test.txt file in the current directory
 att = MIMEText(open('D:TemperatureHumidityPressureGasData.txt', 'rb').read(), 'base64', 'utf-8')
 att["Content-Type"] = 'application/octet-stream'
 # The filename here can be anything you want. Whatever name you write will be displayed in the email
 att["Content-Disposition"] = 'attachment; filename="TemperatureHumidityPressureGasData.txt"'
 message.attach(att)
 server = smtplib.SMTP_SSL(mail_host, 465) # The default port for SMTP protocol is 25
 server.set_debuglevel(1)
 server.login(mail_user, mail_pass)

    try:
server.sendmail(sender, receivers, message.as_string())
print ("Mail sent successfully")
 except smtplib.SMTPException:
print ("Error: Unable to send mail")

    Here senders and receivers can write their own emails. Try sending an email to test it:

poYBAGKN4wGAOn_eAAIfd-d6XbI887.png

    Preview this TXT file:

pYYBAGKN4w-ABPzXAAGDqeQjwBc677.png

Respond to the user via speech synthesis

    Under Windows system, you can directly call the system voice package:

    import win32com.client

    speaker = win32com.client.Dispatch("SAPI.SpVoice")
text = "Enter the content to be synthesized"
speaker.Speak(text)

Complete Program

    The serial port in the code needs to be changed to your own serial port:

pYYBAGKN4xuAd5X-AAGpKmRzoXk318.png

    Com14 is a WIO terminal development board

    Com15 is an infrared module

    Com19 is the seeeduino v4 2 development board

    Each time you plug it in, the serial port may change because the USB port on the computer is not enough. I bought a USB expansion dock

    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():
 # Third-party SMTP service
 mail_host="smtp.qq.com" #Set up the server
 mail_user="2733821739@qq.com" #Username
 mail_pass="" #Password

    sender = '2733821739@qq.com'
 receivers = ['2733821739@qq.com'] # Receive emails, can be set to your QQ mailbox or other mailbox

    #Create an instance with attachments
 message = MIMEMultipart()
 message['From'] = Header("Wio Terimal", 'utf-8')
 message['To'] = Header("Temperature and humidity, atmospheric pressure, combustible gas detection data", 'utf-8')
 subject = 'Current temperature and humidity, atmospheric pressure, combustible gas detection data'
 message['Subject'] = Header(subject, 'utf-8')

    #Mail body content
 message.attach(MIMEText('temperature and humidity, atmospheric pressure, combustible gas detection data', 'plain', 'utf-8'))

    # Construct an attachment and send the test.txt file in the current directory
 att = MIMEText(open('D:TemperatureHumidityPressureGasData.txt', 'rb').read(), 'base64', 'utf-8')
 att["Content-Type"] = 'application/octet-stream'
 # The filename here can be anything you want. Whatever name you write will be displayed in the email
 att["Content-Disposition"] = 'attachment; filename="TemperatureHumidityPressureGasData.txt"'
 message.attach(att)
 server = smtplib.SMTP_SSL(mail_host, 465) # The default port for SMTP protocol is 25
 server.set_debuglevel(1)
 server.login(mail_user, mail_pass)

    try:
server.sendmail(sender, receivers, message.as_string())
print ("Mail sent successfully")
speaker = win32com.client.Dispatch("SAPI.SpVoice")
text = "Message sent successfully"
speaker.Speak(text)
 except smtplib.SMTPException:
print ("Error: Unable to send mail")


infrared_ser = serial.Serial('COM10', 9600, timeout=0.2)
Wio_terminal = serial.Serial('COM14', 115200, timeout=0.2)

 00 00 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00  FF     FF
FF  FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 FF FF FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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()

Future Thoughts

    The current system is just a very simple first-generation version. In the future, we may consider using the cloud platform to store data such as temperature, humidity, light intensity, and ultraviolet intensity collected by sensors, and create an APP so that users can know the situation at home when they are away from home.

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号