黄土马家

[Tuya Smart] Indoor environment monitor

 
Overview

Indoor environment controller, this work can detect indoor temperature and humidity, light intensity, smoke concentration (or combustible gas) and make corresponding controls based on these values, such as constant temperature and humidity control, constant light control, and smoke alarm. And can be connected to the cloud through the Tuya networking module to achieve remote control. For example, the environment of an electric vehicle can be monitored when it is being charged, and an alarm can be issued for combustion caused by charging. At the same time, the temperature and humidity can be controlled within a reasonable range to increase the life of the battery.

This project uses STM32F103C8T6 as the main control, Tuya wb3s as the networking module, SHT30 is the temperature and humidity sensor, OPT3001 is the light sensor, and MQ2 is the smoke sensor. SHT30 and OPT3001 are IIC communications, and MQ2 is the analog signal; used in this project An OLED and three buttons serve as the human-computer interaction interface, and an EEPROM is used to record alarm content and set some information.

Update: Added an interface for external smoke sensor, the signal is 0-20mA signal. Reason for change: Since the installation location of the smoke sensor was not considered at the beginning of the design, the smoke sensor was centralized on the board. After thinking about it, I decided not to change the original design of the board, but added an external sensor signal interface, and used the onboard sensor as a verification module, which can be closed or opened through a jumper cap.

Demo video

 

 

Design ideas

The design block diagram is as follows

In this work, FreeRTOS is used as the operating system to adjust various tasks, as shown in the figure. All tasks are roughly divided into several tasks in the figure.

Instructions

Interface display

client interface

Introduction to use

In this work, the homepage displays the real-time data of each sensor, network connection status, and current time. Use three buttons for human-computer interaction. The left button is always the confirmation button, the middle button is the select or delete button, and the right button is the exit button. Relevant function tips will be displayed at the bottom of the screen.

Among all interfaces, only the control setting interface has the function of inputting settings, and the rest are viewing functions. Related settings can be performed on the mobile phone. The function of the control terminal can control the opening and closing of IO points, as well as the control mode "AUTO" automatic or "OPER" manual. The principle of automatic control is the simplest two-position control principle.

 

Code https://github.com/xiaoengineer/IEMCS.git

 

There is a small problem: the buzzer is passive, so it must be driven by a signal of a certain frequency. However, I did not expect that the timer pin of stm32f103c8t6 conflicts with I2C, so I can only use the IO port to simulate reverse driving of the buzzer. Therefore, it is recommended to switch to an active buzzer.

 

During the demonstration, an external sensor interface was used. Since it was a voltage signal, the 150 ohm resistor was removed.

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-22 12:43:50

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号