Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Vernier temperature bluetooth sensor to Raspberry Pi using GoDirect library #31

Open
vincentdjojo opened this issue Nov 17, 2020 · 8 comments

Comments

@vincentdjojo
Copy link

vincentdjojo commented Nov 17, 2020

The following error happens when trying to run the gdx_getting_started_bluetooth.py example:

wait for bluetooth initialization...
number of ble devices found = 1
1: GDX-TMP 0F10A381 BLE -64
Enter device number. To select multiple devices, separate with commas (no spaces): 1
attempting to open 1 device(s)...
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 135, in connect
).asFuture(loop)
txdbus.error.RemoteError: org.bluez.Error.Failed: Software caused connection abort

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "gdx_getting_started_bluetooth.py", line 31, in
gdx.open_ble()
File "/home/pi/Desktop/godirect-examples-master/python/gdx/gdx.py", line 153, in open_ble
open_device_success = gdx.devices[i].open()
File "/home/pi/.local/lib/python3.7/site-packages/godirect/device.py", line 102, in open
if not self._connect():
File "/home/pi/.local/lib/python3.7/site-packages/godirect/device_bleak.py", line 55, in _connect
self._loop.run_until_complete(self._async_connect())
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/pi/.local/lib/python3.7/site-packages/godirect/device_bleak.py", line 42, in _async_connect
await self._device.connect()
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 146, in connect
raise BleakError(str(e))
bleak.exc.BleakError: org.bluez.Error.Failed: Software caused connection abort

Is there a way to fix this issue with bluetooth?
Thanks.

@sswartley
Copy link
Contributor

Hello,

I wonder if it is an issue with the bluez library? hbldh/bleak#94

This information on upgrading bluez might be helpful: https://scribles.net/updating-bluez-on-raspberry-pi-from-5-43-to-5-50/

@vincentdjojo
Copy link
Author

Hello,

I wonder if it is an issue with the bluez library? hbldh/bleak#94

This information on upgrading bluez might be helpful: https://scribles.net/updating-bluez-on-raspberry-pi-from-5-43-to-5-50/

Hello sswartley. Thanks for responding to the issue. I'll get back to you soon.

@vincentdjojo vincentdjojo changed the title Can't get Vernier temperature bluetooth sensor to Raspberry pi using GoDirect library Can't get Vernier temperature bluetooth sensor to Raspberry Pi using GoDirect library Nov 19, 2020
@vincentdjojo
Copy link
Author

Hello,

I wonder if it is an issue with the bluez library? hbldh/bleak#94

This information on upgrading bluez might be helpful: https://scribles.net/updating-bluez-on-raspberry-pi-from-5-43-to-5-50/

Hello sswartley.
New updates with the sensors and my Raspberry Pi 4.
I have 3 Vernier sensors:

  1. Temperature Sensor
  2. Calcium Sensor
  3. Dissolved Oxygen Sensor.

So far, the only sensors that worked with Bluetooth is the dissolved oxygen sensor. Temperature and calcium sensors don't work with Bluetooth. However, all sensors work when wired to the Raspberry Pi 4.
I have updated bluez and I am using the latest version of bluez, just to clarify.
I think it's a problem with the library. The error remains the same: Software caused connection abort.

@sswartley
Copy link
Contributor

When you say they work when "wired", do you mean they work when connected via USB to your Raspberry Pi?

For troubleshooting, you might want to make sure the Go Direct device is properly charged.
You might also want to run Graphical Analysis on your phone or computer to verify that you can connect and collect from the different devices.

@vincentdjojo
Copy link
Author

When you say they work when "wired", do you mean they work when connected via USB to your Raspberry Pi?

For troubleshooting, you might want to make sure the Go Direct device is properly charged.
You might also want to run Graphical Analysis on your phone or computer to verify that you can connect and collect from the different devices.

@sswartley
So it's possible to connect to all my sensors using USB connection. However, the connection does not work when I use Bluetooth with the temperature sensor and the calcium sensors. I have checked the batteries of the sensors and they are working just fine. Is there any other reason for this inability of my Raspberry Pi to connect to the two sensors? Thank you.

@sswartley
Copy link
Contributor

It should be able to open multiple Go Direct devices. What happens when you just try to open Go Direct Temperature by itself? For example, if you run the "gdx_getting_started_bluetooth.py" example, with just Go Direct Temperature turned on, does it scan and find it? Does it give you the option to open it? When you try and open it, does it open?

@vincentdjojo
Copy link
Author

The following error happens when trying to run the gdx_getting_started_bluetooth.py example:

wait for bluetooth initialization...
number of ble devices found = 1
1: GDX-TMP 0F10A381 BLE -64
Enter device number. To select multiple devices, separate with commas (no spaces): 1
attempting to open 1 device(s)...
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 135, in connect
).asFuture(loop)
txdbus.error.RemoteError: org.bluez.Error.Failed: Software caused connection abort

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "gdx_getting_started_bluetooth.py", line 31, in
gdx.open_ble()
File "/home/pi/Desktop/godirect-examples-master/python/gdx/gdx.py", line 153, in open_ble
open_device_success = gdx.devices[i].open()
File "/home/pi/.local/lib/python3.7/site-packages/godirect/device.py", line 102, in open
if not self._connect():
File "/home/pi/.local/lib/python3.7/site-packages/godirect/device_bleak.py", line 55, in _connect
self._loop.run_until_complete(self._async_connect())
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/pi/.local/lib/python3.7/site-packages/godirect/device_bleak.py", line 42, in _async_connect
await self._device.connect()
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 146, in connect
raise BleakError(str(e))
bleak.exc.BleakError: org.bluez.Error.Failed: Software caused connection abort

Is there a way to fix this issue with bluetooth?
Thanks.

@sswartley This is what happens if I try to connect to the temperature sensor itself using Bluetooth. I was using the example you mentioned "gdx_getting_started_bluetooth.py". It does scan it and find it, but upon selecting it, the above error appears in my initial post.

@sswartley
Copy link
Contributor

The error still makes it look like an error with the bluez and/or bleak library. Bleak is the library that performs the bluetooth communication. You might look at what version of bleak you are running and make sure you are updated to the most current version.

Did you take a look at the bluez discussion here?
hbldh/bleak#94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants