Many times we need to transmit data wirelessly, a good way to do it is by using Bluetooth, an old technology but that serves our purposes. In the following article, we explain how to make the connection with the device using minicom.
To begin, we will install minicom:
We configure the minicom port, as root:
We change the port to ttyUSB0, now we can start minicom as a regular user.
We connect the FDDI RX to the BT TX and vice versa.
In the minicom console, we paste with the middle mouse button:
AT+VERSION
AT+BAUD4
AT+NAMENemesis
With this, we get the firmware version, configure the serial port transfer rate to 9600 bps, and give it a name.
The different transfer rates are:
1 for 1200 bps
2 2400 bps
3 4800 bps
4 9600 bps
5 19200 bps
6 38400 bps
7 57600 bps
8 115200 bps
9 230400 bps
A 460800 bps
B 921600 bps
C 1382400 bps
The pin could be changed with:
By default: 1234
Now we can pair the PC with the BT.
Scanning ...
AA:AA:AA:AA:AA:AA Nemesis
We power the BT and run simple-agent to associate with it:
bluez-test-device trusted AA:AA:AA:AA:AA:AA yes
bluez-test-device trusted AA:AA:AA:AA:AA:AA
1
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device AA:AA:AA:AA:AA:AA;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "Nemesis connection";
}
# HCId options
options {
# Automatically initialize new devices
autoinit yes;
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security user;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;
# Default PIN code for incoming connections
#passkey "1234";
pin_helper /etc/bluetooth/pin;
}
device AA:AA:AA:AA:AA:AA {
name "Nemesis";
auth enable;
#encrypt enable;
}
We create our BT serial port:
Now we have a device in /dev/rfcomm0
We can start minicom with:
To speed up this process we can create a script:
#! /bin/bash
simple-agent hci0 AA:AA:AA:AA:AA:AA
bluez-test-device trusted AA:AA:AA:AA:AA:AA yes
rfcomm bind 0 AA:AA:AA:AA:AA:AA
minicom -D /dev/rfcomm0
We configure sudo to be able to execute it from a regular user:
USER ALL=NOPASSWD: /home/USER/.scripts/ardBT.sh