HUM: BLUETOOTH HC-06
WHAT IS IT AND HOW DOES IT WORK?
Bluetooth is a way of wireless transmission of information, designed by Ericsson in 1994. as an alternative to RS-232 wired data transfer. Radio waves of 2.402GHz to 2.480GHz frequency are used for data transmission. The advantage of bluetooth, in front of other ways of communication, is a very simple pairing.
In order to avoid mutual interraction with other devices using the same frequencies, bluetooth sends a very weak signal of about 1mW. For comparison, the signal of more powerful mobile phones is 3W. This limits its range to 10m, which can of course be increased up to 100m. The devices that are being connected do not have to be physically visible to each other. The signal passes through walls and other objects, so that more devices can be connected in different rooms. As we have already mentioned more devices, bluetooth can be connected to 8 devices at the same time in the 10m area without them interrupting one another. To enable this, bluetooth device changes frequency, in above mentioned range, 1600 times every second. Read more about it in this technology.
Bluetooth vs. WiFi
Although very similar, generally these devices have different uses. Bluetooth is a cost-effective and easily connected device and as such it is used to connect two electronic devices for easy management or exchange of smaller data packages. WiFi is better suited to a system which requires higher speed and some configuration of client-server connection. WiFi Direct has taken on some features of bluetooth devices.
Data transfer rate table according to BT version
Range table according to BT class
Find more specifications here.
BT AND ARDUINO
In this tutorial, we will connect BT module HC-06 (JY-MCU) and Windows computer. The same one can be used for connecting a different BT module to e.g. Android device. HC-06 is a slave only, e.g. controlling a robot with this module via computer. HC-05 is a master/slave module, and the only thing discerning it from HC-06 is the firmware.
Pinout and connection
VCC – 3-6VDC
GND – ground
TXD – serial output of the module, it is connected to rx pin of the microcontroller. PIN0 on the Dasduino
RXD – serial input of the module, it is connected to tx pin of the microcontroller. PIN1 on the Dasduino
i = 0;
// begin serial communication
// send a serial print
BT AND WINDOWS
The next step is to find the BT device in the Windows7 operating system. Follow the Control Panel – Hardware & Sound – Devices & Printers for list of components.
If we have not connected BT under the Bluetooth devices before, we will not find anything. So, let’s connect to a new device by clicking on Add a Device.
This will open a dialogue for adding a new BT device. Now we wait for it to find the device, signify HC-06 and click on Next.
In the next window, choose Pair without using the code.
If the system requires a code, enter 1234 and that is it. NOTE: some systems will later require a permission for connecting. In that case, a pop-up window will appear and using it, we will allow the connecting with the specified code.
Now you should see the HC-06 device in the BT devices list. Right-click on the device, select Properties, and the Hardware tab. On it, you will find a virtual port which is assigned to the device. The example in the picture below is the COM12 port. The same can be found on the Services tab.
SUBMITTED DATA REVIEW
The data we send using Dasduino and BT devices can be reviewed in the Serial Monitor of Adrudino IDE program. Make sure you have selected the right port assigned to BT device in your system (in step one, COM12) and the same BAUD rate along with the sketch two steps before.
The same can be checked using Python scripts, as we have already mentioned in our previous tutorial.