Looking for direction: Sending arrays of bytes of data to PC

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dracolytch
 
Posts: 16
Joined: Fri Jan 20, 2012 6:02 pm

Looking for direction: Sending arrays of bytes of data to PC

Post by dracolytch »

Hey folks,

I've been buried deep enough in this, that I don't even know if the solutions I've been tracking down were even headed in the right direction. So, I'm backing up, asking for help with what I'm trying to do, in the hopes that folks can point me to the right keywords and references so I can find out how to do it.

I have: Adafruit ItsyBitsy nRF52840 Express - Bluetooth LE (https://www.adafruit.com/product/4481)
It is a great/fun board. I can have it be a keyboard, reacting to buttons or a touch (verified works via serial in Mu)

Over USB on Windows I can get my ItsyBitsy to act like a keyboard, or communicate over a COM port to transmit arrays of bytes
Over Bluetooth on Windows, I can get keyboard input from my board
Over Bluetooth on Android, I can use the BlueFruit Connect app to confirm the UART interface is working, and can transmit arrays of bytes from my Itsy to my phone (Hooray, the CircuitPy code is good!)

So, how the heck does one transmit arrays of bytes from their nRF52840 to a Windows computer over Bluetooth? Should I be looking at different services? Different tools/packages? What are some keywords or tutorials I should be looking up?

Ideally I'd like to get to C# to integrate it with other tools, but to start with, I'd be thrilled with anything that works.

Your help is greatly appreciated!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Looking for direction: Sending arrays of bytes of data t

Post by mikeysklar »

You can install Adafruit Blinka on your PC and use the Adafruit_CircuitPython_BLE library to transmit directly from BLE controller <--> PC.

https://learn.adafruit.com/circuitpytho ... -3075415-2

https://github.com/adafruit/Adafruit_Ci ... ho_test.py

https://github.com/adafruit/Adafruit_Ci ... _client.py

User avatar
alunj
 
Posts: 10
Joined: Wed Jun 14, 2017 8:15 pm

Re: Looking for direction: Sending arrays of bytes of data t

Post by alunj »

You're looking to build a Windows app that will receive BLE traffic, as I understand it - is this correct?
Let's assume for right now that you know how to build a Windows app, since you're already specifying you're comfortable with C#.
Next is to find the Bluetooth libraries for your platform. For instance, if you're writing a UWP app, start here: https://docs.microsoft.com/en-us/window ... /bluetooth
As you can see, there's a lot of information here on what Bluetooth is, how to connect to it, etc, but the basics are pretty simple, assuming you're looking to do the same as the Android app does:
1. Scan for advertising devices to connect to
2. Pick one, or allow the user to pick one
3. Connect to it
4. Negotiate higher MTU if you want to be sending / receiving more than 20 bytes per packet
5. Send by Writing to the TX characteristic of the UART interface
6. Receive by signing up for notifications from the UART RX characteristic

Essentially, it's all described here: https://docs.microsoft.com/en-us/window ... att-client

The big obvious piece that's missing is - of the enumerated characteristics, which one is the UART RX/TX?
This is given in the documentation for the board as:
Service ID - "6e400001-b5a3-f393-e0a9-e50e24dcca9e" (i.e. "does this board even DO the UART over BLE")
TX characteristic ID - "6e400002-b5a3-f393-e0a9-e50e24dcca9e" (send this board data)
RX characteristic ID - "6e400003-b5a3-f393-e0a9-e50e24dcca9e" (sign up for notifications to read data from this board)

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”