Can't connect to OBD-II device from node-bluetooth-obd - node.js

I'm attempting to connect via node.js to an ELM327 Bluetooth OBD-II adapter using Eric Smekens node-bluetooth-obd package, but I'm getting an error I'm not sure how to debug. I am doing this on a Beagle Bone Black running Ubuntu. I'm able to pair with the device using bluez-simple-agent:
sudo bluez-simple-agent hci0 00:0D:18:A0:4E:35
And I've updated the MAC address in the second line of the Readme.md example to match the MAC address of the device:
var btOBDReader = new OBDReader('00:0D:18:A0:4E:35', 14);
However, when I run the script, I get this error:
Error with OBD-II device: Error: Cannot connect
I'm still pretty new with bluetooth comms, so I don't really know where to start debugging this. Any suggestions?

Related

hcitool cc and hcitool auth returns Input/output error

I have successfully set up and enabled Bluetooth on my server running Debian Buster. That in itself is quite an achievement. Anyhow, I am trying to use a Node package called node-bluetooth-serial-port to connect to a tiny Bluetooth speaker with a display. I manage to list/scan devices, but it cannot send anything to the device. I'm thinking this is because my server hasn't been paired with the device yet.
$ hcitool scan
Scanning ...
11:22:33:44:55:66 TimeBox-mini-audio
$ sudo hcitool cc 11:22:33:44:55:66; sudo hcitool auth 11:22:33:44:55:66
HCI authentication request failed: Input/output error
So hcitool can find the device, but it cannot connect to it, for some reason. dmesg doesn't show me any errors what so ever.
I have tried to pair with other devices (like my phone), but that doesn't work either.
The device does not require a 4-digit pin to auth.
What can I do here?

Connecting two raspberry pi through bluetooth with bluez

I'm trying to use this API: https://www.linumiz.com/bluetooth-connectdevice-without-scanning/ to make a connection between two Raspberry PI. I'm using this program like a server such as:
pi#raspberrypi:~/bluetoothC $ sudo ./bin/bluez_adapter_connect
Adapter is Powered "on"
and then, in the client side:
pi#raspberrypi:~/bluetoothC $ sudo ./bin/bluez_adapter_connect
B8:27:EB:9F:91:A7
Adapter is Powered "on" Unable to get result:
GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method
"ConnectDevice" with signature "a{sv}" on interface
"org.bluez.Adapter1" doesn't exist
But I don't understand this error. I'm doing this correctly? If not, what I have to do?
As mentioned in the article, ConnectDevice is the new adapter API introduced in BlueZ 5.49. Refer release notes here for more details.
This API is still marked as experimental, so you need to run bluetoothd daemon in experimental mode, i.e by passing "-E" as extra argument when starting bluetoothd.
So you need,
BlueZ 5.49 or later
Run bluetoothd daemon with "-E" option

BBB - WLAN USB Adapter configuration problems

yesterday i baught a new WLAN Nano USB Adapter (LogiLink/WL0084E/Should be supported by Linux). Now i have tried to get it running with my BBB which is running on Debian Wheezy.
First i pluged the WLAN USB Adapter in and i got following Result using lsusb:
Bus 001 Device 003: ID 0bda:8179 Realtek Semiconductor Corp.
I have googled for the ID 0bda:8179 and found following Website: https://wiki.debian.org/rtl819x wich told me to install firmware-realtek by using sudo apt-get install firmware-realtek. After that i should restart by System shutdown -h now and power on again (I know a reboot will do the same).
But the WLAN Adapter was not recoginzed as wlan0 - if i type in ip a i got following result:
1: lo: ...
2: eth0: ...
3: usb0: ...
The Website mentioned above told me that i need the module r8188eu - But on lsmod i got following output:
Module Size Used by
g_multi 50407 2
libcomposite 15028 1 g_multi
omap_rng 4062 0
mt7601Usta 458758 0
So i tought mt7601Usta can may be the right one and i typed in modinfo mt7601Usta
filename: /lib/modules/3.8.13-bone79/kernel/drivers/net/wireless/mt7601Usta.ko
version: 3.0.0.3
description: RT2870 Wireless Lan Linux Driver
But may this driver doesnt Support the WL0084E (Supported by Linux!).
What should i do?
Why do i not have the wlan0 interface?
How can i fix this Problem?
If you need more information, told me commands to execute ;)
Thank you!
Download the latest 8188 driver from realteks website, extract and run install.sh
http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PFid=48&Level=5&Conn=4&ProdID=274&DownTypeID=3&GetDown=false&Downloads=true
If that doesn't work either just give up with trying to get Wheezy to support it and just hope it works automatically in a newer distro/kernel

