Hello,
I recently purchased a CPB. I am looking for some direction on how to capture and use the data from the device. So far, I understand how to send values over serial and I 'understand' about the UART to see data in the Adafruit Connect app. What I am not understanding - what type of program do I run so that I could capture values, for example the acceleration values, in a program and use those values to manipulate something else? How do I send data via bluetooth out?
For more context - I am using the Arduino library. There is an example provided by adafruit (https://learn.adafruit.com/adafruit-cir ... controller) that allows me to connect to the device and send data from the device over Serial to my computer. What if I do not want to be connected to a computer? How can I send data to another device? I have spent some time in the examples to no avail. Any suggestion or guidance would be appreciated.
Adafruit CPB Data Capture Options Help
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 13946
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Adafruit CPB Data Capture Options Help
The CPB is based on the nRF52840 chip. You can use the Central BLEUART example code to talk to other nRF52 BLE devices along with phones, computers or raspberry Pi's.
https://learn.adafruit.com/introducing- ... al-bleuart
The accelerometer is an i2c connected LIS3DH so you can use the Arduino library.
https://learn.adafruit.com/adafruit-lis ... ry-1729233
https://learn.adafruit.com/introducing- ... al-bleuart
The accelerometer is an i2c connected LIS3DH so you can use the Arduino library.
https://learn.adafruit.com/adafruit-lis ... ry-1729233
- jacoblhughes
- Posts: 5
- Joined: Tue Mar 15, 2022 10:56 pm
Re: Adafruit CPB Data Capture Options Help
Hello and thank you. This example is very helpful. I need to spend some more time tomorrow to understand better.
Am I understanding correctly that if I am connected the right way, I will be able to send info via BT from the device to my computer, via a wireless serial port?
Am I understanding correctly that if I am connected the right way, I will be able to send info via BT from the device to my computer, via a wireless serial port?
- mikeysklar
- Posts: 13946
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Adafruit CPB Data Capture Options Help
Yes, you can send data from the CircuitPlayground Bluefruit to your computer.
There is a guide for specifically doing this with CircuitPython:
https://learn.adafruit.com/circuitpytho ... rt-example
Since you want to use Arduino focus on this example BLEUart.
https://learn.adafruit.com/circuitpytho ... rt-example
There is a guide for specifically doing this with CircuitPython:
https://learn.adafruit.com/circuitpytho ... rt-example
Since you want to use Arduino focus on this example BLEUart.
https://learn.adafruit.com/circuitpytho ... rt-example
- jacoblhughes
- Posts: 5
- Joined: Tue Mar 15, 2022 10:56 pm
Re: Adafruit CPB Data Capture Options Help
Out of curiosity, are you able to run this 'ble_eval_client' script in python? I am receiving errors.
- mikeysklar
- Posts: 13946
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Adafruit CPB Data Capture Options Help
You should be able to run the ble_eval_client script from Python. As long as you are using python3 and installed blinka and circuitpython-ble libraries.
https://learn.adafruit.com/circuitpytho ... -libraries
If you have already done the above please post the errors you are seeing.
Code: Select all
pip3 install --upgrade adafruit-blinka-bleio adafruit-circuitpython-ble
If you have already done the above please post the errors you are seeing.
- jacoblhughes
- Posts: 5
- Joined: Tue Mar 15, 2022 10:56 pm
Re: Adafruit CPB Data Capture Options Help
I think it is an issue with Windows 11:
The error happens at for adv in ble.start_scan(ProvideServicesAdvertisement):
Unhandled Exception: System.NotSupportedException: Cannot create uninitialized instances of types requiring managed activation.
at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)
at Python.Runtime.ClassObject.tp_new_impl(BorrowedReference tp, BorrowedReference args, BorrowedReference kw)
at Python.Runtime.NativeCall.Call_3(IntPtr fp, BorrowedReference a1, BorrowedReference a2, BorrowedReference a3)
at Python.Runtime.MetaType.tp_call(BorrowedReference tp, BorrowedReference args, BorrowedReference kw)
The error happens at for adv in ble.start_scan(ProvideServicesAdvertisement):
Unhandled Exception: System.NotSupportedException: Cannot create uninitialized instances of types requiring managed activation.
at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)
at Python.Runtime.ClassObject.tp_new_impl(BorrowedReference tp, BorrowedReference args, BorrowedReference kw)
at Python.Runtime.NativeCall.Call_3(IntPtr fp, BorrowedReference a1, BorrowedReference a2, BorrowedReference a3)
at Python.Runtime.MetaType.tp_call(BorrowedReference tp, BorrowedReference args, BorrowedReference kw)
- mikeysklar
- Posts: 13946
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Adafruit CPB Data Capture Options Help
That probably is a Windows 11 issue. There is a not about Windows 10 compatibility here.
https://learn.adafruit.com/circuitpytho ... ws-3075437
https://learn.adafruit.com/circuitpytho ... ws-3075437
What version of python did you end up installing? Did you follow the instructions for versions of python to download?As of this writing (October 2020), the latest Python available on Windows is Python 3.9. But the third-party libraries we are using for BLE on Windows are not yet compatible with Python 3.9. So choose Python 3.8, not 3.9, to install.
- jacoblhughes
- Posts: 5
- Joined: Tue Mar 15, 2022 10:56 pm
Re: Adafruit CPB Data Capture Options Help
Yes, I reverted back to a compatible version of Python. 3.8.13.
Please be positive and constructive with your questions and comments.