Development and design of scales
The types of scales can be divided into: electronic scales, mechanical scales (pointer scales). Weight scales can also be divided into weight scales with a height ruler and weight scales without a height ruler. There is also a body fat scale, which is a type of electronic scale. In addition to measuring body weight, it can also measure fat, calories, bones, moisture and other contents.
Weight scales can accurately weigh people's weight, and reflect the weight control situation of a certain period of time through daily weight changes. Height and weight scales use ultrasonic technology to measure height (no touch); precision sensors measure weight and can display height and weight results at the same time. Traditional height and weight scales can only measure weight or height, and have a single function. Based on this consideration, we designed a human body height and weight scale, which can use 5 LED lights to indicate the body's fat and thin, increasing the fun of height and weight scales. And practicality.
1. Interesting height and weight scale structure
The human body height and weight scale is designed using pressure sensor and ultrasonic sensor, and its structure diagram is shown in Figure 1.
The human body height and weight scale includes: weight scale base, pressure sensor module, weight scale pole, ultrasonic sensor module, single-chip minimum system, five indicator lights, power supply, gender selection button and so on. The pole of the scale is vertically fixed on the base of the scale, the pressure sensor module and the power supply are installed inside the base of the scale, the gender selection button is installed on the side of the pole of the scale, the ultrasonic sensor module is fixed on the top of the pole of the scale, the pressure sensor module and The voltage signals output by the ultrasonic sensor module are sent to the minimum system of the single-chip microcomputer, and the minimum system of the single-chip microcomputer sends the processing results to five indicator lights for display.
Second, the height and weight scale circuit design
The single-chip microcomputer programming is simple, the cost is low, and it is widely used in many control fields. The minimum system circuit of the single-chip microcomputer includes a single-chip microcomputer, a crystal oscillator circuit that provides a clock, a reset circuit for initialization, and a power supply circuit. AT89S5X single chip microcomputer has 40 ports. When P0 port is used, it usually pulls high level through connection resistance. The single-chip microcomputer in the single-chip microcomputer minimum system stores the relationship between the height and weight of men and women, and the output signal of the single-chip microcomputer minimum system controls one of the five indicator lights.
The power supply is a 5 volt DC power supply, the positive pole of which is connected to 40 pins of the single-chip microcomputer in the minimum system of the single-chip computer, and the negative pole is connected to 20 pins of the single-chip microcomputer in the minimum system of the single-chip computer. One end of the gender selection button is connected to the negative pole of the power supply (11), and the other end is connected to the 25 pin of the single-chip microcomputer in the smallest system of the single-chip microcomputer.
The circuit unit of human body height and weight scale is shown in Figure 3. The pressure sensor module includes a pressure sensor [4-6], an amplifier and an A/D converter. The pressure sensor module is connected to four pins, which are the power supply Vcc and the clock SCK. Data output DT, ground GND, these 4 pins are inserted on the pin header and led out with leads. Among them, the power supply Vcc is connected to the 40 pin of the MCU in the MCU minimum system, and the clock SCK is connected to the 26 pin of the MCU in the MCU minimum system. The output DT is connected to the 27 pins of the MCU in the minimum system of the MCU, and the ground GND is connected to the 20 pins of the MCU in the minimum system of the MCU.
The ultrasonic sensor module is connected with 4 pins, which are power supply VCC, ground GND, digital signal DO, and analog signal AO. The power supply VCC and the ground GND are respectively connected to the positive and negative poles of the power supply. The analog signal AO output is sent to the 28 pin of the single-chip microcomputer in the smallest system board of the single-chip microcomputer. The digital signal DO pin is not connected.
The negative poles of the five LED indicators [7-8] are connected in series with a 470 ohm resistor and then connected to the 20 pins of the single-chip microcomputer in the minimum system of the single-chip microcomputer. The positive pole of the first indicator light is connected to the 39 pins of the single-chip microcomputer in the minimum system of the single-chip microcomputer. The indicator light (6) glows red when lit, indicating obesity. The positive pole of the second indicator light is connected to the 38 pin of the single-chip microcomputer in the minimum system of the single-chip microcomputer. When the second indicator light is lit, it emits a yellow light, indicating that the weight is too heavy. The positive pole of the third indicator light is connected to the 37 pin of the single-chip microcomputer in the minimum system of the single-chip computer. When the third indicator light is lit, it emits green light, indicating that the body weight is normal. The positive pole of the fourth indicator light is connected to the 36 pins of the single-chip microcomputer in the minimum system of the single-chip microcomputer. When the fourth indicator light is lit, it emits blue light, indicating that the weight is light. The positive electrode of the fifth indicator light is connected to the 35 pin of the single-chip microcomputer in the minimum system of the single-chip microcomputer (5). When the fifth indicator light is lit, it emits white light, indicating that it is underweight.
3. Software design of height and weight scale
When the single-chip microcomputer program is running, first read the values of the pressure sensor module and the ultrasonic sensor module, and judge whether someone stands on the fun height and weight scale according to the value of the sensor. When someone stands on the fun height and weight scale, select whether to press according to gender Gender selection button, according to the World Health Organization's fat and thin standards for men, men: (height-80) × 70% = standard weight, women: (height-70) × 60% = standard weight, where height is in centimeters. Standard weight plus or minus 10% is normal weight, standard weight plus or minus 10% to 20% is overweight or underweight, standard weight plus or minus 20% is obese or underweight, and the minimum system of single chip microcomputer is judged according to the World Health Organization standards The body is fat and thin, and the output result control indicator light indicates. When the minimum system of the single chip microcomputer judges that the person has stepped off the fun height and weight scale, all the indicator lights are turned off and the values of the pressure sensor module and the ultrasonic sensor module are re-read.
The human body interesting height and weight scale is designed using the single-chip minimum system, pressure sensor module, ultrasonic sensor module, LED lights and other devices. The signals output by the pressure sensor module and the ultrasonic sensor module are sent to the minimum system of the single-chip microcomputer for processing to obtain the weight and height data of the human body. The gender selection button is innovatively designed. According to the gender of the tester, whether to press the gender selection button is selected. The stored World Health Organization stipulated standards for fat and thin body to judge the degree of fat and thin body of the human body, the minimum system of the single-chip microcomputer uses the processing results to control five indicators to display fat and thin.
Fourth, the intelligent scale design
1. Brief introduction of intelligent scales based on Internet of Things technology
The current weight scale only has a function of weighing the weight, and cannot store these data, nor can it give a weight change trend, nor can it give a reminder when the user's weight exceeds the standard.
Record the trend of weight change, and remind users by sending text messages when the weight exceeds a certain set value, which is an effective auxiliary method for people who control weight. Especially for developing babies, high blood pressure, high blood sugar and other people whose physical conditions are closely related to body weight, this function can not only help doctors understand the trend of patient weight change, but also help users understand their own body disease changes And records, so as to provide a basis for future nutrition plans and improve the rationality, pertinence and scientificity of fitness activities. In addition, by recording the weight change data of the majority of users and performing big data analysis, we can understand various indicators such as the nutritional status, living development level, and the relationship between weight and disease of our population.
With the improvement of people's living standards, people's pursuit of health is getting higher and higher; with the development of IoT big data mobile Internet technology and its application in various industries, data is collected through the IoT and passed to the big data platform for analysis and application There are more and more patterns.
On the basis of the existing scales, new functions are added, and the traditional scales are transformed to have the function of wireless transmission. That is, after the user weighs, press the button, and the weight value will be transmitted to the receiving platform through the wireless transmission device. The receiving platform will store the received data and analyze the data. If the data exceeds the preset threshold, it will send a text message to the user through the SMS gateway during the meal time to remind the user to pay attention to the diet, so as to help the user to weigh their own weight The purpose of control. In addition, you can also record the weight value and generate a weight change curve.
2. Smart weighing scale solution architecture
The design of intelligent scales based on the Internet of Things technology includes: scale body, communication server, database server, web server, mobile terminal applications. The communication server, database server and web server together constitute the back-end server of the weight management system. The mobile terminal application is installed on the smartphone and connected to the weight management system through the mobile network. The system block diagram is shown in Figure 1.
(1) Scale body: In addition to the weighing function of ordinary scales, the scale also has a wireless communication module, which has the function of sending data to an external network through wireless communication technology. Considering that each weight scale in a family may be used by multiple people, design multiple buttons when designing the weight scale, each button corresponds to one person. Each scale has a unique SN in the world, used to distinguish different scales. SN plus button number is used to uniquely identify a user. In the data transmission protocol, the data of SN and button number should be specified and sent to the communication server through TCP protocol. Each scale is a TCP client. Connected through a wireless network to access a communication server with a fixed IP address. SN, button number and weight data constitute a data packet to be sent at a time. Every time you weigh overweight, the scale has a process of establishing a connection, sending data, and disconnecting.
(2) Communication server: The main function of the communication server is to serve as the server side of the TCP connection. The communication server program accepts the connection from the weight scale, analyzes the data, obtains the weight scale SN, button number, weight value, and writes this information in the database. When the number of devices is large, the pressure on the communication server is relatively large. To this end, the communication server uses asynchronous connection to receive data from the scale. In actual development, it was found that due to the phenomenon of false connection sometimes caused by the wireless connection, that is, the device has actually been disconnected, but the instability of the wireless connection will cause an illusion that the connection on the server side is still maintained and will not be broken by itself. Off. The disadvantage of this false connection phenomenon is that when the communication program runs for too long, the total number of connections will exceed the maximum number of connections that the server can receive, so that the new device cannot be connected. In order to avoid this phenomenon, the data sending time of each connection can be monitored. If no data is sent or received within Qiaomin, the server-side program will actively disconnect.
Another function of the communication server is to write data into the database. When the number of devices is large, the pressure of concurrent access is high. In order to reduce the pressure on the database, two measures are taken: first, the database connection pool mechanism is adopted; second, the data within 1 min is first stored in memory. After 1 min, it will be written into the database. This greatly reduces the pressure on database access.
(3) Database server: The database server uses MongoDB database. MongoDB is a high-performance, open-source, modeless document-based distributed document storage database written in C++ language. It aims to provide scalable and high-performance data storage solutions for web applications. It is a popular type in Nosql database. It can be used to replace traditional relational databases or key/value storage in many scenarios. MongoDB is a product between relational database and non-relational database. It is the most versatile and relational database among non-relational databases. The data structure it supports is very loose and is a bjson format similar to json, so it can store more complex data types. The biggest feature is that the supported query language is very powerful, and its syntax is a bit similar to the object-oriented query language. It can almost realize most of the functions of single-table queries in relational databases, and it also supports indexing of data. It has the characteristics of high performance, easy deployment, easy to use, and very convenient to store data. And MongoDB can be used as a Hadoop MapReduce data source and data storage destination database through the connector, which laid the foundation for future big data analysis.
(4) Web server: The web server provides a B/S architecture program, which is used to support users to access their weight data from the PC or mobile phone, view the weight change curve and the weight threshold filled in advance by the user. When the weight exceeds the threshold At this time, a text message will be sent through the SMS gateway to remind the user to pay attention to diet.