Cannot connect to Android Wear Device via bluetooth

I want to connect my Samsung Gear Live with my Samsung Smartphone Device and am trying to follow the giveninstruction. Also kept searching on stackoverflow with similar problems, but it seems that it is something else.
So this what happens when I am using the terminal to connect:
Denjos-MacBook-Pro-2:platform-tools Denjo$ cd /Users/Denjo/Library/Android/sdk/platform-tools
Denjos-MacBook-Pro-2:platform-tools Denjo$ ./adb forward tcp:4444 localabstract:/adb-hub
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device not found
error: device not found
Denjos-MacBook-Pro-2:platform-tools Denjo$
What am I probably doing wrong?
I solved it this way, that I changed the USB-cord.

How to setup serial communication in Processing to /dev/rfcomm0

I am trying to perform serial communication on between Ubuntu 12.04 and a JY-MCU bluetooth serial module connected to an Arduino.
I have created this configuration in /etc/bluetooth/rfcomm.conf
rfcomm0 {
# # Automatically bind the device at startup
bind yes;
#
# # Bluetooth address of the device
device 00:12:11:19:08:54
# # RFCOMM channel for the connection
channel 1;
# # Description of the connection
comment "Linvor Bluetooth Module";
}
I can use putty to communicate with the /dev/rfcomm0 serial port and this works perfectly.
However, despite many attempts I simply cannot see how to create a serial port in Processing that works in any way.
For example :
println(Serial.list());
prints nothing at all.
If I execute:
String portName = "/dev/rfcomm0";
myPort = new Serial(this, portName, 9600);
println(myPort);
I see this in the monitor:
processing.serial.Serial#1712651
But if I then call:
myPort.write('9');
I get an exception:
java.lang.NullPointerException
at processing.serial.Serial.write(Serial.java:572)
...
I can't understand why this fails. I have been following all the instructions from Tom Igoe's "Making Things Talk", but this just does not work the way he says...
Any help would b great!
Thanks,
Bob
Aftert searching high and low, I have made this work.
The key issue is that processing uses the rxtx java library (RXTX-2.1-7) for serial communications.
The RXTX wiki says:
"rxtx tries to detect ports on by scanning /dev for files matching any
of a set of known-good prefixes, such as 'ttyS', 'ttym', and since 2.2
'ttyUSB' and so on. "
And since the bluetooth device is named rfcomm* it cannot be detected.
The trick is to create a sym link to fool rxtx (use a ttyS device that is not yet assigned):
$ sudo ln -s /dev/rfcomm0 /dev/ttyS99
Then, connect:
$ sudo rfcomm connect 0
Connected /dev/rfcomm0 to 00:12:11:19:08:54 on channel 1
Press CTRL-C for hangup
At this point the red led on the JY-MCU becomes solid and processing can detect it:
println(Serial.list());
output is:
[0] "/dev/ttyACM0"
[1] "/dev/ttyS99"
So, serial communication can work.
To summarize, the following process will allow a processing script to communicate via a serial port with a JY-MCU device in a BlueZ linux framework
One time setup:
power up the JY-MCU,
use the following command to get its hardware address, mine is 00:12:11:19:08:54
$ hcitool scan
use that to create the /etc/bluetooth/rfcomm.conf file; you'll note that I chose 0 for the rfcomm device , we need that for connection later:
$ cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
bind yes;
device 00:12:11:19:08:54;
channel 1;
comment "Linvor Bluetooth Module";
}
use BlueMan to pair the JY-MCU.
Every time you want to use the JY-MCU
create the sym link:
$ sudo ln -s /dev/rfcomm0 /dev/ttyS99
connect to the JY-MCU:
$ sudo rfcomm connect 0
Connected /dev/rfcomm0 to 00:12:11:19:08:54 on channel 1
Press CTRL-C for hangup
you can now run a processing script and connect to the JY-MCU with
the code:
String portName = "/dev/ttyS99";
myPort = new Serial(this, portName, 9600);
after running the processing script, be sure to CTRL-C at the
command line to disconnect the JY-MCU.
That should do it!
Ciao,
Bob
Just something popped up in my mind.
I had similar problems that were caused due to channel 1 is already used. If you bind to a channel which already is in use, bad things may happen.
sdptool browse local
Use that command to see which channels are available on your Ubuntu device.

Resources