Implementation Scheme of a Bluetooth printer

Source: Internet
Author: User

Author: Institute of Communication, Shanghai University

Introduction 
As a short-distance wireless communication protocol, Bluetooth stands out among many wireless solutions with its low cost, low power consumption, high speed, convenient and flexible features. Bluetooth 10 m working distance can well meet the needs of most digital devices, such as office or home applications. A printer is a commonly used device. It can remove the inconvenience caused by the printer connection and achieve wireless printing, which can reduce the unpleasant cables on the desktop and move the printer away from the host, suitable place in the room. This article introduces a method that uses Bluetooth technology to achieve wireless connection between the host and the printer and implement remote control printing.

Design Scheme of Bluetooth printer
The overall design concept 1 is shown below:

Figure 1 general idea of Bluetooth printer Design

A single-chip microcomputer is used on the host to simulate the printer. The data and control signals sent from the host port are captured and transmitted to the printer through Bluetooth wireless connection. On the printer side, the microcontroller simulates the host to control the Printer Based on the received bluetooth data, so as to achieve bluetooth wireless connection between the printer and the host. The Bluetooth on the host side is used as the master device to query and initiate a connection, while the Bluetooth on the printer side is used as the slave device waiting for connection establishment. Single Chip Microcomputer Using 89C2051, Bluetooth chip using Ericsson production support point-to-point connection ROK101-008. This module includes the wireless part, baseband controller, flash memory, power control module and internal clock, provides UART, PCM, I2C standard interface and built-in crystal oscillator, the hardware Diagram 2 is shown below:

Figure 2 Ericsson ROK 101 008 hardware block diagram

This solution is suitable for general-purpose printers with CENTRONIC parallel interfaces. You do not need to change the driver of the printer. You only need to connect the two Boards containing single chip microcomputer and Bluetooth to the host and printer respectively, and then you can print them wirelessly. The entire process is transparent to the original printer driver, which provides great convenience for printer users.

MCU Control Over bluetooth module

Figure 3 Bluetooth HCI Transport Layer
 
The Bluetooth specification defines the Host Control Interface (HCI), which provides standard command interfaces for baseband controllers, hardware controllers, hardware statuses, and control registers. The host sends control commands and data to the bluetooth module through the HCI transport layer, and the bluetooth module sends the status information and data to the host through the HCI transport layer. The main purpose of the HCI transport layer is to achieve transparency. The Transport Layer does not need to be visible to the data transmitted by the master controller driver to the master controller, which enables the interface (HCI) or the master controller to be upgraded without affecting the transport layer.

As shown in 3, at least four different types of packages-HCI commands, HCI events, ACL data, and SCL data are transmitted in the HCI transport layer. Each HCI package starts with an HCI indicator header. Different indicator headers indicate different types of HCI packages:
0x01 HCI Command Group
0x02 hci acl Data Group
0x03 hci sco Data Group
0x04 HCI Event Group

There are three main transport layers: hci usb, hci pcm, and hci uart. We use a single chip microcomputer through the HCI-UART transmission layer of bluetooth module control. Figure 4 shows the connection principle:

Figure 4 single-chip microcomputer and Bluetooth connection schematic

Generally, the single-chip microcomputer and the Bluetooth chip are directly connected within a short distance, so that reliable data transmission can be ensured, and traffic control is not required by the CTS and RTS signals. UART communication between single-chip microcomputer and Bluetooth uses eight-Bit Data bit, one-bit termination bit, no parity check, and the non-type small endian format, that is, the first sending of the receiver bit. The UART communication format and baud rate can be adjusted by sending HCI commands to Bluetooth via a single-chip microcomputer. The ROK-101-008 chip supports up to kbps of UART speed. The first HCI command sent to the bluetooth module should be the soft reset command. After Bluetooth executes a command, A command completion event (command_complete_event) with status parameter information will be returned to inform the host (Single Chip Microcomputer) of command execution.

After the software is reset, we also need to set some timer values for a series of parameter settings to make the bluetooth module wait for queries and connection initiation from other Bluetooth devices. The preceding parameter settings are required before querying and establishing a connection even if the host is Bluetooth on the master device. The following parameters need to be set:
* Set Event Filter (set Event Filter)
* Write scan enable (set scan parameters, such as whether query and paging can be performed)
* Write authentication enable (set whether verification is required)
* Write page timeout (set paging timeout. Generally, this value can be set to 7 S)

After setting the above parameters, the bluetooth module on the printer is ready to connect to the device. The Bluetooth module at the host end also needs to query (Inquiry) to obtain the Bluetooth address of the remote device and initiate a connection based on the queried Bluetooth address. Once a Bluetooth connection is established, you can send and receive data to achieve bluetooth wireless printing.

Connection between single-chip microcomputer and host and printer

The single-chip microcomputer and the interface circuit of the host and the printer are very simple. Taking the connection with the printer as an example, circuit 5 shows:

Figure 5 single-chip microcomputer and printer connection schematic

Connect the P1 port of 89C2051 directly to the data port of the printer, and use p3.7 to sample the busy signal of the printer. Because the connection between the host and the printer is generally long and the printer side has a matching resistance, P3.3, Which is output as a strobe signal, cannot be directly connected to the printer, here we use the one and the other to increase the driving capability to achieve control. When the MCU receives the data sent from the host via Bluetooth, it simulates the host on the printer side to control the printer. First, the data to be sent to the printer is output from the P1 port, and then a negative pulse is generated from the P3.3 through the door circuit. The selected communication number is sent to the printer and the busy signal on p3.7 is listened, when the signal level is low, it indicates that the data has been received by the printer and the next data can be sent.

Conclusion
The above solution does not involve the specific model of the printer, and does not need to change the driver of the user printer, so it is applicable to most general-purpose printers. This method of using single-chip microcomputer to control the bluetooth module through the UART transmission layer is not only applicable to the Development of Bluetooth printers, but also to various embedded Bluetooth systems.

References:
1. Specifications of the Bluetooth System Version 1.1,
Http://www.bluetooth.com. 2. Ericsson ROK 101 008 data sheet, http://www.ericsson.com.
3. Jin chunet, Bluetooth technology, electronics Industry Press, 2001.
4. Li Hua and others, "MCS-51 series SCM practical interface technology", Beijing University of Aeronautics and Astronautics Press, 1993.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.