On the Design of a Bluetooth Data Acquisition Card for the
Transcription
On the Design of a Bluetooth Data Acquisition Card for the
On the Design of a Bluetooth Data Acquisition Card for the Control of Manipulator Robots A. Donado, J. Castañeda-Camacho F. Reyes, G. Mino and G. Muñoz-Hernández. Facultad de Electrónica de la Benemérita Universidad Autónoma de Puebla. Puebla, Puebla, 72000, México. ABSTRACT A simple and successful design of a Bluetooth data acquisition card for the control of manipulator robots is presented. The integration of software through a program in Visual C# language and the use of a microcontroller PIC18F4550 embedded with a bluetooth module, give rise to a wireless data acquisition card with digital and analog inputs and outputs. This embedded system is applied to the control of a manipulator robot with three degrees of freedom. Keywords: Data acquisition card, manipulator robots and bluetooth. 1. INTRODUCTION Bluetooth wireless communication is a wireless LAN technology designed to operate in an environment of many users to connect devices with different functions such as telephones, computers, cameras, printers, etc [1]. A Bluetooth LAN is an ad hoc network that is formed spontaneously and provides support for three general application areas using short rage wireless connectivity. Data and voice access points. Bluetooth facilitates real-time voice and data transmissions by providing effortless wireless connection of portable and stationary communications devices. Cable replacement. Bluetooth eliminates the need for numerous, often proprietary, cable attachments for connection of practically and kind of communication device. Connections are instant and are maintained even when devices are not within line of sight. The range of each radio is approximately 10 m, but can be extended to 100 m with an optional amplifier. Ad hoc networking. A device equipped with a Bluetooth radio can establish instant connection to another Bluetooth radio as soon as it comes into range. The Bluetooth technology regulated by the protocol IEEE 802.15 is defined as a layered protocol architecture consisting of core protocols, cable replacement and telephony control protocols, and adopted protocols [1, 2]. The Bluetooth core protocols form a five-layer stack consisting of the following elements as it is shown in Fig. 1. The authors would like to thank the PROMEP project 103.5/08/3343 and anonymous reviewers for their valuable comments and suggestions that enhanced the quality of this work. Fig. 1. Bluetooth Stack Radio. Specifies details of the air interface, including frequency, the use of frequency hopping, modulation scheme, and transmit power. Baseband. Concerned with connection establishment within a piconet, addressing, packet format, timing and power control. Link manager protocol (LMP). Responsible for link setup between Bluetooth devices and ongoing link management. This includes security aspects such as authentication and encryption, plus the control and negotiation of baseband packet sizes. Logical link control and adaptation protocol (L2CAP). Adapts upper-layer protocols to the baseband layer. L2CAP provides both connectionless and connection-oriented services. Service discovery protocol (SDP). Device information, services and the characteristics of the services can be queried to enable the establishment of a connection between two or more Bluetooth devices. RFCOMM is the cable replacement protocol included in the Bluetooth specification. RFCOMM provides binary data transport and emulates EIA-232 control signals over the Bluetooth baseband layer. EIA-232 (formerly known as RS232) is a widely used serial port interface standard. In this work we design of a Bluetooth data acquisition card for the control of manipulator robots, concentrating on the RFCOMM protocol which is a radio frequency emulator oriented to a computer COM port, and the AT commands which are used for configuring Bluetooth devices [1- 3]. 2. DESIGN OF DATA ACQUISITION CARD (DAQ) The data acquisition card is designed through the module Parani ESD 1000 with 8 digital inputs, 8 digital outputs, 6 analog inputs and 2 analog outputs for pulse-width modulation (PWM). This includes USB interface, Bluetooth interface and dedicated lines for USB PIC boot loader, in circuit serial programming (ISCP). As we can see in Fig. 2, the core of the card is the PIC18F4550 microcontroller [4-6]. Fig. 2. Block Diagram of the DAQ This family of devices offers the advantages of all PIC18F24550 microcontrollers namely, high computational performance at an economical price with the addition of high endurance, enhanced flash program memory [7]. In addition to these features, the PIC18F24550 family introduces design enhancements that make these microcontrollers a logical choice for many highperformance, power sensitive applications. All of the devices in the PIC18F4550 family incorporate a range of features that can significantly reduce power consumption during operation. Devices in the PIC18F4550 family incorporate a fully featured Universal Serial Bus communications module that is compliant with the USB Specification Revision 2.0. The module supports both low-speed and full-speed communication for all supported data transfer types. It also incorporates its own on-chip transceiver and 3.3V regulator and supports the use of external transceivers and voltage regulators. All of the devices in this family offer twelve different oscillator options, allowing users a wide range of choices in developing application hardware. Asynchronous dual clock operation, allowing the USB module to run from a high-frequency oscillator while the rest of the microcontroller is clocked from an internal low-power oscillator. Besides its availability as a clock source, the internal oscillator block provides a stable reference source that gives the family additional features for robust operation: • Fail-Safe Clock Monitor: This option constantly monitors the main clock source against a reference signal provided by the internal oscillator. If a clock failure occurs, the controller is switched to the internal oscillator block, allowing for continued low-speed operation or a safe application shutdown. • Two-Speed Start-up: This option allows the internal oscillator to serve as the clock source from Power-on Reset, or wake-up from Sleep mode, until the primary clock source is available. Other Special Features • Memory Endurance: The Enhanced Flash cells for both program memory and data EEPROM are rated to last for many thousands of erase/write cycles – up to 100,000 for program memory and 1,000,000 for EEPROM. Data retention without refresh is conservatively estimated to be greater than 40 years. • Self-Programmability: These devices can write to their own program memory spaces under internal software control. By using a bootloader routine, located in the protected Boot Block at the top of program memory, it becomes possible to create an application that can update itself in the field. • Extended Instruction Set: The PIC18F24550 family introduces an optional extension to the PIC18 instruction set, which adds 8 new instructions and an Indexed Literal Offset Addressing mode. This extension, enabled as a device configuration option, has been specifically designed to optimize re-entrant application code originally developed in high-level languages such as C. • Enhanced CCP Module: In PWM mode, this module provides 1, 2 or 4 modulated outputs for controlling half-bridge and fullbridge drivers. Other features include auto-shutdown for disabling PWM outputs on interrupt or other select conditions and autorestart to reactivate outputs once the condition has cleared. • Enhanced Addressable USART: This serial communication module is capable of standard RS-232 operation and provides support for the LIN bus protocol. Other enhancements include Automatic Baud Rate Detection and a 16-bit Baud Rate Generator for improved resolution. When the microcontroller is using the internal oscillator block, the EUSART provides stable operation for applications that talk to the outside world without using an external crystal (or its accompanying power requirement). • 10-Bit A/D Converter: This module incorporates programmable acquisition time, allowing for a channel to be selected and a conversion to be initiated, without waiting for a sampling period and thus, reducing code overhead. • Dedicated ICD/ICSP Port: These devices introduce the use of debugger and programming pins that are not multiplexed with other microcontroller features. Offered as an option in select packages, this feature allows users to develop I/O intensive applications while retaining the ability to program and debug in the circuit. Configuration and Data Transmission of the DAQ. The DAQ can be configured to be connected with other bluetooth device knowing the Media Access Control (MAC) address. Fig. 3 shows a schematic of the card. This device can operate in two different modes DAQ Bluetooth and DAQ USB – Bluetooth. 1) DAQ Bluetooth: Receives and transmits information on the card. The Bluetooth module configuration is made directly by reading a dedicated input pin for this purpose. 2) DAQ USB – Bluetooth: The card is connected via USB to the computer as a data acquisition card USB, sending and receiving the information to another Bluetooth device. Fig. 3. Bluetooth DAQ Schematic The programming of the firmware is developed in C, using the PIC C compiler for the recognition of the card in USB mode through drives of Microchip mchpusb.cat, mchpusb.sys, mchpusb64.sys, and mchpusb.inf. The configuration and ad hoc connection with another Bluetooth device is designed via AT commands, either stored in the microcontroller or transmitted through the user interface working in USB mode [8]. All the information needed in the Bluetooth DAQ mode is stored in the ROM of the PIC which is activated through the sensing PIN C0. The DAQ in any of two modes of operation works as the master who initiates the connection. Others Bluetooth devices in a computer can be used as slaves. The algorithm of the microcontroller has four important steps. It is shown in Fig. 4. 1. 2. 3. 4. Configuration of the Bluetooth module, through the detection of the C0 PIN, which executes the code stored in the CIP for this purpose. Connection or disconnection of the module, with another Bluetooth device. Configuration and mapping in the microcontroller, for the analog and digital inputs. Configuration and mapping in the microcontroller, for the analog outputs - PWM and digital outputs. 3. SOFTWARE User interface for controlling the card is held under the programming language Visual C. This consists of three parts Initialization and recognition of the card, Data Acquisition and Robot Control [9-13]. Initialization and recognition of the card As we can see in Fig. 5, on this step, the card recognizes possible failures and connects the configuration via USB or via Bluetooth COM port. In USB mode it works as a Communications Device Class. When the card is installed and recognized by Windows, the Bluetooth module can be configured to transmit and acquiring data [9]. Fig. 4. Firmware algorithm Fig. 5. Initialization and connection Data Acquisition The data acquisition window is depicted in Fig. 6. This stage is focused on acquiring and transmitting data in the Bluetooth data acquisition mode or as data acquisition USB-Bluetooth. The outputs are selected and the distance where the card is located is displayed using LEDs. Digital inputs are read from the card but only one analog channel can be read by sweeping 6 possible analog inputs. The analog outputs are transmitted through pulse width modulation. Robot Control In this step the card sends the paths, positions and commands to run the robot. For example, the position of the shoulder, elbow and wrist. Control and address data, are transmitted as a floating, detached by nibble, so that the robot can interpret them. Fig. 7 depicts a specific routine to control a robot. Fig. 9. Experimental Robot Fig. 6. Data Acquisition in C # P T 1 1 C C 7 2 6 2 4 1 2 D N G D N G 9 E O C C 1 3 0 5 1 0 A 3 1 6 7 8 1 3 A 5 A 5 2 A 1 1 A 4 0 A 2 6 9 1 7 0 8 2 9 2 2 1 5 A 2 3 1 1 3 4 2 1 25 Connector D N D 2 A 5 2 3 1 1 A 2 A 0 SN74LS245N G The control of an arm is a training platform for robot manipulators. This has theoretical and practical interest for experimental validation of new controller designs. An arm has been manufactured and built in the “Facultad de Ciencias de la Electrónica” of the “Benemérita Universidad Autónoma de Puebla”. The robot has a drive with three degrees of freedom [13, 14]. In the Fig. 8 we can observe the communication system. 1 0 D N G 0 1 10 Header 4. APPLICATION 1 9 2 8 A 9 7 A 7 8 8 6 A 6 7 5 A 5 6 4 A 4 5 3 A 3 4 2 A 2 3 1 A 1 8 B 7 B 6 B 5 B 1 B 3 2 1 C C V D N 8 G B 1 1 B 1 5 6 7 B Fig. 7. Robot control 4 4 1 3 1 2 1 1 1 8 P DIR 1 BLUETOOTH DAQ V 2 U DIGITAL OUT V J L In addition, the control of the robot needs a digital signal conditioning step. The circuit connected to the digital output port of the card is shown in Fig. 10. Fig. 11 shows the complete Bluetooth DAQ. Fig. 10. Digital signal conditioning Fig. 8. Communication System The control algorithm, programming in Borland C, is loaded in the robot console. It receives external data through the parallel port. In Fig. 9 we can observe the experimental robot. Figura 11. Bluetooth DAQ 5. CONCLUSIONS This paper has shown a simple but successful design of a Bluetooth data acquisition card for the control of manipulator robots. Industrial applications involving this system can benefit from the use of wireless communication technologies. The localization and tracking of components, the coordination of autonomous transport vehicles and mobile robots, as well as applications involving distributed control are all areas in which wireless technologies could be used in an industrial environment. REFERENCES [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] W. Stallings, Wireless Communications and Networking. Prentice Hall. IEEE Computer Society. Part 15.1: Wireless medium access control (MAC) and physical layer (PHY) specifications for wireless personal area networks (WPANs). IEEE Std 802.15.1 , New York, 14 June 2005. Bluetooth SIG, Inc. BLUETOOTH SPECIFICATION Version 2.1 + EDR [vol 0]. The United State, 26 de July de 2007. Bluetooth SIG, Inc. RFCOMM with TS 07.10 Serial Port Emulation, The United State, March 2003. Amar Palacherla, Microchip Technology Inc. Using PWM to Generate Analog Output, U.S.A, 2002, pp. 1-4. Ross M. Fosler and Rodger Richey, Microchip Technology Inc. A FLASH Bootloader for PIC16 and PIC18 Devices, U.S.A, 2002, pp. 138. Microchip. PIC18F2455/2550/4455/4550 Data Sheet, 28/40/44-Pin, High Performance, Enhanced Flash, USB Microcontrollers with nano Watt Technology. Sena Technologies, Inc. User Guide for the Parani-ESD1000, Korea, November 2009. Custom Computer Services, Inc, PCD C Compiler Reference Manual, U.S.A, February 2010. Rawin Rojvanit Microchip Technology Inc. Migrating Applications to USB from RS-232 UART with Minimal Impact on PC Software, U.S.A, 2004, pp. 1-16. Axelson, J. USB Complete: The Developer’s Guide. United States of America: Distributed by Independent Publishers Group, 2009. Kelly R & Santibáñez V. Control de Moviminento de Robots Manipuladores. Madrid España: Person Educación, 2003. Craig, J.J. Introducction to robotics: Mechanics and control. AddisonWesley, Reading, MA. 1989. Arturo Corona, Jorge Moctezuma, Fernando Reyes, Roberto Campos, “Nueva plataforma de Entrenamiento para Robots Manipuladores”, El HOMBRE Y LA MAQUINA numero 28, Colombia, enero-junio 2007, pp. 108-115.