Development and design of scale scheme
The types of scales can be divided into: electronic scale and mechanical scale (pointer scale). Weighing scales can also be divided into weighing scales with height ruler and weighing scales without height ruler. In addition, there is a body fat scale, which is a kind of electronic scale. In addition to measuring body weight, it can also measure the contents of fat, calories, bone, water, etc.
The scale can accurately weigh people's weight and reflect the weight control in a certain period of time through daily weight changes. The height scale adopts ultrasonic technology to measure height (non touch type); Precision sensor can measure weight and display height and weight results at the same time. The traditional height scale can only measure weight or height with single function. Based on this consideration, we designed the human body interesting height scale, which can indicate the weight of the human body with five LED lights, which increases the interest and practicability of the height scale.
1、 Interesting height scale structure
The human body height scale is designed with pressure sensor and ultrasonic sensor, and its structural diagram is shown in Figure 1.
The human body interesting height scale includes: scale base, pressure sensor module, scale pole, ultrasonic sensor module, single chip microcomputer minimum system, five indicator lights, power supply, gender selection button, etc. The scale vertical pole is vertically fixed on the scale base, the pressure sensor module and power supply are installed inside the scale base, the gender selection button is installed on the side of the scale vertical pole, the ultrasonic sensor module is fixed on the top of the scale vertical pole, and the voltage signals output by the pressure sensor module and ultrasonic sensor module are sent to the MCU minimum system, The minimum system of single chip microcomputer sends the processing results to five indicator lights for display.
2、 Circuit design of height and weight scale
Single chip microcomputer has simple programming and low cost. It is widely used in many control fields. The minimum system circuit of single chip microcomputer includes single chip microcomputer, crystal oscillator circuit providing clock, reset circuit for initialization and power supply circuit. At89s5x single chip microcomputer has 40 ports. When port P0 is used, the high level is generally pulled through the drain resistance. The relationship between the height and weight of men and women is stored in the single chip microcomputer minimum system. The output signal of the single chip microcomputer minimum system controls one of the five indicator lights to light up.
The power supply is a 5V DC power supply, the positive pole is connected to the 40 pin of the single chip microcomputer in the minimum system of the single chip microcomputer, and the negative pole is connected to the 20 pin of the single chip microcomputer in the minimum system of the single chip microcomputer. One end of the sex 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 minimum system of the single chip microcomputer.
The circuit unit of human body weight scale is shown in Figure 3. The pressure sensor module includes pressure sensor [4-6], amplifier and a / D converter. The pressure sensor module is externally connected with four pins, namely power supply VCC, clock SCK, data output DT and ground GND. These four pins are inserted into the needle seat and led out with leads. The power supply VCC is connected with the 40 pin of single chip microcomputer in the minimum system of single chip microcomputer, The clock SCK is connected to pin 26 of the single chip microcomputer in the minimum system of the single chip microcomputer, the data output DT is connected to pin 27 of the single chip microcomputer in the minimum system of the single chip microcomputer, and the ground GND is connected to pin 20 of the single chip microcomputer in the minimum system of the single chip microcomputer.
The ultrasonic sensor module is externally connected with four pins, namely power supply VCC, ground GND, digital signal do and analog signal Ao. The power supply VCC and ground GND are respectively connected to the positive and negative poles of the power supply, the output analog signal Ao is sent to the 28 pin of the single chip microcomputer in the minimum system board of the single chip microcomputer, and the digital signal do pin is not connected.
The negative pole of the five LED indicator lights [7-8] is connected in series with a 470 ohm resistance, and then connected to the 20 pin 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 pin of the single chip microcomputer in the minimum system of the single chip microcomputer. When the first indicator light (6) is lit, it emits red light, indicating fat. 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 yellow light, indicating that the weight is overweight. The positive pole of the third indicator is connected to the 37 pin of the single chip microcomputer in the minimum system of the single chip microcomputer. When the third indicator is lit, it emits green light, indicating that the weight is normal. The positive pole of the fourth indicator is connected to the 36 pin of the single chip microcomputer in the minimum system of the single chip microcomputer. When the fourth indicator is lit, it emits blue light, indicating that the weight is light. The positive pole of the fifth indicator is connected to the 35 pin of the single chip microcomputer in the minimum system (5). When the fifth indicator is lit, it emits white light, indicating that you are 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 has stood on the interesting height scale according to the values of the sensor. When someone has stood on the interesting height scale, select whether to press the gender selection button according to gender. According to the fat and thin standard of the human body of the World Health Organization, male: (height - 80) × 70% = standard weight, female: (height - 70) × 60% = standard weight, where height is in cm. Plus or minus 10% of the standard weight is normal weight, plus or minus 10% ~ 20% of the standard weight is overweight or underweight, and more than plus or minus 20% of the standard weight is obese or underweight. The minimum single chip microcomputer system judges the weight of the human body according to the standards of the World Health Organization, and the output results are controlled by the indicator light for indication. When the minimum system of single chip microcomputer judges that the person has stepped off the interesting height and weight scale, turn off all indicators and re read the values of pressure sensor module and ultrasonic sensor module.
The human body interesting height and weight scale is designed by using the minimum system of single chip microcomputer, pressure sensor module, ultrasonic sensor module, LED lamp 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 creatively designed. Whether to press the gender selection button is selected according to the tester's gender, and the degree of obesity and thinness of the human body is judged according to the human body obesity and thinness standard specified by the World Health Organization pre stored in the single chip microcomputer, The minimum system of single chip microcomputer uses the processing results to control five indicator lights for fat and thin display.
4、 Scheme design of intelligent scale
1. Introduction of intelligent scale based on Internet of things technology
The current scale only has the function of weighing, and can not store these data, nor can it give the weight change trend, nor can it give a reminder when the user is overweight.
Record the trend of weight change and remind users by sending text messages when the weight exceeds a set domain value, which is an effective auxiliary means for people who control weight. Especially for developing infants, people whose physical conditions such as hypertension and hyperglycemia are closely related to their weight, this function can not only help doctors understand the patient's weight change trend, but also help users understand and record their own physical disease changes, so as to provide basis for future nutrition plans and improve the rationality of fitness activities Targeted and scientific. In addition, by recording and big data analysis of the weight change data of the majority of users, we can understand the nutritional status, living development level, the relationship between weight and disease and other indicators of China's population.
With the improvement of people's living standards, people's pursuit of health is higher and higher; With the development of Internet of things big data mobile Internet technology and its application in various industries, there are more and more application modes to collect data through the Internet of things and transmit it to the big data platform for analysis.
On the basis of the existing scale, new functions are added, and the traditional scale is transformed to have the function of wireless transmission. That is, after the user weighs the weight, press the button, and the weight value will be transmitted to the receiving platform through the wireless transmission device. The receiving platform will store and analyze the received data. If the data exceeds the preset threshold, it will send a text message to the user through the SMS gateway during meal time to remind the user to pay attention to diet, so as to help the user control his weight. In addition, the weight value can be recorded and the weight change curve can be generated.
2. Intelligent scale scheme architecture
The design of intelligent scale based on Internet of things technology includes: scale body, communication server, database server, web server and mobile terminal application. The communication server, database server and web server constitute the background server of the weight management system. The mobile terminal application is installed on the smart phone and connected with the weight management system through the mobile network. The system block diagram is shown in Figure 1.
(1) Body of scale: in addition to the weighing function of ordinary scale, the scale also has a wireless communication module, which can send data to the external network through wireless communication technology. Considering that each scale in a family may be used by more than one person, multiple buttons are designed when designing the scale, and each button corresponds to one person. Each scale has a unique Sn in the world to distinguish different scales. Sn plus button number is used to uniquely identify a user. Sn and button number shall be specified in the data transmission protocol, and the data shall be sent to the communication server through TCP protocol. Each scale is a TCP client. Connect to a communication server with a fixed IP address through a wireless network. Sn, button number and weight data constitute a data packet, which is sent at one time. For each overweight weighing, the scale has a process of establishing connection, sending data and disconnecting.
(2) Communication server: the main function of communication server is to act as the server side of TCP connection. The communication server program accepts the connection from the scale, parses the data, obtains the scale Sn, button number and weight value, and writes the information into the database. When the number of devices is large, the pressure of communication server is relatively large. Therefore, the communication server receives the data from the scale in the way of asynchronous connection. In the actual development, it is found that the false connection sometimes occurs due to the wireless connection, that is, in fact, the device has been disconnected, but the instability of the wireless connection will cause an illusion that the connection on the server side will still be maintained and will not be disconnected by itself. The disadvantage of this false connection phenomenon is that when the communication program runs 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 transmission time of each connection can be monitored. If it is found that there is no data transmission and reception within 15 minutes, 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 large. In order to reduce the pressure of database, two measures are taken: first, the database connection pool mechanism is adopted; Second, put the data within 1 min into memory first. Write it into the database after 1 min. This greatly reduces the pressure of database access.
(3) Database server: the database server adopts mongodb database. Mongodb is a high-performance, open source and modeless distributed document storage database written in C + + language. It aims to provide scalable high-performance data storage solutions for web applications. It is a popular kind of NoSQL database at present. It can be used to replace the traditional relational database or key / value storage in many scenarios. Mongodb is a product between relational database and non relational database. It is the most functional and relational database among non relational databases. The data structure it supports is very loose. It is a bjson format similar to JSON, so it can store more complex data types. Its biggest feature is that the supported query language is very powerful. Its syntax is a little similar to the object-oriented query language. It can almost realize most functions similar to single table query of relational database, and also support the establishment of index for data. It has the characteristics of high performance, easy deployment, easy use and convenient data storage. Moreover, mongodb can be used as the data source and data storage destination of Hadoop MapReduce through the connector, which lays a foundation for big data analysis in the future.
(4) Web server: the web server provides a B / S architecture program, which is used to support users to access their weight data from PC or mobile phone, view the weight change curve and according to the weight threshold filled in by users in advance. When the weight exceeds the threshold, it will send a text message through the SMS gateway to remind users to pay attention to diet.
3. Hardware design of intelligent scale
Another key point is to improve the traditional scale and design a low-cost and low-power scale with wireless transmission function.
(1) Weighing scale hardware module: the equipment is powered by battery. It can collect data from gravity sensor through a / D, process the original information according to a certain algorithm, and display the current collected sample value through LCD. Users can interact with nodes through key operation to upload data to the platform. Connect GPRS wireless communication module through serial port. The module can transmit the collected data to the remote platform. The low-power MSP430 processor is adopted, and the battery is divided into three channels to supply power to the gravity sensor, processor, display and wireless module respectively. This can achieve the purpose of saving energy consumption.
(2) Hardware low power design: the hardware design is divided into three parts according to the needs of function and low power design. The center of its design is low power design. The first part is the design of sensor circuit. The sensor circuit amplifies and shapes the original analog signal to facilitate a / D acquisition by M Cu; The second part is the design of digital circuit and man-machine interface, including a / D acquisition, LCD real-time data and status display, and sending data and status to wireless module in real time; The third part is the application design of wireless module, mainly the design of wireless module power supply and data interface. The key technologies of low power hardware design are power division, isolation and low power consumption.