CN110147058B - A kind of single chip timing chip borrowing WiFi module - Google Patents
A kind of single chip timing chip borrowing WiFi module Download PDFInfo
- Publication number
- CN110147058B CN110147058B CN201910410187.5A CN201910410187A CN110147058B CN 110147058 B CN110147058 B CN 110147058B CN 201910410187 A CN201910410187 A CN 201910410187A CN 110147058 B CN110147058 B CN 110147058B
- Authority
- CN
- China
- Prior art keywords
- chip
- wifi
- timing
- module
- computer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000012790 confirmation Methods 0.000 claims abstract description 6
- 230000006870 function Effects 0.000 claims description 37
- 238000000034 method Methods 0.000 claims description 13
- 238000004891 communication Methods 0.000 claims description 10
- 102100030393 G-patch domain and KOW motifs-containing protein Human genes 0.000 claims description 9
- 238000000889 atomisation Methods 0.000 claims description 9
- 238000001514 detection method Methods 0.000 claims description 9
- 238000005516 engineering process Methods 0.000 claims description 5
- 230000000694 effects Effects 0.000 claims description 4
- 238000012360 testing method Methods 0.000 claims description 4
- WHXSMMKQMYFTQS-UHFFFAOYSA-N Lithium Chemical compound [Li] WHXSMMKQMYFTQS-UHFFFAOYSA-N 0.000 claims description 3
- 229910052744 lithium Inorganic materials 0.000 claims description 3
- 230000000630 rising effect Effects 0.000 claims description 3
- 230000001360 synchronised effect Effects 0.000 claims description 2
- 239000003990 capacitor Substances 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 230000018109 developmental process Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 241000209094 Oryza Species 0.000 description 2
- 235000007164 Oryza sativa Nutrition 0.000 description 2
- 239000011324 bead Substances 0.000 description 2
- 238000010438 heat treatment Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000004321 preservation Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000002441 reversible effect Effects 0.000 description 2
- 235000009566 rice Nutrition 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000010411 cooking Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000021186 dishes Nutrition 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 230000035784 germination Effects 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000006698 induction Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000035515 penetration Effects 0.000 description 1
- 230000007226 seed germination Effects 0.000 description 1
- 235000013547 stew Nutrition 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/042—Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
- G05B19/0423—Input/output
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G08—SIGNALLING
- G08C—TRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
- G08C17/00—Arrangements for transmitting signals characterised by the use of a wireless electrical link
- G08C17/02—Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Automation & Control Theory (AREA)
- General Engineering & Computer Science (AREA)
- Stored Programmes (AREA)
- Telephone Function (AREA)
Abstract
本发明公开了一种借WiFi模块的单片机定时芯片,将单片机定时控制增加通过I2C两线接口同ESP‑12 WiFi模块连接,ESP‑12 WiFi模块能无线连接手机或电脑实现方便直观的多种定时设置。这种WiFi模块可设计成通用模块(一个就可设置多种单片机定时),仅在设置或定时检查确认时连一下,平时不用。这种单片机定时不需要时钟设置部件(免去了显示屏、按键组),使结构简洁、成本降低。并强调公开脚本程序相关技术资料,使这种单片机定时芯片成为一种通用芯片,用户可自已改编设置界面。
The invention discloses a single-chip timing chip borrowed from a WiFi module. The single-chip timing control is added to connect with an ESP-12 WiFi module through an I2C two-wire interface. The ESP-12 WiFi module can be wirelessly connected to a mobile phone or a computer to realize convenient and intuitive multiple timings set up. This kind of WiFi module can be designed as a general module (one can set a variety of microcontroller timings), and only connect it when setting or timing check and confirmation, usually not used. This single-chip timing does not require a clock setting component (a display screen and a key group are omitted), which makes the structure simple and the cost reduced. It also emphasizes the disclosure of relevant technical information of script programs, so that this single-chip timing chip becomes a general-purpose chip, and users can adapt the setting interface by themselves.
Description
技术领域technical field
本发明涉及电器自动控制技术领域,尤其涉及一种借WiFi模块的单片机定时芯片。The invention relates to the technical field of automatic control of electrical appliances, in particular to a single chip timing chip using a WiFi module.
背景技术Background technique
虽然物联网有被商业夸大的显现,但它促成了网络技术向简洁精细化发展,也惠及到了非互联网领域,本发明就尝试将互联网技术用于直接连接“微型服务器ESP-12”。对于微控制电器、典型的单片机应用,为实现更方便直观的设置(常规的时间设置操作,因显示屏简单、按键功能重叠,缺少数字时间格式等编辑键盘,很容易忘记)或人机交互,将单片机应用再加上WiFi连接手机或电脑,从而去掉成本高、占体积的显示屏、按键组,使外壳变小、设计简化。这种理想化的方案本来很不切实际,因为WiFi连手机或电脑的技术难度远超单片机典型应用的技术含量,然而这种情况随着ESP-12WiFi单片机(ESP8266)模块的普及已不存在了,一种新的单片机+WiFi应用模式已经来到,本发明抛砖引玉,从典型的定时类应用作为开始。Although the Internet of Things has been exaggerated by business, it has contributed to the development of network technology towards simplicity and refinement, and has also benefited non-Internet fields. For micro-controlled electrical appliances and typical single-chip applications, in order to achieve more convenient and intuitive settings (regular time setting operation, it is easy to forget due to the simple display screen, overlapping key functions, and lack of editing keyboards such as digital time formats) or human-computer interaction, The application of the single-chip microcomputer is coupled with WiFi to connect the mobile phone or computer, so as to remove the high-cost and bulky display screen and key group, so that the casing becomes smaller and the design is simplified. This idealized solution is very impractical, because the technical difficulty of connecting a mobile phone or a computer with WiFi far exceeds the technical content of a typical application of a microcontroller. However, this situation no longer exists with the popularization of the ESP-12 WiFi microcontroller (ESP8266) module. , a new single-chip + WiFi application mode has come, and the present invention will start with a typical timing application.
发明内容SUMMARY OF THE INVENTION
基于上述背景技术,本发明提供一种借WiFi模块的单片机定时芯片。Based on the above background technology, the present invention provides a single chip timing chip using a WiFi module.
本发明所采用的技术方案如下:一种借WiFi模块的单片机定时芯片,所述单片机定时芯片在使用前先通过配套的WiFi连接模块,借助手机或电脑对其进行定时控制功能设置;The technical scheme adopted by the present invention is as follows: a single-chip timing chip borrowed from a WiFi module, the single-chip timing chip is used to set the timing control function by means of a mobile phone or a computer through a matching WiFi connection module before use;
所述单片机定时芯片是单片机编程实现的定时控制芯片,有I2C(slave)两线串行总线接口,用于连接配套的WiFi连接模块,实现用手机或电脑进行定时功能设置、定时检查确认、调出查看或修改重设;The single-chip timing chip is a timing control chip programmed by a single-chip computer. It has an I2C (slave) two-wire serial bus interface, which is used to connect the matching WiFi connection module, and realize the timing function setting, timing check confirmation, adjustment with a mobile phone or computer. to view or modify the reset;
所述配套的WiFi连接模块是ESP-12WiFi模块,该模块被编程定义了带I2C(master)两线串行总线接口,用于连接所述单片机定时芯片的I2C(slave)接口;The matching WiFi connection module is an ESP-12 WiFi module, which is programmed to define a two-wire serial bus interface with I2C (master) for connecting to the I2C (slave) interface of the single-chip timing chip;
单片机中数据主动传手机或电脑采用(I2C)SCL上沿中断通知ESP-12及HTML5+JS的SSE服务器推送技术;The data in the microcontroller is actively transmitted to the mobile phone or computer using (I2C) SCL upper edge interrupt notification ESP-12 and HTML5+JS SSE server push technology;
在不同时间,一个WiFi连接模块可分别同多个多种所述单片机定时芯片相连,仅在需要改变设定的定时功能或定时检查确认时连接一下,平时单片机定时芯片工作时不用WiFi连接模块;At different times, a WiFi connection module can be connected with a plurality of the single-chip timing chips, and only connect it when the set timing function needs to be changed or the timing check is confirmed. Usually, the single-chip timing chip does not need the WiFi connection module when working;
所述单片机定时芯片脱离WiFi连接模块自已工作时,只要一个启动按键、一个或多个工作状态指示LED;启动按键操作包括短按(短于0.5秒)、长按(超过0.5秒)、或逐次短按结合看工作状态指示LED,实现多功能选择启动;单片机定时芯片的诸IO口分别同启动按键、工作状态指示LED连接;When the single-chip timing chip works independently of the WiFi connection module, only one start button and one or more working status indication LEDs are required; the start button operation includes short press (less than 0.5 seconds), long press (more than 0.5 seconds), or successive Short press combined to see the working status indicator LED to realize multi-function selection start; the IO ports of the single chip timing chip are respectively connected with the start button and the working status indicator LED;
所述单片机定时芯片具有1K以上的flash EEPROM,用来保存所设置的起停时间、循环周期、起点时间、遥控红外码记录,断电不丢失;不用内置时钟保持电池,定时启动前只要连下手机或电脑,其上的时间就会同步到单片机定时芯片,或在设定的时间启动作为时间起点,更多的应用无需实时时钟,只要启动后的延时即可;The single-chip timing chip has a flash EEPROM of more than 1K, which is used to save the set start-stop time, cycle period, starting point time, and remote control infrared code record, which will not be lost when power off; Mobile phone or computer, the time on it will be synchronized to the MCU timing chip, or start at the set time as the starting point of time, more applications do not need a real-time clock, as long as the delay after startup;
ESP-12WiFi模块采用NODEMCU固件及LUA脚本语言编程,开源公布,提供包括HTML5+JS的SSE程序范例及I2C(master)两线串行总线接口以SCL上沿中断方式触发启动读发来的字节的程序范例,为让用户自己用脚本语言改写更适用的操作界面(HTML5);ESP-12WiFi module is programmed with NODEMCU firmware and LUA scripting language. It is open source and published. It provides SSE program examples including HTML5+JS and I2C (master) two-wire serial bus interface to trigger and start reading the bytes sent by SCL up-edge interrupt. The program example, in order to allow users to rewrite the more suitable operation interface (HTML5) with scripting language;
手机或电脑WiFi连接ESP-12模块采用WiFi直连(AP/STATION)模式,ESP-12WiFi模块包括HTTP服务,手机或电脑不用下载安装APP,只要浏览器访问196.168.4.1或196.168.x.x即可,其中196.168.x.x由无线路由器DHCP内定或指定;不涉及第三方网络服务,也不需要通外网连接;Mobile phone or computer WiFi connection ESP-12 module adopts WiFi direct connection (AP/STATION) mode, ESP-12 WiFi module includes HTTP service, mobile phone or computer does not need to download and install APP, as long as the browser accesses 196.168.4.1 or 196.168.x.x, Among them, 196.168.x.x is defaulted or designated by the wireless router DHCP; it does not involve third-party network services, and does not require an external network connection;
手机或电脑WiFi连接ESP-12模块方法如下:The method to connect the ESP-12 module with the WiFi of the mobile phone or computer is as follows:
在单片机定时芯片工作启动前,先用手机或电脑进行时间或定时功能设置,因此要连上配套的WiFi连接模块;若首次连接,手机或电脑在无线网络设置中找ESP-12、无密码或12345678,进行WIFI连接,连接成功后,打开浏览器访问196.168.4.1,进入操作界面后就可进行时间或定时功能设置;接着,将当地的无线路由器WIFI连接名、密码置入配套的WiFi连接模块中,使每次连上配套的WiFi连接模块后其自动会连接当地的WIFI;设置成功后记下所用的(DHCP)IP地址(196.168.x.x),此后手机或电脑无需再进无线网络设置中找ESP-12连接,仍连原来的当地WIFI即可,当手机或电脑再要联机设置时,只要用浏览器访问记下所用的(DHCP)IP地址196.168.x.x即可;Before the start of the MCU timing chip, first use the mobile phone or computer to set the time or timing function, so it is necessary to connect the matching WiFi connection module; 12345678, make a WIFI connection, after the connection is successful, open the browser to access 196.168.4.1, after entering the operation interface, you can set the time or timing function; then, put the local wireless router WIFI connection name and password into the matching WiFi connection module , so that it will automatically connect to the local WIFI every time it is connected to the matching WiFi connection module; after the setting is successful, write down the (DHCP) IP address (196.168.x.x) used. ESP-12 connection, still connected to the original local WIFI, when the mobile phone or computer needs to be set online again, just use the browser to access and write down the (DHCP) IP address 196.168.x.x used;
手机或电脑进入设置界面,有动态操作提示,包括直接测试效果或设置确认;设置满意后,撤掉WiFi连接模块,以后使用时的启停工作只要按单片机所连的启动按键、观察LED工作状态指示即可;When the mobile phone or computer enters the setting interface, there will be dynamic operation prompts, including direct test effect or setting confirmation; after the setting is satisfactory, remove the WiFi connection module, and the start and stop work in future use only needs to press the start button connected to the microcontroller and observe the LED working status. instructions;
手机或电脑设置时间或定时有HTML5标准时间控件出现,只要选:月、日、时、分、周中某数字、或直接输入数字。When the mobile phone or computer sets the time or timing, the HTML5 standard time control will appear, just select: month, day, hour, minute, a number in the week, or directly input the number.
进一步的,定时设置包括以下典型格式:Further, timing settings include the following typical formats:
[[日期][时间]]功能1:时长1[功能2:时长2][功能3:时长3]…[停时长]…[[date][time]]function1:duration1[function2:duration2][function3:duration3]…[stop duration]…
或or
[日期]开时间1-关时间1[功能/参数1][date] on time 1 - off time 1 [function/parameter 1]
[日期]开时间2-关时间2[功能/参数2][Date] On Time 2 - Off Time 2 [Function/Parameter 2]
……
[]表示可缺省,以常用值默认;功能/参数可包括多个数值。[] indicates that it can be defaulted, and defaults to common values; functions/parameters can include multiple values.
进一步的,所述配套的WiFi连接模块的I2C(master)两线串行总线接口包括设计成带四芯插口的插拔部件,并规定四芯插口的排列为:+、SCL、SDA、-;另外还包括通过ESP-12的RS串行口增设编程ESP-12所用的与电脑联机的USB连线接口;Further, the I2C (master) two-wire serial bus interface of the matching WiFi connection module includes a plug-in component designed with a four-core socket, and the arrangement of the four-core socket is specified as: +, SCL, SDA, -; In addition, it also includes an additional USB connection interface for programming the ESP-12 through the RS serial port of the ESP-12;
针对微小电流单片机控制,其5V以下的供电驱不动ESP-12WiFi模块,此种WiFi连接模块包括3.7V锂电池供电,及充电口或电源插头;For micro-current microcontroller control, the power supply below 5V cannot drive the ESP-12 WiFi module. This WiFi connection module includes a 3.7V lithium battery power supply, and a charging port or power plug;
考虑到用户会不即时拔掉WiFi连接模块,WiFi连接模块还包括无操作延时进入极低功耗模式、或用手机或电脑设置WiFi连接模块中的ESP-12进入极低功耗模式,唤醒通过ESP-12上的RST按键或拔出再插上。Considering that the user will not unplug the WiFi connection module immediately, the WiFi connection module also includes no operation delay to enter the ultra-low power consumption mode, or use a mobile phone or computer to set the ESP-12 in the WiFi connection module to enter the ultra-low power consumption mode, wake up Either via the RST button on the ESP-12 or unplug and plug again.
进一步的,所述单片机采用STC15系列单片机,包括8脚封装的,其中两个脚P3.3(SDA)、P3.4(SCL)作I2C从机通讯ESP-12WiFi连接模块,P3.0、P3.1两个脚除留着编程时连接电脑外,平时P3.0作定时器上的启动按键、P3.1作定时器上的工作状态指示LED,P3.2、P3.5控制输出,或P3.2红外发码学习记录。Further, the single-chip microcomputer adopts STC15 series single-chip microcomputer, including 8-pin package, of which two pins P3.3 (SDA), P3.4 (SCL) are used as I2C slave communication ESP-12 WiFi connection module, P3.0, P3 .1 Except for connecting the two pins to the computer during programming, P3.0 is usually used as the start button on the timer, P3.1 is used as the working status indicator LED on the timer, and P3.2 and P3.5 control the output, or P3.2 Infrared code sending learning record.
进一步的,所述单片机定时芯片若用做定时超声微孔雾化加湿装置,相关的超声微孔雾化片的驱动、湿度检测、及低压直流风扇的驱动,用STC15W104类8脚单片机实现的连接方式如下:单片机输出110KHz的PWM矩形波的口P3.1串限流电阻R1接MOS管Mos1栅极G,MOS管Mos1源极S接地,MOS管Mos1漏极D接高频升压变压器B初级一端,B初级另一端接+12V,高频升压变压器B次级两端同超声微孔雾化片W两端并联;Further, if the single-chip timing chip is used as a timing ultrasonic microporous atomization humidification device, the drive of the related ultrasonic microporous atomization sheet, the humidity detection, and the drive of the low-voltage DC fan, the connection is realized by the STC15W104 class 8-pin single-chip microcomputer. The method is as follows: the port P3.1 of the single-chip microcomputer outputting a PWM rectangular wave of 110KHz is connected to the gate G of the MOS transistor Mos1, the source S of the MOS transistor Mos1 is grounded, and the drain D of the MOS transistor Mos1 is connected to the primary end of the high-frequency step-up transformer B. The other end of the primary B is connected to +12V, and the secondary ends of the high-frequency step-up transformer B are connected in parallel with the two ends of the ultrasonic microporous atomizer W;
湿度检测采用DHT11一总线接口数字湿度传感器,单片机端口P3.2接DHT11仅有的一根数据线,DHT11的另两根引脚一根接地、一根接单片机电源(3.3V)+端;Humidity detection adopts DHT11 bus interface digital humidity sensor, the single-chip microcomputer port P3.2 is connected to the only data line of DHT11, the other two pins of DHT11 are grounded, and the other is connected to the single-chip power supply (3.3V) + terminal;
单片机输出口P3.0串限流电阻R2接MOS管Mos2栅极G,MOS管Mos2源极S接地,MOS管Mos2漏极D接直流风扇F负极,直流风扇F正极接+12V;MCU output port P3.0 series current limiting resistor R2 is connected to the gate G of the MOS tube Mos2, the source S of the MOS tube Mos2 is grounded, the drain D of the MOS tube Mos2 is connected to the negative electrode of the DC fan F, and the positive electrode of the DC fan F is connected to +12V;
单片机定时芯片若用做定时红外遥控器及学习型编码记录,用STC15W104类8脚单片机实现的连接方式如下:单片机输出口P3.5串限流电阻接红外发射LED负端,红外发射LED正端接单片机电源+端;红外接收头(HS0038)输出端接单片机端口P3.2,红外接收头的另两根引脚一根接地、一根接单片机电源(3.3V)+端。If the MCU timing chip is used as a timing infrared remote control and a learning-type coding record, the connection method realized by the STC15W104 type 8-pin MCU is as follows: the output port of the MCU P3.5 series current limiting resistor is connected to the negative end of the infrared emission LED, and the positive end of the infrared emission LED Connect to the power supply + terminal of the single-chip microcomputer; the output terminal of the infrared receiver (HS0038) is connected to the port P3.2 of the single-chip microcomputer.
本发明的有益效果是:将典型的单片机定时类应用借助WiFi连接手机或电脑实现多种定时设置,操作方便直观,单片机系统还可去掉成本高、占体积的显示屏、按键组,使外壳变小、设计简化。这种单片机定时芯片因为可借手机或电脑实现多种定时设置,有了通用性,免去了用户单片机编程。并且用户还可用脚本语言自己改写更适用的操作界面(HTML5)。The beneficial effects of the invention are: the typical single-chip timing application is connected to a mobile phone or a computer by means of WiFi to realize various timing settings, the operation is convenient and intuitive, and the single-chip system can also remove the high-cost and bulky display screen and key group, so that the shell becomes Small and simplified design. Because this single chip timing chip can realize various timing settings by using a mobile phone or a computer, it has versatility and eliminates the need for user single chip programming. And the user can also rewrite the more suitable operation interface (HTML5) with the scripting language.
附图说明Description of drawings
图1是ESP-12WiFi连接模块与STC15系列单片机定时芯片的连接图。Figure 1 is the connection diagram of the ESP-12 WiFi connection module and the STC15 series MCU timing chip.
图2是单片机用MOS管实现的定时超声微孔雾化片的驱动、低压直流风扇的驱动、及湿度检测。Fig. 2 is the driving of the timing ultrasonic micro-porous atomizing sheet, the driving of the low-voltage DC fan, and the humidity detection realized by the MOS tube of the single-chip microcomputer.
具体实施方式Detailed ways
将单片机定时控制应用借助WiFi连接手机或电脑实现个性化设置,具体技术路线(图1):ESP-12WiFi模块能实现WiFi连接手机或电脑,单片机通过I2C两线接口同ESP-12WiFi模块双向(字节)通讯。Connect the MCU timing control application to the mobile phone or computer through WiFi to achieve personalized settings. The specific technical route (Figure 1): ESP-12WiFi module can realize WiFi connection to mobile phone or computer. Section) Communications.
STC15系列单片机是性价比极高的国产微控制器MCU,特别是8脚封装的,包括贴片封装,价廉不占空间。对STC15系列8脚单片机,推荐接法为:脚P3.3(SDA)、P3.4(SCL)作I2C从机(slave)通讯ESP-12WiFi模块,P3.0、P3.1两个脚除留着编程时连接电脑外,平时P3.0作微控制定时电器上的启动按钮、P3.1作微控制定时电器上的LED工作状态指示灯,P3.2、P3.5控制输出,或P3.2红外发码学习记录。STC15 series microcontrollers are domestic microcontrollers with extremely high cost performance, especially those in 8-pin packages, including SMD packages, which are inexpensive and do not take up space. For STC15 series 8-pin MCU, the recommended connection method is: pins P3.3 (SDA) and P3.4 (SCL) as I2C slave (slave) communication ESP-12WiFi module, except for the two pins P3.0 and P3.1 Keep it connected to the computer when programming, usually P3.0 is used as the start button on the micro-control timing appliance, P3.1 is used as the LED working status indicator on the micro-control timing appliance, P3.2, P3.5 control the output, or P3 .2 Infrared coding learning record.
选用STC15系列单片机+ESP-12WiFi模块,平时就STC15系列单片机工作,ESP-12WiFi模块只在需要连接手机或电脑时才用到。Select STC15 series MCU + ESP-12WiFi module, usually work on STC15 series MCU, ESP-12WiFi module is only used when it is necessary to connect a mobile phone or computer.
对一些很少设置的用户,ESP-12WiFi模块与单片机连接只要一根四芯连接线即可;对大多数需要个性化设置的,通常将ESP-12WiFi模块单独做成插拔式小插件(简称WiFi插拔模块),它有一个四芯插口:两根I2C通讯、两根正负电源,排列为:+、SCL、SDA、-,现成的四芯插口很多(如USB的)。为编程方便,通过ESP-12的RS串行口增设编程ESP-12所用的与电脑联机的USB连线接口(ESP-12的RS串口,也可包括RS-USB转换)。WiFi插拔模块常同配套的已编程单片机定时芯片一起销售。For some users with few settings, the connection between the ESP-12WiFi module and the microcontroller only needs a four-core cable; for most of the users who need personalized settings, the ESP-12WiFi module is usually made into a plug-in small plug-in (referred to as WiFi plug-in module), it has a four-pin socket: two I2C communication, two positive and negative power supply, arranged as: +, SCL, SDA, -, there are many ready-made four-pin sockets (such as USB). For the convenience of programming, a USB connection interface (the RS serial port of ESP-12, which can also include RS-USB conversion) for programming ESP-12 is added to the computer through the RS serial port of ESP-12. WiFi plug-in modules are often sold together with a matching programmed microcontroller timing chip.
WiFi插拔模块(在不同时间)可以为多个应用通用,其中的ESP-12包括多种定时应用配套设置程序(用哪个由手机屏上菜单选择),所设置的参数,既有直接写入STC单片机EEPROM中的、也有同时保存在所连接过的手机或电脑中的(HTML5本地储存),以便调出查看当时的设置。The WiFi plug-in module (at different times) can be used for multiple applications. The ESP-12 includes a variety of timing application supporting setting programs (which one is selected by the menu on the mobile phone screen). The set parameters can be directly written to In the EEPROM of the STC microcontroller, there are also those stored in the connected mobile phone or computer (HTML5 local storage), so that the current settings can be recalled.
采用I2C通讯,RS串口留作ESP-12同电脑联机调程序更方便,再则,STC的8脚单片机也没有RS串行口。Using I2C communication, the RS serial port is reserved for the ESP-12 to be connected with the computer to adjust the program more conveniently. Furthermore, the STC's 8-pin single-chip microcomputer does not have an RS serial port.
I2C通讯协议分主(master)-从(slave)机,ESP-12模块提供的是主机I2C,STC单片机正好有引脚可上下沿触发中断,由编程实现从机I2C(slave)很方便。但(不像双工通讯的RS串行口)单片机无法通过从机I2C(slave)主动(随机地)向ESP-12模块发信息,为此要引入一个重要机制,即单片机要向ESP-12模块发信息时,先发中断请求;另一端,在ESP-12模块已定义了I2C的情况下再定义其中的SCL脚具有上沿中断触发功能,一旦(当单片机要向ESP-12模块发信息时先上拉SCL脚)ESP-12模块的SCL脚被上拉中断响应时,立即禁止SCL脚的中断功能,启动主机I2C(master)读过程,单片机端则常处在从机I2C(slave)状态,随时能根据SCL时钟脉冲,配合发送数据SDA串行位。The I2C communication protocol is divided into master (master)-slave (slave) machine. The ESP-12 module provides the host I2C. The STC microcontroller just has pins that can trigger interrupts on the upper and lower edges. It is very convenient to implement the slave I2C (slave) by programming. But (unlike the RS serial port of duplex communication) the microcontroller cannot actively (randomly) send information to the ESP-12 module through the slave I2C (slave). When the module sends information, the interrupt request is sent first; on the other end, in the case that the ESP-12 module has defined I2C, the SCL pin is defined to have the function of upper-edge interrupt triggering. Once (when the microcontroller wants to send a message to the ESP-12 module) When the SCL pin of the ESP-12 module is pulled up and interrupted, the interrupt function of the SCL pin is immediately disabled, and the host I2C (master) read process is started, and the microcontroller side is always in the slave I2C (slave) The state can be sent according to the SCL clock pulse at any time in conjunction with the SDA serial bit of the data.
同样,由于采用HTTP网络通讯协议,ESP-12模块(采用WiFi直连的超微型HTTP服务器)也不能主动(随机)向手机或电脑(的浏览器)发信息,为此采用HTML5+JS的SSE(服务器推送)技术。Similarly, due to the use of HTTP network communication protocol, the ESP-12 module (the ultra-miniature HTTP server using WiFi direct connection) cannot actively (randomly) send information to the mobile phone or computer (the browser). For this reason, HTML5+JS SSE is used. (Server Push) technology.
经过这两种通讯协议实现数据在单片机与手机或电脑间的双向传送,ESP-12模块终于实现了仅四根线的插拔接口同单片机控制系统连接,还包括了ESP-12模块的供电及插拔固定。After these two communication protocols realize the bidirectional transmission of data between the MCU and the mobile phone or computer, the ESP-12 module finally realizes the connection between the pluggable interface of only four wires and the MCU control system, and also includes the power supply and the power supply of the ESP-12 module. Plug and pull fixed.
单片机(定时芯片)系统可简化到仅留一个启动按键及一两个工作状态指示LED。对多功能选择启动,可看状态指示LED逐次短按轮转,或长按。The single-chip (timing chip) system can be simplified to only one start button and one or two working status indication LEDs. For multi-function selection to start, you can see the status indicator LED by short press to rotate, or long press.
关于单片机定时芯片用作超声微孔雾化片的驱动、湿度检测、及低压直流风扇的驱动(这些驱动具有典型性),对STC15W104类8脚单片机也能紧凑地实现:(图2中)微控制器MCU输出108KHz的PWM矩形波的口P3.1串限流电阻R1接MOS管Mos1栅极G,MOS管Mos1源极S接地,MOS管Mos1漏极D接高频升压变压器B初级一端,B初级另一端接+12V,高频升压变压器B次级两端同超声微孔雾化片W两端并联(一些为谐振补偿还并联电容C,或一些为减弱同初级偶合还串联电感L)。Regarding the single chip timing chip used as the drive of the ultrasonic microporous atomizer, the humidity detection, and the drive of the low-voltage DC fan (these drives are typical), the STC15W104 type 8-pin single chip can also be compactly realized: (in Figure 2) Micro The controller MCU outputs 108KHz PWM rectangular wave port P3.1 The series current limiting resistor R1 is connected to the gate G of the MOS transistor Mos1, the source S of the MOS transistor Mos1 is grounded, and the drain D of the MOS transistor Mos1 is connected to the primary end of the high-frequency step-up transformer B, B The other end of the primary is connected to +12V, and the secondary ends of the high-frequency step-up transformer B are connected in parallel with the two ends of the ultrasonic microporous atomizer W (some are connected in parallel with the capacitor C for resonance compensation, or some are connected in series with the inductance L to weaken the coupling with the primary).
湿度检测采用DHT11一总线接口数字湿度传感器,微控制器MCU端口P3.2接DHT11仅有的一根数据线(P3.2具有上下沿中断功能,适合做一总线接口驱动),DHT11的另两根引脚一根接地、一根接微控制器电源(3.3V)+端。Humidity detection adopts DHT11 bus interface digital humidity sensor, microcontroller MCU port P3.2 is connected to the only data line of DHT11 (P3.2 has the upper and lower edge interrupt function, suitable for a bus interface driver), the other two of DHT11 One of the root pins is grounded, and the other is connected to the microcontroller power supply (3.3V) + terminal.
微控制器MCU输出口P3.0串限流电阻R2接MOS管Mos2栅极G,MOS管Mos2源极S接地,MOS管Mos2漏极D接直流风扇F负极,直流风扇F正极接+12V(直流电机类风扇还要并联电容或反接二极管吸收反高压)。Microcontroller MCU output port P3.0 series current limiting resistor R2 is connected to the gate G of the MOS tube Mos2, the source S of the MOS tube Mos2 is grounded, the drain D of the MOS tube Mos2 is connected to the negative pole of the DC fan F, and the positive pole of the DC fan F is connected to +12V ( DC motor fans also need parallel capacitors or reverse diodes to absorb reverse high voltage).
之所以将超声微孔雾化、温度(DHT11同时具有温度检测)湿度检测、及风扇放在一起,是因为这三项功能组合在一起对种子发芽、育苗有重要作用,可组成发芽/育苗加湿实验箱。The reason why ultrasonic microporous atomization, temperature (DHT11 also has temperature detection), humidity detection, and fan are put together, because these three functions are combined to play an important role in seed germination and seedling raising, and can form germination/seedling humidification. experimental box.
STC15W104的P3.3(上下降沿中断)作SDA、P3.4(仅下降沿中断)作SCL,连接到I2C(Slave)四芯插口。STC15W104's P3.3 (up and down edge interrupt) is used as SDA, P3.4 (only falling edge interrupt) is used as SCL, and is connected to the I2C (Slave) four-core socket.
STC15W104的P3.0、P3.1除串限流电阻接MOS管栅极外,仍不影响连接电脑烧录程序(MOS管栅极是高阻,还串电阻)。P3.0 and P3.1 of STC15W104 do not affect the connection to the computer programming program except that the series current limiting resistor is connected to the gate of the MOS tube (the gate of the MOS tube is high resistance and also has a series resistance).
关于单片机定时芯片用作红外遥控器及学习型编码记录:微控制器MCU输出口P3.5串限流电阻接红外发射LED负端,红外发射LED正端接微控制器电源+端;红外接收头(HS0038、PC838等)输出端接端口P3.2,红外接收头的另两根引脚一根接地、一根接微控制器电源(3.3V)+端,电路类似图2(去掉两MOS管)。About single chip timing chip used as infrared remote control and learning coding record: microcontroller MCU output port P3.5 series current limiting resistor is connected to the negative end of the infrared emission LED, and the positive end of the infrared emission LED is connected to the + end of the microcontroller power supply; infrared receiving The output terminal of the head (HS0038, PC838, etc.) is connected to port P3.2, the other two pins of the infrared receiving head are grounded, and the other is connected to the microcontroller power supply (3.3V) + terminal, the circuit is similar to Figure 2 (remove two MOS Tube).
操作说明:Instructions:
手机或电脑WiFi连接ESP-12模块方法如下:The method to connect the ESP-12 module with the WiFi of the mobile phone or computer is as follows:
在单片机定时芯片工作启动前,先用手机或电脑进行时间或定时功能设置,因此要连上配套的WiFi连接模块。若首次连接,手机或电脑在无线网络设置中找ESP-12、无密码或12345678,进行WIFI连接,连接成功后,打开浏览器访问196.168.4.1(ESP-12的WIFI连接AP模式的IP),进入操作界面后就可进行时间或定时功能设置。接着,常用的做法是将当地的无线路由器WIFI连接名、密码置入配套的WiFi连接模块中(ESP-12的WIFI连接STATION模式),使每次连上后其自动会连接当地的WIFI(无线路由器);设置成功后记下所用的(DHCP)IP地址(如:196.168.0.103),此后手机或电脑无需再进无线网络设置中找ESP-12连接,仍连原来的当地WIFI即可,当手机或电脑再要联机设置时,只要用浏览器访问196.168.0.103即可。注意:这里ESP-12模块的WIFI连接的AP、STATION模式,就是所说的WiFi直连方式(无须通外网、无须第三方服务,也不影响手机或电脑访问外网)。Before the MCU timing chip starts to work, first set the time or timing function with a mobile phone or computer, so it is necessary to connect the matching WiFi connection module. If you connect for the first time, the mobile phone or computer will find ESP-12, no password or 12345678 in the wireless network settings, and make a WIFI connection. After the connection is successful, open the browser to access 196.168.4.1 (the IP of the ESP-12’s WIFI connection AP mode), After entering the operation interface, you can set the time or timing function. Next, the common practice is to put the local wireless router WIFI connection name and password into the matching WiFi connection module (ESP-12's WIFI connection STATION mode), so that it will automatically connect to the local WIFI (wireless) after each connection. After the setting is successful, write down the (DHCP) IP address used (eg: 196.168.0.103), after that, the mobile phone or computer does not need to enter the wireless network settings to find the ESP-12 connection, but still connect to the original local WIFI, when the mobile phone or computer Or when the computer wants to set up online again, just use the browser to access 196.168.0.103. Note: The AP and STATION mode of the WIFI connection of the ESP-12 module here is the so-called WiFi direct connection method (no need to connect to the external network, no third-party service, and does not affect the mobile phone or computer to access the external network).
上述接上WiFi连接模块,用手机或电脑WiFi联机设置单片机定时功能,简称联机。联机时,有动态操作提示,包括直接测试效果或设置确认;设置满意后,撤掉WiFi连接模块,以后的使用(也就是脱离联机的单片机平时工作,即定时功能的启停),只要按单片机(定时芯片)所连的一个启动按键即可。对设有多种功能的选择启动,通过逐次短按启动按键,并观察指示灯LED状态。The above is connected to the WiFi connection module, and the timing function of the microcontroller is set online with the WiFi of the mobile phone or computer, which is referred to as online for short. When online, there will be dynamic operation prompts, including direct test effect or setting confirmation; after the setting is satisfactory, remove the WiFi connection module, and for future use (that is, the MCU that is disconnected from the connection works normally, that is, the timing function is turned on and off), just press the MCU (timing chip) connected to a start button. For the selection start with multiple functions, short press the start button one by one and observe the status of the indicator LED.
手机或电脑设置时间或定时有HTML5标准时间控件出现,只要选:月、日、时、分、周中某数字、或直接输入数字。When the mobile phone or computer sets the time or timing, the HTML5 standard time control will appear, just select: month, day, hour, minute, a number in the week, or directly input the number.
时间已启动,一般不能断电,除非是无需实时时间的延时类定时,在启动前可以断电。一些采用在设定的时间启动作为时间起点,如中午12点或晚上10点开机作为定时起点,可联机更改设定。The time has been started, and generally cannot be powered off, unless it is a time-delayed timing that does not require real-time time, it can be powered off before starting. Some use startup at the set time as the starting point of time, such as starting at 12:00 noon or 10:00 pm as the timing starting point, and the settings can be changed online.
对一些长时间的定时控制,在中途可确认定时在正常进行中,既可通过手机或电脑联机详细了解,也可通过长按启动按键看LED指示灯闪两次以上表示(长亮表示已断电过)。For some long-term timing control, you can confirm that the timing is in normal progress in the middle. You can either use your mobile phone or computer to learn more about it online, or you can press and hold the start button to see the LED indicator flashes more than twice to indicate that (long light means it has been disconnected. electricity).
一些微小电流单片机控制(如电容降压驱动可控硅),其5V以下的供电驱不动ESP-12WiFi模块,此种WiFi连接模块包括3.7V锂电池供电,及充电口或电源插头。Some micro-current microcontroller control (such as capacitor step-down driving thyristor), its power supply below 5V can not drive ESP-12 WiFi module, this WiFi connection module includes 3.7V lithium battery power supply, and charging port or power plug.
另外,用户会(有意无意)不即时拔掉WiFi连接模块,为防无故耗电或占WiFi资源,ESP-12WiFi连接模块还包括无操作延时后进入极低功耗模式(deep sleep。rtctime.dsleep(0,4))、或用手机或电脑设置ESP-12WiFi模块进入极低功耗模式。可通过ESP-12模块的RST按键或拔出再插上唤醒,继续WiFi联机工作。In addition, the user will not immediately unplug the WiFi connection module (intentionally or unintentionally). In order to prevent power consumption or occupying WiFi resources for no reason, the ESP-12 WiFi connection module also includes a very low power consumption mode after no operation delay (deep sleep. rtctime. dsleep(0,4)), or use a mobile phone or computer to set the ESP-12WiFi module into very low power mode. It can be woken up by the RST button of the ESP-12 module or unplugged and then plugged in to continue working on the WiFi connection.
定时设置常用如下典型格式:Timing settings are commonly used in the following typical formats:
[[日期][时间]]功能1:时长1[功能2:时长2][功能3:时长3]…[停时长]…[[date][time]]function1:duration1[function2:duration2][function3:duration3]…[stop duration]…
或or
[日期]开时间1-关时间1[功能/参数1][date] on time 1 - off time 1 [function/parameter 1]
[日期]开时间2-关时间2[功能/参数2][Date] On Time 2 - Off Time 2 [Function/Parameter 2]
……
[]表示可缺省,以常用值默认;功能/参数可包括多个数值。[] indicates that it can be defaulted, and defaults to common values; functions/parameters can include multiple values.
例1:[[日期][时间]]都缺省了,默认为开机即启动,[停时长]缺省,默认为不循环:Example 1: [[date][time]] are all defaulted, the default is to start when power on, the default of [stop duration], the default is to not cycle:
大火:10(分钟)小火:30(分钟)High fire: 10 (minutes) Small fire: 30 (minutes)
例2:Example 2:
4月1日8:30闹铃10(分钟)April 1st 8:30 Alarm 10 (minutes)
例3:Example 3:
4:00-6:30洗澡水加热4:00-6:30 Bath water heating
22:00-8:00冰箱上电22:00-8:00 Power on the refrigerator
定时类这种典型格式较为通用,所以WiFi模块才能做得具有一定的通用性,为多种应用共用。The typical format of the timing class is more general, so the WiFi module can be made to have a certain versatility and be shared by a variety of applications.
ESP-12WiFi模块编程采用NODEMCU固件,LUA脚本语言程序公开、HTML文件公开(一般都能直接从浏览器看到),则可教学推广,让用户可自己改写(脚本语言,改写一些名词、数字特别直观方便。特别是无需程序开发环境,有记事本就行,程序解释都在NODEMCU固件中)为更适用美观的设置操作界面。特别要提供包括HTML5+JS的SSE程序范例及I2C(master)两线串行总线接口以SCL上沿中断方式触发启动读发来的字节i2c.read(0,n):byte(1,n)的程序范例。The ESP-12WiFi module is programmed with NODEMCU firmware, and the LUA scripting language program and HTML file are open (usually can be seen directly from the browser), which can be taught and promoted, allowing users to rewrite (scripting language, rewrite some nouns, numbers, etc.) Intuitive and convenient. Especially without a program development environment, there is a notepad, and the program explanations are all in the NODEMCU firmware) for a more suitable and beautiful setting operation interface. In particular, the SSE program example including HTML5+JS and the I2C (master) two-wire serial bus interface are triggered to start reading the bytes sent by the SCL rising edge interrupt i2c.read(0,n):byte(1,n ) program example.
再有已编程单片机定时芯片的控制功能及用法通过技术文件完全公开,包括单片机引脚功能及连接图,则更能自已编程实现个性化功能。In addition, the control function and usage of the programmed MCU timing chip are fully disclosed through technical documents, including the pin function and connection diagram of the MCU, and the individual functions can be programmed by themselves.
本发明的核心是提出“借WiFi模块”临时连接所带来的应用模式变化。The core of the present invention is to propose the change of the application mode brought about by the temporary connection "by the WiFi module".
最初的想法是借WiFi模块临时性地用手机或电脑WiFi连接单片机,实现用手机或电脑来方便地设置工作要求(因为常规电器的设置很麻烦,例如电饭煲设时间、各类电子钟/定时器设时间),结果没想到,正是这种临时性地借WiFi模块,带来了一系列的变化,特别是为单片机带来了一种新的应用模式。The original idea is to use the WiFi module to temporarily connect the microcontroller with the WiFi of the mobile phone or computer, so that the mobile phone or computer can be used to conveniently set the work requirements (because the setting of conventional electrical appliances is very troublesome, such as setting the time of the rice cooker, various electronic clocks/timers) Set time), but unexpectedly, it is this temporary borrowing of the WiFi module that brings a series of changes, especially a new application mode for the microcontroller.
首先是手机或电脑这种高普及率的使用,人人都会,具体的操作可设计成有动态提示。正是有了手机或电脑事先已做好了个性化定时设置,单片机工作、或定时类电器的具体启动就简单了,即单片机系统、或定时类应用电器上的显示屏、键盘就不需要了,仅设一个启动按钮及一两个状态指示LED即可。也就是说这种单片机定时控制或所构成的电器的操作界面一般不要了、体积变小了、设计简化了、成本降低了。The first is the use of mobile phones or computers with a high penetration rate. Everyone can do it, and specific operations can be designed with dynamic prompts. It is with the mobile phone or computer that the personalized timing settings have been made in advance, so that the work of the single-chip microcomputer or the specific startup of timing appliances is simple, that is, the display screen and keyboard on the single-chip system or timing application appliances are not required. , just set up a start button and one or two status LEDs. That is to say, the operation interface of this kind of single-chip timing control or electrical appliances is generally not needed, the volume becomes smaller, the design is simplified, and the cost is reduced.
顺着这个思路进一步推广,在单片机引脚允许的前提下,多编一些定时功能在单片机中,具体用哪个借WiFi模块联机,由用户自己选择。因为手机或电脑有操作动态提示、下拉菜单、钩选等,功能选择或个性化详细定制很方便。因此这种已编程单片机成了不需要用户写程序的通用芯片了(特别适合快速低成本满足个性化小众需求,因个性化小众需求不适合定制芯片批量生产)。由此引发出两种应用用户,一种就是常规的最终用户,另一种用户是二次开发商家,凭借对NODEMCU的熟悉及会LUA脚本语言、HTML5编程,将这种已编程单片机按最终用户需求进行功能定制,同时调整配套的WiFi模块操作界面,使最终用户拿到的单片机定时芯片及配套的WiFi模块是已经过定制的、很专业的应用套件。Following this idea to further promote, under the premise of the MCU pins, more timing functions are programmed in the MCU, and the user can choose which one to use to connect with the WiFi module. Because the mobile phone or computer has dynamic operation prompts, drop-down menus, hook selections, etc., it is very convenient to select functions or personalize detailed customization. Therefore, this programmed single-chip microcomputer has become a general-purpose chip that does not require users to write programs (especially suitable for fast and low-cost to meet personalized niche needs, because personalized niche needs are not suitable for mass production of customized chips). This leads to two kinds of application users, one is the conventional end user, and the other is the secondary developer. With the familiarity with NODEMCU and the knowledge of LUA scripting language and HTML5 programming, the programmed single-chip microcomputer is used by the end user. Function customization is required, and at the same time, the supporting WiFi module operation interface is adjusted, so that the MCU timing chip and the supporting WiFi module obtained by the end user are customized and very professional application suites.
为二次开发商家对这种已编程单片机充分开发应用,已编程单片机必须有详细功能使用说明文件,包括单片机各引脚连接图及功能说明(输出控制信号还包括PWM、输入信号还包括ADC,提供典型测试电路),以及配套的WiFi模块中的NODEMCU LUA脚本编程、HTML5文件(包括提供HTML5+JS的SSE程序范例及I2C(master)两线串行总线接口以SCL上沿中断方式触发启动读发来的字节i2c.read(0,n):byte(1,n)的程序范例)。最终用户也可根据这些改写(脚本语言,改写一些名词、数字特别直观方便。特别是无需程序开发环境,有记事本就行,程序解释都在NODEMCU固件中)更适自己的设置操作界面。In order for the secondary developers to fully develop and apply this programmed single-chip microcomputer, the programmed single-chip microcomputer must have detailed function instructions, including the pin connection diagram and function description of the single-chip microcomputer (the output control signal also includes PWM, and the input signal also includes ADC, Provide typical test circuit), as well as NODEMCU LUA script programming and HTML5 files in the matching WiFi module (including providing HTML5+JS SSE program example and I2C (master) two-wire serial bus interface triggering start reading by SCL rising edge interrupt mode The program example of the sent byte i2c.read(0,n):byte(1,n)). End users can also rewrite according to these (scripting language, rewriting some nouns and numbers is particularly intuitive and convenient. Especially without a program development environment, a notepad is enough, and the program explanations are all in the NODEMCU firmware) more suitable for their own setting operation interface.
注意:STC单片机因通常要执行高速操作,例如输出微孔雾化超声波所需要的110KHz的PWM驱动信号,或学习红外遥控器发射的编码,还要同时有系统时钟、响应按键操作包括短按、长按,一般只能用高效的汇编语言(特别是STC15系列的8脚IC,片上资源有限,程序必须非常高效精简),编程难度大,因此对STC单片机的程序一般不作教学推广。Note: STC microcontroller usually needs to perform high-speed operations, such as outputting the 110KHz PWM drive signal required for micro-atomized ultrasonic waves, or learning the code emitted by the infrared remote control, and also has a system clock and responds to key operations including short press, Long press, generally can only use efficient assembly language (especially the 8-pin IC of STC15 series, the on-chip resources are limited, the program must be very efficient and streamlined), and the programming is difficult, so the program of STC microcontroller is generally not used for teaching promotion.
适用的应用类:Applicable application classes:
1、定时器控制类,定时器的设置实际上分成两部分:时钟设置、定时设置。这两种设置用常规的带显示屏时钟模块来设置很麻烦,要反复一次一次地按小按键,免不了偶然一次弄错又要全重来。理想的方法当然是用手机或电脑来做这种设置,它有(HTML5)时间控件,只要选选点击就行,或键盘直接输入数字或手写都很方便。无论是时钟设置、还是定时设置,设置完成后就不再需要手机或电脑了,单片机工作时不需要显示屏及键盘,仅留一个启动按钮及一两个状态指示LED即可。控制包括通电断电、PWM数值调节、红外遥控、无线遥控、及微孔雾化超声波输出等。应用实例有冰箱峰谷供电节能插座、超声微孔雾化、学习型定时遥控器等。1. Timer control class, the timer setting is actually divided into two parts: clock setting and timing setting. It is very troublesome to set these two settings with a conventional clock module with a display screen. It is necessary to press the small button again and again, and it is inevitable to make a mistake and have to do it all over again. The ideal method is of course to use a mobile phone or computer to do this kind of setting, it has (HTML5) time control, just choose and click, or the keyboard directly input numbers or handwriting is very convenient. Whether it is the clock setting or the timing setting, after the setting is completed, there is no need for a mobile phone or a computer. The single-chip microcomputer does not need a display screen and a keyboard when working, only a start button and one or two status indication LEDs are left. Control includes power-on and power-off, PWM value adjustment, infrared remote control, wireless remote control, and microporous atomization ultrasonic output. Application examples include refrigerator peak and valley power supply energy-saving sockets, ultrasonic micro-atomization, learning-type timing remote control, etc.
2、数值调整类设置:微孔雾化片工作频率选定、LED灯亮度设置(降低亮度很节能,特别对36颗LED灯珠以上的高压恒流供电,目前已成主流,问题是只要其中一颗LED灯珠坏就全坏,降低亮度是最好的保护)、电瓶车充电器工作微调(调小充电电流安全,但时间长;对没有电池保护电路的廉价组装电池,增加大电流充电限时设置)、电饭煲、炖锅、养生炉、电磁炉、电陶炉等(微控制电器)按个人需求设几个专项(如:烧饭:大火10分钟,小火20分钟,不保温;热菜:大火1分钟,小火3分钟,保温;老人安全加热:小火20分钟,不保温),这些琐碎的设置只有用手机或电脑来做才解释得清楚。一旦设置完成,平时使用就很方便了,不再需要手机或电脑,只要一个启动按钮及若干个状态指示LED即可(例如,LED1亮表示:大火10分钟、LED2亮表示:小火20分钟、LED3亮表示:保温60分钟;短按启动按钮轮换,长按取消或关)。2. Numerical adjustment type settings: selection of the working frequency of the microporous atomizer, setting of the brightness of the LED lamp (reducing the brightness is very energy-saving, especially for high-voltage constant current power supply with more than 36 LED lamp beads, which has become the mainstream at present, the problem is that as long as the One LED lamp bead is damaged, and it is the best protection to reduce the brightness), battery car charger work fine-tuning (lowering the charging current is safe, but the time is long; for cheap assembled batteries without battery protection circuits, increase the high-current charging time limit Settings), rice cookers, stew pots, health stoves, induction cookers, electric pottery stoves, etc. (micro-control appliances) set up several special projects according to personal needs (eg: cooking: high fire for 10 minutes, low fire for 20 minutes, no heat preservation; hot dishes: High fire for 1 minute, low fire for 3 minutes, keep warm; safe heating for the elderly: low fire for 20 minutes, no heat preservation), these trivial settings can only be explained clearly by using a mobile phone or computer. Once the setting is completed, it is very convenient to use in normal use, no need for a mobile phone or a computer, just a start button and several status indicator LEDs (for example, LED1 light means: high fire for 10 minutes, LED2 light means: low fire for 20 minutes, LED3 light means: keep warm for 60 minutes; short press the start button to rotate, long press to cancel or close).
注意,上述两类的设置调整都可能包括较复杂的人机交互,例如微孔雾化片工作频率选定,由于微孔雾化片的加工差异或升压电感的制作差异,工作频率选定得正确则工作电流不很大雾化很强,若工作频率选定得不正确,雾化小、电流大,很可能烧毁驱动功率管,因此让用户自己微调工作频率,实时观察效果,选择最优固定(平时就不需要这个过程了)。Note that the above two types of setting adjustments may include more complex human-computer interaction, such as the selection of the working frequency of the micro-atomized atomizer. If it is correct, the working current is not very large, and the atomization is very strong. If the working frequency is not selected correctly, the atomization is small and the current is large, which may burn the driving power tube. Therefore, let the user fine-tune the working frequency, observe the effect in real time, and choose the most Excellent fixed (usually do not need this process).
再例如电动车电瓶充电,想检查电瓶是否快坏了,通常观察充电时的电压上升情况,若上升快电压偏高,那电瓶就有问题了,这里涉及到了单片机要随机主动发采样数据给手机或电脑,让它们来进行复杂运算并显示结果。并且这些都是难得做一次的(插上配套的WiFi模块联手机或电脑操作),平时工作不需要WiFi模块,只要一个启动按钮及若干个状态指示LED即可。Another example is the charging of an electric vehicle battery. If you want to check whether the battery is about to break down, you usually observe the voltage rise during charging. If the voltage rises quickly and the voltage is too high, then the battery has a problem. Or a computer, let them perform complex operations and display the results. And these are rare to do once (plug in the matching WiFi module and connect to the mobile phone or computer to operate). Usually, the WiFi module is not needed for work, just a start button and several status indicator LEDs.
以上所列应用由已编程单片机实现很经济简洁,许多都是针对单片机定时控制的,省掉了显示屏键盘(有些甚至连启动按钮及LED状态指示都不要,如LED调光照明灯,它通过逐次断电切换)。难得需要复杂的调整设置时,借用配套的WiFi模块在手机或电脑上临时做一下。并且配套的WiFi模块可共用一个,将各配套的NODEMCU LUA程序合编在一起装入ESP-12WiFi模块,使用时由手机或电脑选择需要的应用。The applications listed above are very economical and simple to implement by programmed single-chip microcomputers, many of which are for the timing control of the single-chip microcomputer, eliminating the need for a display keyboard (some even do not even need a start button and LED status indication, such as LED dimming lighting, which is successive power-off switching). When it is rare to need complex adjustment settings, borrow the matching WiFi module to temporarily do it on your mobile phone or computer. And the matching WiFi module can be shared with one, and all the supporting NODEMCU LUA programs are compiled together and loaded into the ESP-12 WiFi module, and the required application can be selected by the mobile phone or computer when using.
因此,这就促成了本文所提出的一种单片机定时控制芯片。Therefore, this has contributed to a single-chip timing control chip proposed in this paper.
手机或电脑联机不涉及第三方网络服务、更不要注册/密码、不下载安装APP、也不需要通外网连接。因此不要把它同目前吹得高大上的物联网混淆,当然若需要联网,ESP-12的NODEMCU中有MQTT模块,本身就已经具备了物联网功能。Mobile phone or computer connection does not involve third-party network services, not to mention registration/password, no download and installation of APP, and no need to connect to an external network. So don't confuse it with the current high-profile Internet of Things. Of course, if you need to connect to the Internet, there is an MQTT module in the NODEMCU of the ESP-12, which already has the Internet of Things function.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910410187.5A CN110147058B (en) | 2019-05-16 | 2019-05-16 | A kind of single chip timing chip borrowing WiFi module |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910410187.5A CN110147058B (en) | 2019-05-16 | 2019-05-16 | A kind of single chip timing chip borrowing WiFi module |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110147058A CN110147058A (en) | 2019-08-20 |
CN110147058B true CN110147058B (en) | 2020-10-16 |
Family
ID=67595595
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910410187.5A Expired - Fee Related CN110147058B (en) | 2019-05-16 | 2019-05-16 | A kind of single chip timing chip borrowing WiFi module |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110147058B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111049609B (en) * | 2019-12-09 | 2021-11-12 | 思尔芯(上海)信息科技有限公司 | Method for generating programmable clock by Ethernet |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN205174858U (en) * | 2015-12-07 | 2016-04-20 | 成都前锋电子有限责任公司 | Realize WIFI data interchange's water heater |
CN205427533U (en) * | 2016-03-18 | 2016-08-03 | 成都前锋电子电器集团股份有限公司 | Water heater wireless data switching control circuit |
CN206450320U (en) * | 2016-11-04 | 2017-08-29 | 恒信大友(北京)科技有限公司 | A kind of high-performance high-speed motion mechanism dynamic characteristic tester |
CN206611191U (en) * | 2016-12-27 | 2017-11-03 | 时欣 | A kind of separate type has the portable power source of WIFI signal |
CN109247227A (en) * | 2018-08-08 | 2019-01-22 | 浙江大学 | A kind of automatic watering function control box being arranged based on soil humidity and upper lower threshold value |
CN109447218A (en) * | 2018-10-18 | 2019-03-08 | 成都芯创智联科技有限公司 | Wifi label timing reporting system and WIFI label launching technique |
CN208739136U (en) * | 2018-09-12 | 2019-04-12 | 深圳数位科技有限公司 | Communication module |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160124394A1 (en) * | 2014-10-30 | 2016-05-05 | Hua Wen Hsu | Wireless inductive pointer clock |
US9690272B2 (en) * | 2015-02-16 | 2017-06-27 | Polaris Tech Global Limited | Indoor automation and control method and system thereof using RFID-to-Bluetooth selective adapter |
-
2019
- 2019-05-16 CN CN201910410187.5A patent/CN110147058B/en not_active Expired - Fee Related
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN205174858U (en) * | 2015-12-07 | 2016-04-20 | 成都前锋电子有限责任公司 | Realize WIFI data interchange's water heater |
CN205427533U (en) * | 2016-03-18 | 2016-08-03 | 成都前锋电子电器集团股份有限公司 | Water heater wireless data switching control circuit |
CN206450320U (en) * | 2016-11-04 | 2017-08-29 | 恒信大友(北京)科技有限公司 | A kind of high-performance high-speed motion mechanism dynamic characteristic tester |
CN206611191U (en) * | 2016-12-27 | 2017-11-03 | 时欣 | A kind of separate type has the portable power source of WIFI signal |
CN109247227A (en) * | 2018-08-08 | 2019-01-22 | 浙江大学 | A kind of automatic watering function control box being arranged based on soil humidity and upper lower threshold value |
CN208739136U (en) * | 2018-09-12 | 2019-04-12 | 深圳数位科技有限公司 | Communication module |
CN109447218A (en) * | 2018-10-18 | 2019-03-08 | 成都芯创智联科技有限公司 | Wifi label timing reporting system and WIFI label launching technique |
Also Published As
Publication number | Publication date |
---|---|
CN110147058A (en) | 2019-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN206061200U (en) | A kind of bluetooth lamp affixed to the ceiling | |
CN101739014A (en) | X10 power line carrier communication-based household electrical appliance control system and control method thereof | |
WO2008119207A1 (en) | Wireless smart cooking appliance, cooking stove, cooking device and operation thereof | |
CN110147058B (en) | A kind of single chip timing chip borrowing WiFi module | |
CN107229296B (en) | Intelligent cooling remote control weak current box and intelligent cooling method thereof | |
CN110297445B (en) | Micro-control electric appliance with WiFi plugging module | |
CN110297444B (en) | Programmed single chip microcomputer with WiFi module | |
CN110187656B (en) | A kind of electrical appliance with timing function borrowing WiFi plug-in | |
CN210317816U (en) | An intelligent electric fan based on single chip microcomputer | |
CN204906422U (en) | Gateway circuit of intelligence house based on STM32 | |
CN115048005B (en) | Intelligent switch control method and system | |
CN206863939U (en) | A kind of general bimodulus remote control with self-learning function | |
CN201812172U (en) | A remote switch automatic feeding device controller | |
CN213073174U (en) | System for intelligence speech control LED bulb and domestic appliance | |
CN102722123A (en) | Alternating current wiring board timing controller with voice prompt function | |
CN212649624U (en) | High-performance transmitting base station for factory intelligence | |
CN211995229U (en) | Intelligent charging control device for new energy automobile | |
CN111873819B (en) | Intelligent charging control device and control method for new energy automobile | |
CN103906299A (en) | Home lighting control system and home lighting control method | |
CN111830875A (en) | Home appliance control platform with IoT function | |
CN202282785U (en) | Self-encoding household electrical appliance control system based on Zigbee and infrared data association (IrDA) | |
CN206803431U (en) | A kind of air-conditioning remote control based on Bluetooth technology | |
CN206557557U (en) | A kind of smart home power consumption control equipment based on Internet of Things | |
CN206313443U (en) | Timing device controllable by near-field communication | |
CN215181556U (en) | Intelligence house control panel circuit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20201016 |