Electronic scale weighing system design, HX711 pressure sensor, 51 single-chip microcomputer (Proteus simulation, C program, schematic diagram, paper, etc.)

Design requirements
1. The system can realize the basic weighing function of the electronic scale (the weighing range is 0~10Kg, and the weight error is not more than ±0.005Kg);
2. The system should have the functions of inputting unit price on the keyboard, displaying the weight, and calculating the total price;
3. The unit price and total price amount are yuan, the maximum value is 999.99 yuan, and the amount error is not more than 0.01 yuan;
4. When the system exceeds the maximum measurement range of 10Kg, it has an alarm indication function (buzzer, LED light alarm prompt) 5. The
electronic scale is designed with both tare function and weight calibration function;

Design overview The
electronic scale system is mainly composed of five major parts: the single-chip minimum system, the data acquisition system, the man-machine interface system, and the alarm system.

The minimum system of single-chip microcomputer mainly includes AT89C51 and classic reset circuit; the data acquisition part is composed of load cell, signal amplification and A/D conversion part, and the signal amplification and A/D conversion part are mainly realized by special high-precision 24-bit AD conversion chip HX711 .

The human-computer interaction interface is keyboard input and dot matrix liquid crystal display, mainly using 4*4 matrix keyboard and 1602 liquid crystal display, which can easily input data and display data intuitively; the alarm system is composed of buzzer and LED lights.
insert image description here
Simulation circuit diagram
insert image description here
insert image description here
Electronic scale schematic diagram
insert image description here
simulation results analysis
Open the Proteus simulation file, its suffix is ​​DSN. Double-click the MCU to load the main.hex file (located at: MCU loading file); then, double-click the HX711 chip to load the HX711.hex file (located at: HX711 module loading file).
insert image description here
Click the Run button in the lower left corner of the Proteus software to run the simulation. LCD1602 liquid crystal display: Welcom to Use Electronic Scale.
insert image description here
Immediately after a beep, the red LED lights up, and the LCD displays the weight, unit price and total price, all of which are 0. At this point, the system is in a state of waiting for the goods to be weighed.

The three parameters displayed by the LCD are: WE (Weight, abbreviation for weight), PR (Price, abbreviation for unit price) and MONEY (representing total price).
insert image description here
Press the 'weight+' or 'weight-' key to simulate the weighing of the goods, the weighing range is: 0~10Kg. If the weight is more than 10Kg, the overweight alarm, the buzzer sounds, the red LED flashes, and the LCD displays WE: -.–.
insert image description here
insert image description here
Enter the unit price (PR) through the matrix keyboard, the maximum input unit price is 99.9, you can enter a decimal point, and the unit price is set accurate to the angle. For example, to enter 5.4 yuan, enter the number key 5, the dot key and the number key 4.

After the unit price input is completed, the total price (MONEY) is automatically displayed, and the total price is accurate to one decimal place; the maximum total price is 999 yuan, if it is greater than this value, the LCD displays '-.–' to indicate that the display range is exceeded.
insert image description here
insert image description here
This simulation design has a calibration function. Through the two keys of 'calibration +' and 'calibration -', the weight of the goods displayed by the electronic scale can be calibrated in a small range (press once, the weight display changes by 0.001Kg). For example, calibrate the weight from 3.576Kg to 3.574Kg.
insert image description here
After the goods are weighed, click the 'Clear' button to clear the unit price and total price, and click the 'Tare' button to clear the weight display. Note that the tare button also has the function of clearing the weight display; then the next weighing can be performed.
insert image description here
Simulate tare function
First, press the 'weight+'/'weight-' key to simulate the weight of the basket or box. After the weight is set, press the 'tare' key, and the weight display will be reset to zero.

For example, press the 'weight +' key, set the basket weight to 1.083Kg, and then click the 'tare' key, the WE display will be cleared.
insert image description here
insert image description here
After peeling, press 'weight +' again to simulate the net weight of the goods 4.880Kg, and then enter the unit price of 3.0 yuan and the total price of 14.06 yuan.
insert image description here
Press the 'Tare' button again, at this time, WE displays the net weight of the goods plus the weight of the basket, and the total price also calculates the part of the basket, press the 'Tare' button again, and the weight is reset to zero.
insert image description here
Part of the C code

