Bluetooth is a wireless technology standard managed by the Bluetooth Special Interest Group (SIG) and with IEEE 802.15.1 standard. Used for the exchange of data between fixed and mobile devices over short distances using UHF radio waves of short wavelength of 2,400 to 2,485 GHz, widely used to build personal area networks (PAN).
These instructions allow you to communicate the two raspberry pi3, through bluetooth technology.
We have to know the bluetooth addresses or the mac address of each device.
For this we go to the terminal and type the command
hciconfig
For my example the MAC of my first raspberry will be B8: 27: EB: 6A: E1: BD
and the second raspberry will be B8: 27: EB: FC: 72: 30
.
Now we must configure the rfcomm.com
file.
For that, we use the command:
sudo nano /etc/bluetooth/rfcomm.conf
After executing this command, we will modify the file as follows (On each device):
rfcomm1{
bind yes;
device MAC;
channel 1;
comment "Bluetooth"
}
โ NOTE: Where it says MAC, we will replace with the address we found earlier.
On each device, uses Bluez for Linux. We are going to install the library that will allow us serial communication, by the following command in the terminal
sudo apt-get install bluez python-bluez
โ NOTE: Taken from Rfcomm y PyBluez
We need to use the two scripts in this repository, one is going to pretend to be a gas station and the other will be a car.
โ NOTE: Run the Station script first and then the car script.
The script execution command of the station is:
python GasStation.py
The script execution command of the car is:
python CarGasStation.py
After this, we can modify the scripts according to what we need. Here we can configure the connection form and even the protocols
- Nico Patalagua - Repository - Github
- Share it ๐ข
- Invite me a beer ๐บ
- Improve it ๐ค.
NicoPatalagua ๐