“Memory Cup” is made of materials I use, and the cup pad material is a CD. The thermally conductive material is a coin, with 502 glue and thickened double-sided adhesive bonding, it is very simple.

单片机实例分享,温度记忆杯垫

The design of this work is from personal life experience. I hope to have the same troubles with me will like this design. As a “professional code farmer”, the author often encounters such a haunt: the morning is rushing, it will be cold; the colleague is not good, you need to drink warm water, you can forget it, you will do everyone. Have such experiences, this design is to solve this problem for everyone – you can promptly remind people to drink hot drinks. I like to drink hot drinks, I will not have to have a bitter eyebrow because of cooling hot drinks!

单片机实例分享,温度记忆杯垫

Function description

“Memory Cup” can achieve the following functions: When we put a cup of temperature in the cup in the cup, the temperature sensor installed on the cup begins to measure the bottom temperature of the cup, as long as the cup is not insulating material, then a cup The surface temperature will be proportional to the liquid temperature inside, when the liquid in the cup is lowered to the suitable person’s drinking habit, press “Memory Keys” at this time, the cup pad will permanently record the cup underlying temperature at this time; When the user placed a hot drink in the cup, the liquid is in the cooling process, as long as the bottom layer temperature of the cup is close to the temperature of the previous memory, the cup pad can prompt the owner to drink according to the designer, such as by flashing Lights prompts or through music.

working principle

The core of this design is the application around the temperature sensor DS18B20 and the single-chip EEPROM.

The DS18B20 acquisition temperature, the microcontroller is responsible for the processing of data, when there is a temperature required to record, the single chip stores the temperature to be recorded to the single-chip EEPROM; after the temperature record in the EEPROM, the single-chip microcomputer will be collected with the data in the EEPROM. When the data is approaching, the corresponding output is made, and the prompt function is turned on.

When a cup of coffee is pushed down next time, you can put the cup above the cup, and the temperature sensor will compare the collected temperature T value with the value A in the EEPROM, when A-1

The difference between the temperature can also be changed according to the designer’s needs, such as in a cold area, the difference between T and A can be implemented by changing the program. The author found that T and A can be between ± 1 when the actual test is actually tested.

When the memory key records temperature data to the single-chip microcomputer, the previous data will be erased, so that a button can complete the required operation.

Most of the domestic STC microcontrollers have come with a certain size of EEPROM, which brings great convenience to the designer. In order to make the circuit more concise, this time the STC11F04E’s 1T microcontroller is selected, which has a 4KB program storage space and 1KB of EEPROM space, and the 20-pin packaging design greatly reduces the PCB area. Figure 15.1 is a circuit schematic, and the production instructions are shown in Figure 15.2, Figure 15.3.

Figure 15.1 Circuit Schematic

单片机实例分享,温度记忆杯垫

Figure 15.2

单片机实例分享,温度记忆杯垫

Figure 15.2 The circular hole in the middle of the disc is used to place a temperature sensor, and the upper surface is fixed with a metal sheet, and the silicone is applied, and the heat conductive effect is increased, because most cups are concave, or the coin can have a certain thickness Material thermal conductivity.

Figure 15.3

Figure 15.3 The back of the cup, bonding the battery case, circuit board, water lamp, the temperature sensor has been sticky under the board (electrician fixed line box)

programming

It will be described here that most DS18B20 program code is designed for 12T microcontrollers, and 1T single-chip command speed is much faster than 12T single chip, which leads to the usual DS18B20 program that cannot be called directly. According to the official information of the STC, the author draws through the way the instruction is applied to the logic analyzer test, the conclusion is that the 11-series 1T microcontroller directive is about 6.5 times more than the 12T single chip microcomputer, according to this data to modify the latency of the original DS18B20 program. Programs and EEPROM programs ensure the stability of the system.

The vast majority of STC integrates EEPROM. Different models of erasing procedures are also small and small. It is very convenient to use, no additional EEPROM’s IC, no IC communication program. Because it is internal integration, the program code is simple, it is very understandable, saving the design cost while saving the application time.

The official information of the STC clearly gave the original program of EEPROM. The author made some changes in the program according to their own understanding, and made some changes to the official procedure. It applied the macro definition of the C language. I also made the corresponding library. Document, convenient and practical. This program is compiled in the Keil environment. When you use my own Basic.h, STC11FXX_IAP.H file, and then download the official single-chip base file, which ensures the correct compilation of the program.

■ The related source files of this production can be downloaded to QQ group 657864614.

■ Introduction to a different Taobao shop: Home – Digital Daren – Taobao, don’t believe you try?