Electronic pen design based on ARM and accelerometer
2026-04-06 06:48:26··#1
Abstract : This paper introduces different types of electronic pens, compares their advantages and disadvantages, and implements a wireless electronic pen design based on spatial acceleration calculation using the microcontroller ADuC7022, the three-axis low-level accelerometer MA7260Q, and the wireless USB interface chip CYRF6934. Keywords : ADuC7022, accelerometer, wireless USB, electronic pen. With the popularization of computers, electronic pens have developed rapidly as an emerging computer-computer interaction tool. Domestically, Hanvon has always been a leader in handwriting recognition, leading the development of electronic pens in China. Internationally, handwriting has been linked with office software, establishing the concept of digital ink. In June 2001, Ericsson announced the launch of the world's first digital pen—Chat2pen CHA-30. This product fully utilizes Bluetooth wireless technology and GPRS network to transmit handwritten text and interact with mobile phones, computers, and the Internet. Although its appearance and writing method are the same as an ordinary pen, Chatpen can "read" its position using a dot pattern that is almost invisible on ordinary paper. These messages can be sent digitally to consumers simultaneously on paper via Bluetooth and GPRS mobile phones. Users will find themselves no longer limited to text-based short messages or emails; they can send handwritten notes anytime via mobile phones, PCs, or PDAs using a Chatpen. Anything drawn or written can be transmitted instantly, making information processing more personalized and greatly simplifying the process of sending text messages by eliminating the need for letter input. As a key technology behind electronic pens, handwriting recognition has always been a focus of research. Generally, electronic pens can be divided into four categories based on their positioning methods: radio frequency (RF) positioning, image recognition, pressure-sensitive positioning, and acceleration positioning. RF positioning electronic pens require a sound wave generator placed near the writing surface or writing board. The ultrasonic waves emitted by the generator complete the three-dimensional positioning of the pen strokes, offering high accuracy but with complex structures and algorithms. Image recognition electronic pens use image recognition algorithms to recognize handwriting scanned by a miniature camera placed in the pen tip, resulting in handwriting that most closely resembles the original. Pressure-sensitive electronic pens require a pressure-sensitive plate to sense the pressure of the pen tip and bend back into the shape of a note. Accelerometer-based electronic pens utilize kinematic algorithms to calculate the pen tip's trajectory through acceleration calculations. Combined with handwriting analysis algorithms, this allows for handwriting reproduction, resulting in a simple structure and ease of implementation. However, due to limitations in sensor resolution, mature products of this type have not yet been available on the market. This solution employs Freescale Semiconductor's MMA7260Q three-axis low-level accelerometer sensor to achieve spatial positioning of the pen strokes. A wireless USB device provides plug-and-play connectivity for the electronic pen. This electronic pen uses Cypress's 2.4GHz RF SoC CYRF6934 as a wireless USB network transceiver. Simply connect the Cypress Encore2 wireless USB bridge to the PC's USB port, and the electronic pen can perform unidirectional data transmission to the PC. 1 Hardware Planning In this design, the MMA7260Q is used to measure the pen's acceleration along the X, Y, and Z axes, allowing the software to calculate the pen tip's position in real time and generate handwriting. After acquiring the signal output from the accelerometer, the ADuC7022 microcontroller uses its on-chip ADC to convert the voltage signal into acceleration data and performs signal AND processing. Finally, it sends the data to the CYRF6934 wireless USB interface chip via the SPI interface for transmission to the PC for post-processing. The system is powered by a high-energy lithium battery. To maximize battery life, all chips operate at 3.3V to reduce switching losses. When the microcontroller detects that the electronic pen is stationary, the microcontroller software puts the wireless USB interface chip into sleep mode to further reduce power consumption. The ADuC7022 is a new generation precision analog microcontroller from Analog Devices (ADI) based on the ARM7TDMI 32-bit RISC core. It integrates a 10-channel 12-bit ADC (1MSPS), a voltage comparator, 62Kbytes of FlashROM, and 8Kbytes of SRAM, with a maximum processing power of 40MIPS. Its analog peripherals include a precision analog-to-digital converter (ADC) with up to 10 channels, a sampling rate of 1MSPS, and a 12-bit resolution, and a precision bandgap reference voltage source with a temperature drift better than 10ppm/℃. Other peripherals include an on-chip programmable logic array (PLA), synchronous and asynchronous serial interfaces, etc. Its on-chip PLL circuitry allows the use of a lower-frequency external crystal oscillator to reduce system EMI. Serial interfaces include UART, SPI, and two I2C ports, a JTAG port for download/debugging, four timers, and 14 general-purpose I/O pins. The CPU clock is up to 45MHz, with an on-chip crystal oscillator and on-chip PLL. The ADuC7022 operates from 2.7V to 3.6V and consumes only 40mA of current at its highest operating frequency of 41.78MHz. Furthermore, the ADuC7022's 40-pin 6mm×6mm LFCSP package significantly reduces board size, making it more suitable than most microcontrollers for systems with stringent size and power consumption requirements. In this design, the ADuC7022 ADC operates in single-ended mode. ADC0-ADC2 of the ADC module are connected to the three-axis accelerometer output pins of the MMA7260Q. ADC2 is connected to the positive terminal of the battery to monitor the input battery voltage. An LED illuminates to remind the user to replace the battery when the battery voltage drops close to the minimum input voltage of the LDO. The microcontroller's P0.0 and P0.1 pins are connected to the MMA7260Q's SEL1 and SEL2 pins as control signals for acceleration sensitivity. The ADuC7022's serial interface provides SPI, UART, and I2C interfaces. The ADuC7022's I/O ports are multiplexed interfaces; the user can select from GPIO, UART, UART/SPI/I2C, and programmable logic arrays by configuring the SPM module's control registers. This hardware uses an SPI module operating in Master mode, connected to a wireless USB module. The microcontroller's schematic is shown in Figure 1. The MMA7260Q accelerometer is a single-chip triaxial low-level accelerometer from Freescale Semiconductor, capable of accurately measuring low-level descent, tilt, displacement, positioning, impact, and vibration errors in the X, Y, and Z directions. By selecting the sensitivity of the MMA7260Q, it can be designed to handle gravitational accelerations in different orders of magnitude (1.5g, 2g, 4g, and 6g). Manufactured using MEMS technology, the MMA7260Q integrates an accelerometer, low-pass filter, temperature compensation, and other signal conditioning circuitry within a compact 6mm × 6mm × 1.45mm package, and features a preset 0g bias across the entire scale. Its small package size requires minimal board space. Furthermore, the MMA7260Q can operate at a low voltage of 2.2V–3.6V, consumes only 500µA of current during operation, and features a 3μA sleep mode and a 1.0ms fast power response. It also offers fast start and sleep modes. These features greatly extend the battery life of the electronic pen and allow sufficient space for appearance design. SEL1 and SEL2 are sensitivity selection input pins, and the truth table of the corresponding sensitivity is shown in Table 1. The output voltage VOUT of the accelerometer is: [align=center] [/align] Where, VOFFSET is the 0 acceleration bias, ΔV/ΔG is the acceleration sensitivity, 1G is the Earth's gravity, and θ is the tilt angle. Xout, Yout, and Zout are the output pins of the acceleration signals in the X, Y, and Z directions, respectively, and the relationship between the output voltage and the acceleration is shown in equation (1). The 0g bias voltage of the MMA7260Q is 1.65V. For a sensitivity of 1.5g, the output voltage of each axis is between 0.85V and 2.45V. The accelerometer circuit is shown in Figure 2. An RC filter is set on the output of the MMA7260Q to filter out the interference of the internal switching filter capacitor clock and improve the measurement accuracy. 4. The CYRF6934 is a 2.4GHz RF SoC wireless USB network transceiver from Cypress Semiconductor. Operating in the 2.4–2.483GHz ISM common band, this transceiver overcomes various limitations common to many systems at 27MHz, 400MHz, and 900MHz, enabling users to adopt their solutions globally without being constrained by regional frequency requirements. This provides global versatility, reasonable power specifications, and higher communication bandwidth. Utilizing DSSS technology, the CYRF6934 avoids signal interference from other systems such as 802.11b and Bluetooth in the 2.4GHz band, as well as wireless radiation from cordless phones and microwave ovens. The CYRF6934 operates from 1.8 to 3.6V, with an effective range of 10 meters. It features an SPI microcontroller interface with a data throughput of 62.5kbps and a transmission frequency of up to 2MHz for communication with the microcontroller, enabling bidirectional or unidirectional RF transmission at 62.5kbps with an average latency of less than 10ms. When there is no data transmission, the CYRF6934 can enter a low-power mode under the control of the microcontroller, reducing system power consumption. The wireless USB interface circuit is shown in Figure 3. The acceleration data collected by the microcontroller is preprocessed and sent to the CYRF6934 via the SPI interface. The CYRF6934 modulates the data and sends it to the wireless USB bridge on the PC via the printed antenna on the PCB. A 0.1uF capacitor is used for decoupling on all VCCs of the chip, and a 10uF capacitor is used as the charging and discharging capacitor. 5 Software Design As the underlying hardware driver, the software needs to complete system initialization, data acquisition and processing, and transmission. System initialization mainly includes the initialization of the microprocessor's stack, queue, and internal control registers, the selection of the MMA7260Q acceleration sensitivity, and the initialization of the CYRF6934 control registers. Assembly language completes the initialization of the microprocessor stack and queue and guides the system to execute the main() function in C language. After completing the remaining initialization tasks, the C language program begins a loop of data acquisition, data processing, and data transmission. In addition to using the accelerometer solution based on the MMA7269Q sensor, the software design also utilizes various components provided in the MMA7260Q design and development tools. Development is tailored to specific requirements to improve software and hardware efficiency and minimize system instability caused by software conflicts. Simultaneously, the KIT3109MMA7260Q hardware environment is used to complete the development, testing, and comprehensive evaluation of the MMA7269Q, accelerating product development. The software flowchart is shown in Figure 4. After completing the driver design, the application needs to use some dedicated API functions of the Windows operating system when accessing the driver. Since these functions have many parameters, a dynamic link library can be developed, allowing users to operate the hardware like ordinary API functions without needing to access the underlying driver device. The overall system structure is shown in Figure 5. Using this layered structure, user programs can read and write devices through the DLL. The interface functions provided by the DLL to the application include initializing the device, closing the device, and reading and writing ports. Thus, after adding their own dynamic link library to the application, inPortb and outPortb can be used to operate the ports. Due to the vast application and market prospects of electronic pens, major manufacturers worldwide are vying to develop and launch new products with their own unique features. This design organically combines the advantages of wireless communication with a traditional USB interface, providing not only a high data transfer rate but also improved data access methods. Simultaneously, the MMA7260Q three-axis low-level accelerometer and the SoC CYRF6934 wireless USB transceiver, with their excellent performance and low cost, can meet the needs of non-network terminals in the wireless field, making the transmission system more convenient and reliable. This electronic pen, without changing the traditional pen-paper communication method, enables natural handwriting input on ordinary paper (or any medium), surpassing the keyboard, like providing people with a golden key to unlock a new era of information. It combines an accelerometer structure with a wireless network, possessing numerous advantages such as simple structure, reliable operation, convenient data transmission, and plug-and-play functionality. The widespread application of this electronic pen will undoubtedly become a powerful assistant in promoting social informatization and a tool for facilitating office automation, realizing, to a certain extent, the ability to write on computers and mobile phones simultaneously, and securing a place in the market. References [1] Analog Semiconductor. Precision analog microcontroller 12-bit analog I/O, ARM7TDMI MCU Rev A. 2006. [2] Freescale Semiconductor. ±1.5g-6g Three axis low-g micromachined accelerometer. 2006, 2. [3] Cypress Semiconductor. WirelessUSBTM LS 1-way hid networks. 2003, 8. [4] Cypress Semiconductor. WirelessUSB LR 2.4GHz DSSS radio soc. 2005, 3. [5] Cypress Semiconductor. WirelessUSBTM dual antenna design layout guidelines. 2005, 3.