© 2024 EasyEDA Some rights reserved ISO/IEC
Brand new interactions and interfaces
Smooth support for design sizes of over 3W
devices or 10W pads
More rigorous design constraints, more
standardized processes
For enterprises, more professional users
Easy to use and quick to get started
The process supports design scales of 300
devices or 1000 pads
Supports simple circuit simulation
For students, teachers, creators
PRO Smart Weight Scale
Mode:
The smart scale based on stm32 and HX711 has basic weighing function; it has Bluetooth or Wifi transmission function, and the weighing information can be viewed through the mobile phone; the mobile phone needs to have the weighing information storage function and can count historical data; when there are heavy objects It realizes the weighing function when it is put on it, and enters standby mode when the weight is less than a certain value; the scale is powered by lithium batteries and has a battery management circuit;
Figure 1-1 3D diagram of smart scale circuit
Figure 1-2 Smart scale circuit plan diagram
1. Main control chip: STM32F103C8T6
2. Power interface: TYPE-C
3. Button: a reset button
4. Weight measurement chip: HX711
5. Display interface: OLED display with I2C protocol
6. Debugging interface: SWD download debugging interface
7. Communication: communicate with mobile phone through Bluetooth module
This solution uses HX711 as the load sensor processing chip, uses four pressure strain gauges to form a full bridge to measure weight, uses STM32 as the main control chip to communicate with HX711 to obtain the deformation of the pressure strain gauges and converts it into weight, and uses MX-01 The Bluetooth module communicates with the mobile phone, and the WeChat applet is used to design the mobile phone software, which can store weighing data and conduct data analysis.
Figure 4-1 Overall schematic diagram of smart electronic scale
The power circuit is mainly composed of TYPE-C interface, lithium battery module and charging circuit. LED2 is used as a charging indicator light. When charging is completed, LED2 lights up. TP4056 is a lithium battery charging management chip. P2 is a lithium battery interface, using 3.7V lithium. The battery provides power.
Figure 4-2 Intelligent electronic scale power supply circuit
The main control circuit selects STM32F103C8T6 as the main control chip. The operating voltage is 2.0v~3.6v, the maximum clock frequency is 72MHZ, 64KB flash memory and 20KB SRAM. It is equipped with rich peripheral interfaces, including multiple general-purpose timers. Universal Synchronous/Asynchronous Serial Interface (USART), I2C and SPI interfaces to support a variety of communication and external device connection needs. The power input part of the chip needs to add a 100nf capacitor for power filtering.
Figure 4-3 Smart electronic scale main control circuit
The crystal oscillator circuit uses a 32.768Khz low-speed crystal oscillator and an 8Mhz high-speed crystal oscillator. In the software configuration, the clock input source of the chip must also be configured as an external input.
Figure 4-4 Intelligent electronic scale crystal oscillator circuit
The weighing circuit uses HX711 as a digital-to-analog conversion chip. HX711 is a precision analog-to-digital conversion chip that is widely used in weight measurement and weighing applications. It is particularly suitable for various weighing systems that require high accuracy and stability. The chip suppresses external interference and noise during the measurement process, thereby providing more reliable measurement results. It converts analog signals into digital data through a digital interface (such as SPI or simplified serial interface) to facilitate communication with the microcontroller.
The pressure sensor is connected through a full-bridge connection, and is connected to the HX711 chip through 4 wires, the E+, A+, GND, and A- interfaces, as shown in Figure 4-6.
Figure 4-5 Intelligent electronic scale weighing circuit
Figure 4-6 Pressure sensor connection circuit diagram
The voltage stabilizing circuit uses AMS1117 as a voltage stabilizing chip, which outputs 3.3V. AMS1117 is a linear voltage regulator chip that is commonly used in electronic circuits to provide stable voltage output. It is a miniature packaged low dropout voltage regulator that is typically used to step down from a higher voltage source (such as a battery or power adapter) to a stable lower voltage to power other circuits or devices .
Figure 4-7 Voltage stabilization circuit
The smart scale communicates with the mobile phone through the Bluetooth module. The Bluetooth module uses MA-01A, which adopts the BLE5.2 Bluetooth interface. It is a small connection block and has a test communication distance of 100m+. The module transmit power is 5dbm. The module communicates with the main control through the serial port. Circuit connection enables transparent transmission.
Figure 4-8 Bluetooth circuit
Reset circuit, press the Reset button and the RESET pin of the main control is pulled low, and the system enters the reset state. Release the Reset button, the RESET pin of the main control returns to high level, and the system resumes its working state and completes the reset.
Figure 4-9 Reset circuit
The project uses OLED as a display to display weight information. The OLED display module communicates with the main control chip through the I2C protocol and is connected to PB6 and PB7 of the main control chip respectively. PB6 is the clock line and PB7 is the SDA signal line.
Figure 4-10 OLED display interface
The main control chip uses STM32CUBE for clock configuration, as shown in Figure 5-1. During the configuration process, attention should be paid to switching the clock input source to an external input, that is, HSE, so that the maximum main frequency is 72Mhz.
Figure 5-1 Clock tree
See the attachment for the complete embedded code. The core code in the attachment will be explained here:
1. The HX711_Read(void) function located in main.c is to read the sensor value from the hx711 module.
Figure 5-2 Sensor pressure reading code
2. The Get_Weight(void) function located in main.c converts the value of the pressure sensor into weight and stores it. The data of the pressure sensor is basically linear and can be directly calibrated linearly. If you want to obtain higher-precision measurement results, then Interpolation calibration is required.
Figure 5-3 Sensor pressure processing part code
3. OLED displays string codes. The way OLED displays strings and numbers is to first use the modulo software PCtoLCD to obtain the hexadecimal encoding value of each string, and then write it into the microcontroller code file, as shown in Figure 5-5. This project mainly uses some strings. Binary images can also be modeled through modeling software and displayed on OLED. At the same time, if you want to display animations, you can also model multiple images of GIF through modeling. The software takes the model and places it in a code file.
Figure 5-4 Mold taking software interface
Figure 5-5 Modulus values of some strings
Figure 6-1 is the main interface of the mobile phone software. Figure a is the Bluetooth connection interface. When entering this page, the software will automatically search for nearby Bluetooth. After selecting the Bluetooth of the scale and making the connection, it will enter the Figure b interface. The Figure b interface will The weighing weight is displayed in real time, and the user can use the zero button to reset the weight to zero, similar to the tare function of a high-precision electronic scale. At the same time, the user can click the record function to record the current weight. When the user clicks on the historical analysis, it will Enter the historical data statistics interface. The interface will display the weight of the last 10 weighings and calculate the average weight and the heaviest and lightest weights.
Figure 6-1 Mobile software interface
The complete mini program code will be placed in the attachment. The structure and function of the code will be introduced below. The mini program mainly has four pages. The index page is the home page, which is the Bluetooth connection interface, the WeightUI page is the weighing home page, and the analyze page is the history. Data statistics page, you can switch to this page by clicking the historical analysis button.
The applet uses the ec-canvas control to draw a line chart and can dynamically modify the chart. See the code for details. Github link of the ec-canvas open source library: GitHub - ecomfe/echarts-for-weixin: WeChat applet version of Apache ECharts
Figure 6-2 Mobile terminal code structure
The device page is a communication debugging page that can receive data and customized startup data, as shown in Figure 6-3.
Figure 6-3 Communication debugging page
Figure 7-1 Front view of smart scale
Figure 7-2 Circuit diagram on the back of the smart scale
1. Modular circuit structure and reasonable partitioning.
2. Pins without network should be marked ❌.
3. Pay attention to the addition of power supply filter capacitors.
1. The filter capacitor of the power supply should be as close as possible to the power pin.
2. Avoid loops in signal lines.
3. The antenna of the Bluetooth module should face outward, and no copper should be laid under the antenna.
4. Avoid right-angle wiring.
5. It is recommended to use T-shaped connection for power supply wiring.
6. If the crystal oscillator is low, it is best to ensure clearance and avoid wiring.
7. Add silk screen prompts appropriately.
Figure 8-1 Circuit plan
1. The RX of the serial port corresponds to the TX of the Bluetooth module, and the TX corresponds to the RX of the Bluetooth module. Be careful not to reverse it.
2. When connecting pressure sensors, pay attention to the connection method of the full bridge, and be careful not to reverse the order. If it is difficult to test by connecting four at a time, you can start testing from one pressure sensor first.
Designed by 开新男孩 (from OSHWHub)
Loading...
Do you need to add this project to the album?