Bluetooth connection from Raspberry Pi to Parani SD100- No usable services - python-3.x

I'm attempting to connect my raspberry Pi to a Parani SD1000 RS232 serial adapter. I have configured the Parani and I can successfully connect to it and retrieve data when using my Macbook. I would like to set up the connection using my raspberry pi. I have a raspberry Pi 3 model b+ 32 bit. I wrote a script that uses Pyserial and created a bind to the bluetooth device via sudo rfcomm bind /dev/rfcomm0 XX:XX:XX:XX:XX:XX 1. However, when I use the Raspberry PI OS interface to connect to the bluetooth I get a message that 'Paired successfully, but this device has no services with can be used with the Raspberry Pi and the connection is aborted.
I've looked for other suggestions and tried updating my software as listed elsewhere. To no avail.
sudo apt-get update
sudo apt-get dist-upgrade
sudo rm /etc/udev/rules.d/99-com.rules
sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall raspberrypi-sys-mods
sudo systemctl reboot
I'm not sure which direction I should be looking. I know the Parani is configured correctly so it must be something on the raspberry. Thank you in advance

rfcomm was deprecated back in 2017 by the BlueZ project so I would recommend against using that methodology.
Python3 on Linux supports connecting to a Bluetooth Classic device with a Serial Port Profile (SPP) with its socket library.
There is more information in the following blog: https://blog.kevindoran.co/bluetooth-programming-with-python-3/
There is also support for SPP within the Bluedot Python library: https://www.stuffaboutcode.com/2017/07/python-bluetooth-rfcomm-client-server.html

Related

How can I use rfcomm to connect to multiple android smartphones to my Raspberry Pi 3?

I am trying to connect my Raspberry Pi 3 to three android phones through Bluetooth. I want to use the input of the phones in a python code, but before I start coding I have to make sure I can connect all three phones to the Raspberry Pi 3.
The following stuff I did was:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo rpi-update
sudo apt-get install python3
sudo apt-get install python-bluetooth
sudo nano /etc/systemd/system/dbus-org.bluez.service
Changed the next two lines:
ExecStart=/usr/lib/bluetooth/bluetoothd -C
ExecStartPost=/usr/bin/sdptool add SP
I am using the BlueTooth Serial Conntroller app on the smartphones.
Next I connect through sudo rfcomm listen hci0 which works fine.
I check the connection with minicom -D /dev/rfcomm0 and that works as well. I can send commando's with the app and it shows on the terminal on my Raspberry Pi.
Next, while that connection is active, I try to connect the second phone with sudo rfcomm listen hci2 which connects for a moment on the phone, but on the screen it quickly gives me the message
Can't create rfcomm TTY: address already in use
So I'm thinking it's because I'm using channel 1. So I try sudo rfcomm listen hci2 2 which displays it's waiting on channel 2. But that doesn't work either.
I have checked if I can connect to the second phone on the first channel (when it's free) and it works.
So my question is:
How can I use rfcomm to connect to multiple android smartphones?
Or is there another better way knowing that I want to use Python to use the input?
I had this same exact problem, and this is how I solved it: sudo rfcomm listen /dev/rfcommX 1 where X starts at 0 and increments by 1 for every device you want to connect.

Intel Galileo linux image doesn't seem to support the "sudo" or "apt-get" command

I updated the firmware for my gen 1 board to 1.1.0.
I'm logged in as the root.
My intel galileo is connected to the internet and can ping various websites.
Node,python, and curl are all recognized commands but sudo and apt-get are not.
Any help?

Can I develop Linux based Raspberry Pi apps in Visual Studio 2015 or on a Mac (Eclipse or XCode)?

I know there's a lot you can do in VS2015 as far as cross platform mobile dev, but I am not sure if it can do Linux, specifically for the Raspberry Pi Raspbian OS.
Can it?
If not, can I use something like Eclipse on my Mac or something else on my Windows machine?
I've done some mobile work before in iOS and a tiny bit of exploration in Droid so I imagine it's close to one of those.
Yes you can.
Raspian is a pretty complete OS, so you could run apps compiled by any language like Python/node/C/C++/C#. (Raspberry Pi 2 can now run Ubuntu)
Run Windows Apps
The easiest way to do it would be to load Windows IoT Core onto Raspberry Pi and create UWP apps in Visual Studio. This gives you remote deployment, debugging and powerful APIs from the get go. Windows Iot Core for Raspberry Pi
Python & Node
Write in VS using
nodejstools
python tools
Then you just copy paste the code to rpi, and run it using node/python
C/C++
Simply use VS to develop, and build using the Windows toolchain for Raspberry Pi.
C#
I haven't played around it too much, try mono
You can also use the "Visual C++ for Linux Development" extension for Visual studio 2015
I use my Raspberry Pi to write desktop programs in C#.Net. I use Mono to run the program and MonoDevelop to write it. Mono supports using System.Windows.Forms on the Raspberry Pi, but MonoDevelop only supports GTK for a gui. To use System.Windows.Forms, you need to code it directly instead of dropping controls on a form.
http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
sudo apt-get install monodevelop
Needed for debugging of console applications:
sudo apt-get install xterm
sudo apt-get dist-upgrade

Issues in installing bluez-utils and running the command bluetoothctl

I am struggling to pair a device with my raspberry pi via bluetooth. I am referring to this tutorial. As per that, there are 2 packages needed for this.
Bluez and Bluez-utils. I have installed both of them. When I run the command bluetoothctl it says command not found.
This is what the guide says.
Install the bluez and bluez-utils packages. The bluez package provides the Bluetooth protocol stack, and the bluez-utils package provides the bluetoothctl utility.
Anyone faced this issue before?

Bluetooth sniffer: How can I install btmon on raspberry Pi?

A kind person said that btmon is a useful tool to exam Bluetooth packets.
I want to use btmon in Raspberry Pi but the tool seems to be not installed by default.
Does anyone know that how to install the tool? I am looking for the information for a long time, but I cannot find it.
Thanks.
P.S.
I can use hcidump. However, I guess that btmon is a more user-friendly tool.
These instructions install both bluez and btmon.
http://www.elinux.org/RPi_Bluetooth_LE
Here is a summary of the instructions in case the link changes.
Install libraries
sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libical-dev libreadline-dev libudev-dev libusb-dev make
Download the source files
mkdir -p work/bluepy
cd work/bluepy
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.30.tar.xz
tar xvf bluez-5.30.tar.xz
Compile the file
cd bluez-5.30
./configure --disable-systemd
make
sudo make install
Make sure USB device is seen so run the command
lsusb
After running lsusb you may get something like this.
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0a5c:21e8 Broadcom Corp.
Make sure the Bluetooth adapter is up.
sudo hciconfig hci0 up
To see if any Bluetooth LE devices are nearby run. Ctrl-C to stop command.
sudo hcitool lescan
You can now run btmon with hcitool.
./btmon &
hcitool lescan

Resources