Design of digital electronic scale based on ATmega16 single chip microcomputer

Publisher:快乐微笑Latest update time:2012-10-15 Source: 21ic Keywords:ATmega16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

With the continuous development of electronic technology and automated measurement technology, traditional weighing systems can no longer meet people's needs in terms of function, accuracy, cost performance, etc., especially in terms of intelligence, portability, and measurement of tiny masses. In recent years, the emergence of new single-chip microcomputers and the development of integrated circuit technology have provided conditions for updating product design and developing cost-effective weighing controllers. This design uses an AVR single-chip microcomputer as the control core, combined with a resistive strain gauge pressure sensor and a corresponding signal acquisition circuit, to design a new type of electronic scale with high precision, multi-function and low cost.

1 Overall system design

First, the weighing sensor collects the voltage signal generated by the pressure change, converts the analog signal into a digital signal through the A/D converter, and sends the digital signal to the AVR microcontroller. After the microcontroller does the corresponding processing, it obtains the current object weight data and displays it on the LCD. The system hardware structure is shown in Figure 1.

System hardware structure

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 uses ATmega16 from the AVR series of microcontrollers 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, the data throughput of ATmega16L is as high as 1MIPS/MHz. It integrates 16kB of programmable FLASH, 512B of E2PROM, and 1kB of on-chip SDRAM. In terms of peripherals, it has two programmable serial UARTs, 8-way 10-bit ADC, four-channel PWM, and supports SPI, TWI, and JTAG interfaces, allowing ATmega16L and other peripherals to perform high-speed data transmission.

2.2 Load Cell

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

Working principle of resistance strain gauge load cell

This design uses the SB-B cantilever weighing sensor of Hunan Aerospace Company, with a rated range of 5kg, sensitivity of 3mv/V, nonlinear error of 0.03%ES, repeatability error of 0.02%ES, creep (30 minutes) of 0.03%FS, zero temperature drift of 0.03%FS/10℃, and temperature compensation range of -10~60℃. This series of sensors adopts a cantilever single shear structure, has strong overload capacity, good automatic centering after force, and has the characteristics of high precision, good long-term stability, anti-fatigue and strong anti-eccentricity.

2.3 High-precision A/D conversion

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

Circuit connection diagram

When the sensor is loaded with a full-scale weight of 5kg, the sensor obtains an output voltage of 15mV at an operating voltage of 5V. The 5V operating voltage is divided to provide a reference voltage for the AD7705, so changes in the operating voltage will not cause system errors. The voltage divider resistors are 24kΩ and 15kΩ, and the generated reference voltage is 1.92V. When the device's programmable gain is 128, the corresponding full-scale input voltage is 15mV. [page]

2.4 Human-computer communication

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

Human-computer communication

3 System Software Design

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

The system is divided into initial interface mode and weighing mode when working, and a flag can be set for change and judgment. In the initial interface, the first line of the LCD screen displays "Place object!", prompting the user to place the object to be weighed on the electronic scale; the second line displays "Price:", prompting the user to enter the unit price of the object.

Then the system enters the keyboard scanning state. When the corresponding weighing button is pressed, the single chip controls AD7705 to perform AD conversion, and the result 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 cycle. The main program flow chart is shown in Figure 5.

Main program flow chart

4 Conclusion

This paper proposes a design of a digital electronic scale based on ATmega16 microcontroller, which gives full play to the powerful control ability of AVR microcontroller, realizes high-precision measurement of weight through weighing sensor and 16-bit AD7705 converter, and has the characteristics of low cost, strong stability and simple circuit. The system has achieved satisfactory results in the actual application of electronic scale.

Keywords:ATmega16 Reference address:Design of digital electronic scale based on ATmega16 single chip microcomputer

Previous article:Special IC decryption technology--AVR application skills
Next article:AVR MCU Course Design Program

Recommended ReadingLatest update time:2024-11-16 21:31

Atmega16 serial communication usage
//The following program experience can be used, MCU: M16, crystal: 8M, directly use the male connector (needle) on the USB to serial port cable, //The second pin (RXD) is connected to the PD1 port (15-pin TXD) on M16, and the third pin (TXD) is connected to the PD0 port (14-pin RXD) on M16. //Pin 5 is grounded. At th
[Microcontroller]
ATmega16 Idle Mode
When SM2..0 is 000, the SLEEP instruction will put the MCU into idle mode. In this mode, the CPU stops running, while the LCD controller, SPI, USART, analog comparator, ADC, USI, timer/counter, watchdog and interrupt system continue to work. This sleep mode only stops clkCPU and clkFLASH, while other clocks continue t
[Microcontroller]
Introduction to Atmega16 MCU serial port communication and external interrupt
1. Serial communication The ATmega16 microcontroller has a full-duplex universal synchronous/asynchronous serial transceiver module USART, which is a highly flexible serial communication device. Its main features are as follows: Full-duplex operation, capable of sending and receiving at the same time; Support sync
[Microcontroller]
Using ATmega16 to create a unique password safe: integrated use of LCD and keypad
  After mastering the control and display of LCD , we need to integrate LCD into the password safe to make it an independent working system. In the CD of this issue, there is the source program of using ATmega16 to control LCD screen in the previous issue. Copy IC d.c and lod.H to the directory of the routine psmanage
[Microcontroller]
Using ATmega16 to create a unique password safe: integrated use of LCD and keypad
ATmega16 Clock Source
The ATmega16 chip has the following clock sources that are selected by Flash fuses: The clock is input to the AVR clock generator and then distributed to the corresponding modules. The different clock options are described in the following sections. When the CPU wakes up from power-down or power-save mode, the selec
[Microcontroller]
ATmega16 Clock Source
Design and research of portable locomotive signal generator based on ATmega16
Abstract: The portable locomotive speed signal generator can simulate the locomotive running parameters and accurately output the speed change signal, which is convenient for maintenance staff to timely check the fault point and improve the maintenance efficiency. The device adopts a handheld structure, and mainly int
[Microcontroller]
Design and research of portable locomotive signal generator based on ATmega16
ATmega16 I/O Memory
The definition of ATmega16's I/O space is shown in "Register Overview" on page 318. All ATmega16 I/O and peripherals are placed in the I/O space. All I/O locations can be accessed through the IN and OUT instructions to transfer data between the 32 general working registers and the I/O. I/O registers with addresses 0x
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号