Editor Version ×
recommended

Pro Edition

free

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

Std Edition

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

Completed

PRO MakerLab Smart Weight Scale

Smart Weight Scale

Project tags

License

GPL 3.0

License: GPL 3.0

Mode:

Mode

Editors' pick

Editors' pick

  • 15
  • 0
  • 0
Update time: 2024-11-06 02:47:25
Creation time: 2024-11-05 03:10:19
Description

Description

1. Project Introduction

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;

 

2. Onboard Resources

Ilb62hGrLhWwSTJuae90kvXOuc84arKj6gxNFwUN.png

Figure 1-1 3D diagram of smart scale circuit

QQfo7UFsfxFJTEmp02A8saiJav9M8Le5fov0jFpn.png

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

 

3. Design principles

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.

 

4. Circuit Analysis

fZJGDqg7vXafWpOVASIIt8a5W6GNXKKmi605HkME.png

Figure 4-1 Overall schematic diagram of smart electronic scale

4.1. Power circuit

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.

EcnezKpwziN4s7zEX6oqwSxWzdgY9MClNZJqpMoL.png

Figure 4-2 Intelligent electronic scale power supply circuit

4.2. Main control 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.

mqvUlmJBBhPeIwKqdzf6w3uv9tLh5v71qQvi9Mpc.png

Figure 4-3 Smart electronic scale main control circuit

4.3 Crystal oscillator 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.

sau5Zjw12HskLMtMUAWiCDGONKjvy0JrL7srEv7n.png

Figure 4-4 Intelligent electronic scale crystal oscillator circuit

4.4 Weighing 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.

gEcofIxoJqALaiF3c017nxX7NsnSA7NdexnQChVv.png

Figure 4-5 Intelligent electronic scale weighing circuit

mBjcZNaEkKpA0hftDeWbutwixnJqQHc40OZ2YhQp.png

Figure 4-6 Pressure sensor connection circuit diagram

4.5 Voltage stabilizing circuit

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 .

C7buJVf94dXZPU2ffJ8HNe2Ss21K3D7ZUQWmyhPb.png

Figure 4-7 Voltage stabilization circuit

4.6 Communication 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.

1ABqAUIITE012Uony7fcGHAaC4zrDfL2jXYHPqTL.png

Figure 4-8 Bluetooth circuit

4.7 Reset 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.

tk30RCqWPNLkUqnIpiAu0UminhM9klL79KufRd0E.png

Figure 4-9 Reset circuit

4.8 OLED display interface

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.

fVg1dMEWtoIJ0zk7Nylaba0dJoX57gqMoXm96SWj.png

Figure 4-10 OLED display interface

 

5. Embedded Software Analysis

5.1 Clock configuration

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.

1auD27whxofiii8z7ELvvRzoMQirIhaKwHQWL8Xd.png

Figure 5-1 Clock tree

5.2 Core code analysis

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.

dvLyYzBkCMZpaYVMqI3uL7nqng8BDaUsDUzhiBHS.png

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.

wvlYfGbGc6UqYQIH0EMu1V7u7ez5esX0eOY5K92N.png

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.

jYh63aG6juldIvWnaYW8pQWF7LS0HkV1TecvvPoB.png

Figure 5-4 Mold taking software interface

TVzIMkX2590ccsINnLSUhpELvo3srQPdL0DFwcaR.png

 

Figure 5-5 Modulus values ​​of some strings

 

6. Mobile Phone Software Analysis

6.1 Software page introduction         

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.

dAryyWc5LVn5a92rqljCr8zdEEPtrpauJUBd42Af.png

 

Figure 6-1 Mobile software interface

6.2 Introduction to applet code structure

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

gz0xOrdAVQmxLrq870hLjvwAuuf5fAeU2sctyM7c.png

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.

5KzEMDoBTkVYOVMoaqDlR7QCl3ALQgAzextbZsgd.jpeg

Figure 6-3 Communication debugging page

 

7. Physical Display

etpDbMZZY6Ex71tDzn1R4VUkGxDTltMRYvjG6Pfc.png

Figure 7-1 Front view of smart scale

G1dIZkVv1K3j8nv0IZOYpABQIDHJiQhervmKxEFf.png

Figure 7-2 Circuit diagram on the back of the smart scale

 

8. Precautions

8.1 Precautions for drawing circuit schematic diagram

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.

8.2 Things to note when wiring

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.

m9ToJFFAosH2PuuGwna3ixOVO25aEQmteL31Ui3s.png

Figure 8-1 Circuit plan

8.3 Debugging considerations

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)

Link:https://oshwhub.com/qgwww/zhi-neng-ti-zhong-cheng

Design Drawing

Design Drawing

schematic diagram
1 /
PCB
1 /
The preview image was not generated, please save it again in the editor.
Empty
Project Attachments

Project Attachments

Project Members

Project Members

Target complaint
Related Projects
Change a batch
Loading...

Comment

Add to album ×

Loading...

reminder ×

Do you need to add this project to the album?

服务时间

周一至周五 9:00~18:00
  • 0755 - 2382 4495
  • 153 6159 2675

服务时间

周一至周五 9:00~18:00
  • 立创EDA微信号

    easyeda

  • QQ交流群

    664186054

  • 立创EDA公众号

    lceda-cn