Design of Piezoelectric Ceramic Driver Based on Serial Communication

Publisher:runaway2000Latest update time:2013-01-22 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Due to its wonderful piezoelectric effect, piezoelectric ceramics are used by scientists in fields closely related to people's lives to achieve functions such as energy conversion, sensing, and driving. The deformation of piezoelectric ceramics under the action of an electric field is very small, and at most does not exceed one ten-millionth of its own size. This tiny change can be used to make a precise control mechanism - a piezoelectric driver, which plays a huge role in the control of precision instruments and machinery. Piezoelectric drivers have high displacement resolution and anti-interference ability, and the control method is simple. They are very suitable for micro-displacement driving and have been widely used in defense, biomedicine, optoelectronics and many other fields [1-2]. The voltage on piezoelectric ceramics can be adjusted manually or by computer control. With the application of high-performance D/A chips, computer control has become more precise. Communication between computers and external circuits (including single-chip microcomputers) can be achieved through serial ports. Due to the characteristics of serial communication [3], such as high efficiency, reliability, low price, and compliance with unified standards, serial communication has always occupied an extremely important position in the field of system control [4-5]. Visual Basic 6.0 provides serial communication controls that can easily realize serial port data exchange. This article introduces the design of piezoelectric ceramic driver through serial communication between PC and microcontroller, in which the computer is the upper computer and the microcontroller is the lower computer.

    1 Hardware Basics

    Figure 1 shows the block diagram of the system. Because the working levels of the serial ports of the upper and lower computers are inconsistent, the TTL level is converted to RS232 level through the MAX232 chip. The microcontroller selected is ATMEL's reduced instruction set microcontroller ATmega16. This microcontroller has low power consumption, only 1.1 mA in normal mode, and the highest operating frequency can reach 16 MHz. It has a rewritable 16 KB programmable Flash. Its internal USART is a highly flexible serial communication device and is very convenient to use. The D/A chip uses ANALOG's 12-bit resolution AD5344. AD5344 has a parallel input interface, requires few control lines, and has double buffer input logic. One AD5344 has 4 outputs. The computer sends data to the microcontroller through the serial port. The microcontroller places the received data in the internal SRAM. After receiving the data, it takes out the data and outputs it to the D/A through the data port. The analog output signal (voltage) of the D/A is used to control the piezoelectric ceramics.

2 Host computer program design
 The host computer program is written in the programming environment of Visual Basic 6.0. Using the MSComm communication control of Visual Basic6.0, it is very easy to realize serial communication. When using it, the information format and protocol of serial communication must be set. Each communication control corresponds to a serial port. If you want to access multiple communication ports, you need to design multiple communication controls.
2.1 Program flow and interface design
 The communication between the computer and the single-chip microcomputer adopts the query working method. The computer is the host computer (host) and the single-chip microcomputer is the slave computer (slave). The host computer is mainly responsible for sending control commands, as well as sending, receiving, processing, calculating, and displaying data. The host computer program is divided into four parts: interface design, program initialization, data communication, and data processing. The program flow is shown in Figure 2.

 The main program interface is mainly divided into a data input box and a command control button. The input box is used to input the value of the voltage provided to the piezoelectric ceramic, and the command control button is used to send and receive commands and data. The interface also places a text box to display the communication status. The program interface is shown in Figure 3.
 The "Set" button in Figure 3 is used to send the voltage value (CH1~CH4) in the text box to the microcontroller through the serial port, and the microcontroller then transmits the data to the analog-to-digital converter . The "Clear" button is used to set all output data to zero.

 

 

2.2 Program code
 The specific program code includes the initialization of the serial port and the sending and receiving of data. The initialization code of the serial port is as follows:
MSComm1.CommPort=1; Use COM1 serial
portMSComm1.Settings="9600, n, 8, 1"; Data format: baud rate 9 600 b/s, no parity check, 8-bit data, 1 stop
bitMSComm1.OutBufferCount=0; Clear the send bufferMSComm1.InBufferCount
=0; Clear the receive bufferMSComm1.PortOpen
=True; Open the serial
portMSComm1.InputMode=1; Retrieve data in binary formMSComm1.InputLen
=0; Read all data in the buffer at one time
 Due to space limitations, the code for the data sending and receiving parts is no longer given.
3 Communication program design of the lower computer
 The lower computer program includes the initialization part, the data receiving part and the data output part.
The USART inside Atmega16 is a highly flexible serial communication device, which is very convenient to use. The baud rate generator of the microcontroller serial communication can be generated by its internal clock. The baud rate register UBRR is used to set the required baud rate. The calculation formula for the asynchronous normal mode baud rate is BAUD=fosc/16(UBRR+1). For a baud rate of 9 600 b/s (consistent with the host computer), when fosc=8 MHz, the value of UBRR is 51. The data transmission format is: 1 start bit, 8 data bits, and 1 stop bit. The program flow is shown in Figure 4.

 The initialization part of the program code is as follows:
ldi r16, 0x20
out UCSRA, r16; set the serial communication mode
ldi r17,     0x00
out UBRRH, r17
ldi r16, 0x33  
out UBRRL, r16; set the baud rate of the serial communication
ldi r16, 0x86    
out UCSRC, r16; set the data format of the serial communication
ldi r16, 0x18
out UCSRB, r16; enable serial communication
 The other parts of the code are too long to be listed here.
The piezoelectric ceramic driver is designed based on serial communication. The serial communication control provided by Visual Basic 6.0 can easily realize the exchange of serial port data. The system has a short development cycle and high efficiency, and the debugging of the serial communication program can be assisted by many tool software (such as the serial port debugging assistant), so there are many advantages to using serial communication. Although some computer motherboards do not have serial interfaces (such as laptops) and are replaced by USB interfaces, serial communication can also be used. The method is to use the USB to serial port method. The hardware requires an adapter cable and the driver must be installed when using it. The serial port number is automatically assigned by Windows, that is, the system virtualizes a serial port, and the usage of this port is exactly the same as the real serial port.
References
[1] Chen Xiutao, Hou Zaihong, Tan Fengfu, et al. A target precision tracking system based on piezoelectric ceramics [J]. Microcomputer Information, 2010, 26(8-1): 32-33.
[2] Zhu Huazheng, Fan Dapeng, Zhang Zhiyong, et al. Development of precision optical path deflection and focal length adjustment mechanism [J]. Laser and Infrared, 2009, 39(10): 1028-1032.
[3] Li Zhaoqing, Han Tao. Serial port technology [M]. Beijing: National Defense Industry Press, 2004.
[4] Wu Aiping. Design of temperature measurement and control system based on VB and single chip microcomputer [J]. Modern Electronic Technology, 2010(8): 208-210.
[5] Wang Ping, Zhang Xindong. Design of data acquisition system based on intelligent instrument [J]. Automation and Instrumentation, 2009(4): 9-10.

Reference address:Design of Piezoelectric Ceramic Driver Based on Serial Communication

Previous article:LED driver power performance design requirements
Next article:Solutions to Insufficient IC Driving Current in Power Supply Design

Recommended ReadingLatest update time:2024-11-16 18:09

IAR Systems updates Visual Studio Code extension
IAR Systems updates Visual Studio Code extension The much-loved IAR Visual Studio Code extension for code building and debugging further simplifies embedded development workflows with its latest version 1.20 Uppsala, Sweden - December 7, 2022 - IAR Systems, the global leader in embedded development software and s
[Embedded]
IAR Systems updates Visual Studio Code extension
Latest Power Management Articles
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号