Design of Digital Electronic Scale Based on ATmega16 Single Chip Computer

With the continuous development of Electronic technology and automated measurement technology, traditional weighing systems have been unable to meet people’s needs in terms of function, accuracy, and cost-effectiveness, especially in terms of intelligence, portability, and measurement of small quality. In recent years, the emergence of new single-chip microcomputers and the development of integrated circuit technology have provided conditions for updating product designs and developing cost-effective weighing controllers. This design uses AVR single-chip microcomputer as the control core, combined with the resistance strain pressure sensor and the corresponding signal acquisition circuit, to design a new type of high-precision, multi-functional, and low-cost electronic scale.

With the continuous development of electronic technology and automated measurement technology, traditional weighing systems have been unable to meet people’s needs in terms of function, accuracy, and cost-effectiveness, especially in terms of intelligence, portability, and measurement of small quality. In recent years, the emergence of new single-chip microcomputers and the development of integrated circuit technology have provided conditions for updating product designs and developing cost-effective weighing controllers. This design uses AVR single-chip microcomputer as the control core, combined with the resistance strain pressure sensor and the corresponding signal acquisition circuit, to design a new type of high-precision, multi-functional, and low-cost electronic scale.

1 System overall design

First, the load cell collects the voltage signal generated by the pressure change, converts the analog signal into a digital signal through an A/D converter, and sends the digital signal to the AVR single-chip microcomputer. After the single-chip microcomputer performs corresponding processing, the data of the current weight of the object is obtained. , And Display it through the LCD. The system hardware structure is shown as in Fig. 1.
 

Design of Digital Electronic Scale Based on ATmega16 Single Chip Computer

The system hardware circuit includes A/D conversion module, 4×4 matrix keyboard module, LCD module and buzzer alarm module; the software module can be divided into main program module, matrix keyboard scanning module, A/D conversion module and LCD1602 module.

2 System hardware design

2.1 AVR microcontroller

This design is to select ATmega16 in the AVR series single-chip microcomputer as the microcontroller. ATmega16 is a low-power 8-bit CMOS microcontroller based on the enhanced AVR RISC structure. Due to its advanced instruction set and single clock cycle instruction execution time, ATmega16L has a data throughput of up to 1MIPS/MHz, and integrates 16kB of programmable FLASH, 512B of E2PROM, and 1kB of on-chip SDRAM on-chip. In terms of peripherals, it has two programmable serial UARTs, 8-channel 10-bit ADC, four-channel PWM, and supports SPI, TWI, and JTAG interfaces, allowing ATmega16L and other peripherals to carry out high-speed data transmission.

2.2 Load cell

Resistance strain gauge load cell is a kind of sensor that converts force (weight) into electrical signals by pasting resistance strain gauges on elastic sensitive elements, and then forming a bridge in an appropriate manner. In the resistance strain type load cell, the change in resistance is converted into a voltage change through a bridge circuit. The working principle of resistance strain type load cell is shown in Figure 2.
 

Design of Digital Electronic Scale Based on ATmega16 Single Chip Computer

This design uses the SB-B cantilever load cell from Hunan Aerospace Company, with a rated range of 5kg, a sensitivity of 3mv/V, a non-linear error of 0.03%ES, a repeatability error of 0.02%ES, and a creep (30 minutes) of 0.03%. FS, zero temperature drift 0.03%FS/10℃, temperature compensation range -10~60℃. This series of sensors adopts a cantilever single shear structure with strong overload capacity and good self-alignment after force. It has the characteristics of high precision, good long-term stability, fatigue resistance and strong anti-eccentric load ability.

2.3 High-precision A/D conversion

The load cell outputs a mV-level voltage signal, and this design uses AD7705 to collect the signal. AD7705 is a 16-bit A/D conversion chip based on ∑-△ conversion technology launched by AD company. It has the characteristics of high resolution, wide dynamic range, self-calibration, excellent anti-noise performance, low voltage and low power consumption. , Suitable for the needs of microcomputer signal processing in the weighing system. It has a programmable gain amplifier with a gain range of 1 to 128. It can be directly connected to a pressure sensor. It uses a synchronous serial SPI interface and can be directly connected to the hardware SPI interface of the AVR microcontroller. The circuit connection diagram is shown in Figure 3.
  

Design of Digital Electronic Scale Based on ATmega16 Single Chip Computer

When the sensor adds a full-scale weight of 5kg, the sensor obtains an output voltage of 15mV at a working voltage of 5V. The 5V working voltage provides the reference voltage for the AD7705 after being divided, so the change of the working voltage will not produce system error. The voltage divider resistance is 24kΩ and 15kΩ, and the generated reference voltage is 1.92V. When the programmable gain of the device is 128, the corresponding full-scale input voltage is 15mV.

2.4 Human-machine communication

Human-machine communication includes three parts: keyboard scanning, LCD, and buzzer alarm. The keyboard adopts 4×4 matrix scanning keyboard, which is connected to the PC port of the single-chip microcomputer; the Display part adopts LCD1602 liquid crystal, which can display 16×2 or 32 at the same time. character. The character generation memory (CGROM) inside the 1602 liquid crystal module has stored 160 different dot matrix character graphics. When programming, you can use AS-CII code to assign values ​​directly, or you can use character constants or variables to assign values; the function of the buzzer is When the weighing item exceeds the range of the sensor, an alarm will sound to remind the user.

3 System software design

The system software development platform is WinAVR, and the development language is C language. In order to facilitate program debugging and improve reliability, the program design adopts a top-down, modular, and structured program design method. The program divided into task modules in this design mainly includes initialization program, main program, A/D conversion subprogram, LCD display subprogram, and keyboard scanning subprogram.

When the system is working, it is divided into initial interface mode and weighing mode, and a flag can be set to change and judge. In the initial interface, the first line of the LCD screen displays “Place object!”, prompting the user to place the item to be weighed on the electronic scale; the second line displays “PrICe:”, prompting the user to enter the unit price of the item.

Then the system enters the keyboard scanning state. When the corresponding weighing button is pressed, the single-chip microcomputer controls the AD7705 to perform AD conversion, and the result obtained is processed and displayed on the LCD. The display includes the weight and total price of the item, and the weighing accuracy is 1g. In this way, the real-time measurement of the item is completed in a continuous loop. The main program flow chart is shown as in Fig. 5.

Design of Digital Electronic Scale Based on ATmega16 Single Chip Computer

4 Conclusion

The article proposes a design of a digital electronic scale based on the ATmega16 single-chip microcomputer, which makes full use of the powerful control ability of the AVR single-chip microcomputer. It achieves high-precision weight measurement through a load cell and a 16-bit AD7705 converter. It has low cost, Features such as strong stability and simple circuit. The system has obtained satisfactory results in the actual application of electronic scales.

The Links:   DSEI2X61-12A 6MBP160RUA060-01

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *