====== Wireless Serial Port Based on Bluetooth ====== //__About this Article__// * **Author**: soloforce --- soloforce@126.com --- 2013/11/08 11:24 * **Copyrights**: [[http://creativecommons.org/licenses/by-sa/3.0/|CC Attribution-Share Alike 3.0 Unported]] * **Contributors**: [[http://cubieboard.org/|Cubieboard Community]] : ... ===== Abstract ===== Sometimes, the serial port cable between Cubieboard and PC is annoying, because it may mess up your desktop. In this tutorial, two similar approaches are presented to guide you to get rid of the annoying cable, and create a wireless interactive console. In fact, wireless console is quite usefull especially there is no network connection between Cubieboard and PC, or there is no SSH server installed on the Cubieboard. Serial-bluetooth module is quite common and cheap these days, and it is really a good choise to make a wirless serial port connection to PC. ===== Method one: UART0(ttyS0) directed to serial-bluetooth module ===== ==== Prerequisite ==== === Hardware === * This method is only available for Cubieboard1 & Cubieboard2, While Cubieboard3(Cubietruck) does not expand out the UART-VCC pin so that unable to power the serial-bluetooth module. * Cubieboard side: A serial-bluetooth module, to be attached to Cubieboard's TTL serial port. Notice that, this module should be **3.3v powered**, because Cubieboard's TTL VCC is 3.3v. {{ :tutorials:common:customization:p31108-130501.jpg?400 |}} * PC side: Another serial-bluetooth module combined with a TTL-to-USB serial module(**5.0v** VCC), to be plugged into PC's USB port. If your PC has a built-in bluetooth, these two modules could be omitted, but you have to create the bluetooth serial port(rfcomm port) for communicating on your own, will be discussed later of this tutorial. {{ :tutorials:common:customization:p31108-130420.jpg?400 |}} * Some connecting wires and 2.54mm connectors === Software === Cubieboard side: ttyS0 should be configured as an interactive console, which means the following configurations should be done * //**/boot/uEnv.txt**// should add extra boot arguments like bootargs=console=ttyS0,115200 console=tty0 * //**/etc/inittab**// should add a line like T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 PC side: Serial console clients like minicom or gtkterm(recommended) ==== Configuration & Connection ==== * Both serial-bluetooth modules should be configured to baud rate at **115200**, and pre-paired. * The **3.3v serial-bluetooth** should be conected to Cubieboard's TTL serial port(aka. ttyS0 in Linux) * The **5.5v serial-bluetooth** module combined with the TTL-to-USB module, should be plugged into the PC's USB port * Open gtkterm(or minicom) port **/dev/ttyUSB0** with parameters **115200-8-n-1** {{ :tutorials:common:customization:p31108-131127_4.jpg?400 |}} {{ :tutorials:common:customization:p31108-131311.jpg?400 |}} {{ :tutorials:common:customization:2013-11-08-133630_752x580_scrot.png?400 |}} ===== Method two: usb serial console to serial-bluetooth module ===== When installed in a case, like [[http://docs.cubieboard.org/_detail/addons/y.png?id=addons|this]], Cubieboard's TTL interface would be blocked and can no longer be plugged in the TTL to USB cable. In this case, we could exploit the USB port to make wireless serial port possible. This method is a bit different from method one previously mentioned, especially on the Cubieboard's side. What's more, this method remains the chance of choosing either TTL serial port or USB serial port for wireless console. In a word, this is a safe and flexible method. ==== Prerequisite ==== ===hardware=== * Cubieboard side: A serial-bluetooth module, combined with a TTL-to-USB serial module (**5.0v** VCC), to be plugged into Cubieboard's USB port. * PC side: The same as method one. ===software=== Cubieboard's kernel configuration should be done, enable below fetures(press 'Y' to select) - //**Device Drivers->USB support**// - //**USB Serial Converter support**// - //**USB serial console device**// - The USB serial driver corresponding to the TTL-to-USB serial module, //**USB Prolific 2303 Single Port Serial Driver**// in my case. :!: Do remember, all above features should be compiled into kernel instead of modules. {{ :tutorials:common:customization:2013-11-07-173723_816x701_scrot.png?400 |}} {{ :tutorials:common:customization:2013-11-07-173900_816x701_scrot.png?400 |}} Like configurations mentioned in method one, the follwing alteration should be done. * //**/boot/uEnv.txt**// should add extra boot arguments like bootargs=console=ttyS0,115200 console=ttyUSB0,115200 console=tty0 * //**/etc/inittab**// should add lines like T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 T1:2345:respawn:/sbin/getty -L ttyUSB0 115200 vt100 :!: That above bootargs & two lines will make both TTL serial port(ttyS0) and USB serial port(ttyUSB0) interactive consoles. ==== Connection ==== Both Cubieboard and PC 's USB port will be used for connection. {{ :tutorials:common:customization:p31108-181650.jpg?400 |}} {{ :tutorials:common:customization:p31108-131311.jpg?400 |}} ===== For those PC has built-in bluetooth device ===== If your PC has a built-in bluetooth device, the serial-bluetooth module and TTL-to-USB serial module won't be necessary anymore. Most OS can simulate the built-in bluetooth as a serial port(a COM port for Windows, or a rfcomm for Linux). Assuming your OS is Linux, the configurations are described below. Firstly, install the necessary packages. $ sudo apt-get install bluez Secondly, create **///dev/bluetooth/rfcomm.conf//**, input these lines # # RFCOMM configuration file. # rfcomm0 { # # Automatically bind the device at startup bind no; # # # Address of the bluetooth device attached to cubieboard # This address could be achieved by "hcitool scan" device 00:06:69:00:0B:D3; # # # RFCOMM channel for the connection channel 1; # # # Description of the connection comment "Cubieboard bluetooth device"; } Thirdly, start the bluetooth service $ sudo service bluetooth start Then, bind the target bluetooth to a serial port $ sudo rfcomm bind /dev/rfcomm0 At last, you can open this port as usual serial ports $ minicom -D /dev/rfcomm0 ===== Conclusion ===== * method one is simpler, but the UART TTL port is the only choice for connection. * method two needs more hardware, and the boot message such as U-Boot message could never show up, because the USB serial console won't work until the kernel boots up. The advantage is USB connection is much easier and could be expanded by USB hubs. ===== References ===== * http://www.thinkwiki.org/wiki/How_to_setup_Bluetooth#Serial_connection_over_Bluetooth * http://www.heatxsink.com/entry/how-to-pair-a-bluetooth-device-from-command-line-on-linux * https://wiki.gentoo.org/wiki/Bluetooth {{tag>Cubieboard Cubietruck}}