void main()
{
    
       
    
	init_eeprom();  //开始初始化保存的数据
	Init_LCD1602();									//初始化LCD1602
   EA = 0;
   Data_Init();
   Timer0_Init();
   //初中始化完成,开断
   EA = 1;
	
//	Get_Maopi();
	LCD1602_write_com(0x80);						//指针设置
   LCD1602_write_word(" Welcome To Use ");	//  
   LCD1602_write_com(0x80+0x40);						//指针设置
   LCD1602_write_word("Electronic Scale");
//   Delay_ms(2000);
   Get_Maopi();
   LCD1602_write_com(0x80);						//指针设置
   LCD1602_write_word("WE:0.000 PR:00.0");
   LCD1602_write_com(0x80+0x40);				//指针设置
   LCD1602_write_word("MONEY:  0.00    ");
   Display_Price();
//	Get_Maopi();				//称毛皮重量

	while(1)
	{
    
       
    
//每0.5秒称重一次
	  if (FlagTest==1)
		{
    
       
    
			Get_Weight();
			FlagTest = 0;
		}			
	  	
	  keycode = Getkeyboard();
	  //有效键值0-15
	  if (keycode<16)
	  {
    
       
    
		 KeyPress(keycode);
		 Buzzer=0;
		 Delay_ms(100);
		 Buzzer=1;
		 while(keycode<16)
		 {
    
       
    
			if(keycode==12||keycode==13)
			{
    
       
    
				Buzzer=0;
				 Delay_ms(10);
				 Buzzer=1;
				 KeyPress(keycode);
				 Get_Weight();
				 flag_key=1;
			}
			keycode = Getkeyboard();
		 }
		 write_eeprom();			   //保存数据
	  }
	}
}
//****************************************************
//称重
//****************************************************
void Get_Weight()
{
    
       
    
	Weight_Shiwu = HX711_Read();
	Weight_Shiwu = Weight_Shiwu - Weight_Maopi;		//获取净重
	
	Weight_Shiwu = (unsigned int)((float)Weight_Shiwu*10/GapValue)-qupi; 	//计算实物的实际重量																
	if(Weight_Shiwu > 10000)		//超重报警
	{
    
       
    
		Buzzer = !Buzzer;	
		LED=!LED;
		LCD1602_write_com(0x83);
	   LCD1602_write_word("-.---");
	}
	else
	{
    
       
    
		if(Weight_Shiwu==0)
		LED=1;
		else if(Weight_Shiwu>0)
		LED=0; 
		Buzzer = 1;
		Display_Weight();
		money = Weight_Shiwu*price/1000;  //money单位为分
	       //显示总金额
	       Display_Money();
	}
}

//****************************************************
//获取毛皮重量
//****************************************************
void Get_Maopi()
{
    
       
    
	unsigned char clear;
mm:	Weight_Maopi_0 = HX711_Read();
	for(clear=0;clear<10;clear++)
	{
    
       
    
		Buzzer=1;
		LED=1;
		Delay_ms(100);
		LED=0;
		Delay_ms(100);	
	}
	Weight_Maopi = HX711_Read();
	if(Weight_Maopi/GapValue!=Weight_Maopi_0/GapValue)
	goto mm;
	Buzzer=0;
	Delay_ms(500);
	Buzzer=1;
} 

The resources shared are
(1) The full version of the final thesis on the design of electronic scale system based on 51 single-chip microcomputer and HX711 pressure sensor;
(2) Proteus simulation file;
(3) Keil C program file;
(4) HX711 module information;
(5) Visio flow chart;
(6) Schematic diagram of electronic scale;
(7) List of electronic components;
(8) Translation of excellent literature;

The full set of resources is as follows
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
. The important things are said three times!

Important things said three times!

Important things said three times!

Obtain a complete set of materials such as electronic scale design graduation thesis, Proteus simulation, C program, schematic diagram, Visio flow chart, component list, HX711 module, etc.

Please search on WeChat and pay attention to the public number: Jiaoyuan Xiaozhi

Related Posts