Communicating with multiple BLE devices using WIndows 10 UWMP - c#

I'm running Windows 10 IoT on Raspberry pi 3 and I have like 10 Arduino based BLE devices with which I need to communicate with.
I need my program to iterate through all the 10 BLE devices, send a command and receive a response.
I have done it on Android, but I'm don't know how to do it on Windows 10. Any help would be great.
Thank you

Not fully sure if you are wanting to plug 10 Arduinos into a Raspberry Pi, or if you want to communicate to 10 BLE enabled Arduinos wirelessly. If it's the latter, I can help. I'm assuming you have an understanding BLE fundamentals.
Overview: Basically you'll want to pair the bluetooth Arduinos with Win IoT, connect to each one of them, send and receive data using GATT Characteristics, then disconnect when finished.
Get a HCI BLE dongle form the list of supported BLE dongles for Win IoT.
You must then pair each BLE Arduino to Win IoT. This will allow the Pi to find the devices through your code.
To send data and receive responses form the wireless BLE devices, a connection must first be established.
I assume you'll have already programmed the Arduinos to have a Characteristic (possibly named "command"), in their GATT database with write access and another (possible named "response") with read access and notifications enabled. Characteristics are like sockets. Make sure your Arduinos have something similar to this set up.
In your Win IoT code, you'll have to discover these GATT Characteristics while connected to the Arduino. After discovery, data can be written to the "command" Characteristic.
Arduino can then respond by triggering the notification that data is waiting on the "response" characteristic. After the Pi has received this notification, it should then proceed to read the "response" Characteristic from the Arduino's GATT database.
Finally disconnect when finished and repeat on the next Arduino.

Related

Arduino sending serial data to Hololens 2(Unity) via USB C

im trying to find my Arduino on my hololens with the Windows.Devices.Enumeration.DeviceWatcher.Added event but it doesnt come up, on my pc the uwp console app works and i can read the arduino serial data.
DeviceInformation.FindAllAsync(SerialDevice.GetDeviceSelector()) also does not work as it only returns the hololens itself. Looking specificly for the device using its VID an PID also returns device.Count == 0:
string selector = SerialDevice.GetDeviceSelectorFromUsbVidPid(vid,pid); DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selector, null);
all these methods work and have been tested on pc, Hololens seems to not add the arduino to the DeviceInformation list. the weird thing is when you go to Setting/Devices on the hololens you can see the arduino even with name(Seeeduino nano in my case) but it gets disconnected and reconnected every other second.
also when you put this in the uwp Package.appxmanifest the unity app wont start on the hololens, but this has nothing to do with finding the device in the list only with creating the SerialDevice.
<DeviceCapability Name="serialcommunication"/>
Does anyone know if it is possible to read the serial data from arduino using usb c connected to the hololens?
Currently, it is recommended you try to communicate with Arduino over Network such as Bluetooth or Wi-Fi. Besides, you can provide more information about your request and submit a feature request via feedback hub on new feature request to be considered in future releases of HoloLens OS and devices. If it's a hot impacted feature, it will be possible to be given priority to jump in the development schedule.
For how to post feedback request, you can follow this doc: Send feedback to Microsoft with the Feedback Hub app.

Bluetooth Call Receive with 32feet.net and c#

I need to perform two task in c#
1) with USB cable
2) with Bluetooth
i want to dial and receive calls from smart android mobile. Mobile can be connected with USB cable or Bluetooth. I can dial and receive calls using USB cable by AT commands. Android mobile is connected as USB GSM Modem (Virtual com port). AT+CLIP=1 give a number information along with RING when someone is calling. So i can attend call by viewing a specific number. This part is working Well.
The second part is same thing with Bluetooth. I used 32feet.net for dialing a call. I am able to make a call after going through these forums links
Bluetooth dial with 32feet.net and c#
Bluetooth communication from PC to mobile phone, use laptop speaker and mic during voice call
Get Data from Bluetooth device in C#
now i am not able to get any information when anyone is calling on Bluetooth
i am using hand free profile as using serial port i get an error may be my mobile not support Bluetooth virtual com port.
can anyone point out me how i can get information that which one is calling or invoke some function when anyone call. I need to get a number which one is calling that help me in decision to accepting or rejecting a call.
Bluetooth: use HandsFree Profile. It runs RFCOMM control channel that allows your application to place a call, handle incomming calls, 3-way calling and other things using AT commands (HFP is well documented so you can find all the commands in its specification). However Windows standard Bluetooth driver from Microsoft does not support connection to HFP Audio Fateway. You can do it with BlueSoleil only.
USB: There is no USB HFP profile. Android supports only DUN through USB so it can act as USB GSM Modem only and supports only modem commands. No voice and no other commands.

using arduino input in mobile

I need to know how hard will it be to get input from a heartbeat sensor connected to arduino to a android running a unity made app. Im making for my degree final project a vr system that take a real time heartbeat input to effect the unity game, and i need to decide if i want a simple android vr or oculus (which is less common and more expensive). The plan is to connect the arduino via usb and call the serial port, but i think it may be more complicated then that. Since I have no prior experience in arduino i would love to get your advice in what I will need to do to make it work.
The easiest way is to send the collected data through Bluetooth controller. You can buy an HC-05 Wireless Bluetooth Serial Transceiver Module for 3 US dollars. You can connect the device to Rx and Tx terminals on Arduino. See this link for details on how to use HC-05 with Arduino.
In android device side Install or create an android application which can send data through Bluetooth serial terminal. You can find lot of BT serial port terminal applications in play store. I think some of the applications are open source and you can use their code in your own application.

Continuously sending sensor data to SignalR hub

I'm running Windows IoT on a Raspberry Pi.
After I turn on my Raspberry Pi and Windows IoT starts up, I want to automatically begin reading sensor data from a serial port continuously, and also send the data to a SignalR server/hub continuously. I don't need any UI.
I'm new at UWP apps. Is it best practice to use a headless background task for doing it? But how can I make sure, that the data reading and sending interval is not too long (~1-20ms)? Because I want to use a SignalR client to send the data near real-time.
First you should take care of the size of the package.
Maybe you should also think about using Azure IoT Hub. Azure IoT Hub is build exactly for scenerios like yours, receiving extrem high amount of sensor data in near real time from many devices. And it is highly scalable, and can be used from any client platform.
Here you find documentation, backgrounds and samples: https://azure.microsoft.com/en-us/documentation/services/iot-hub/

UDP broadcasting in windows phone 7

I am working an application in windows phone 7 that must detect the devices connected to particular port no or network. I have desktop application that is implemented in c++ that uses UDP broadcast. I read some articles and know windows phone 7 doesn't support UDP broadcasting. I have tried UDP multicasting in WP7 but due to desktop application have implemented in UDP broadcast, I am not able to do that.
Help me Guys...........
You can use socket.ConnectAsync with e.Buffer containing the message you want to broadcast. In this case, the message will be sent automatically when connection is established. More information about this trick you can read here
You could send a broadcast packet through just SendToAsync method by using limited broadcast IP, not local broadcast IP(such as 255.255.255.255) This means, if your NIC device is in 192.168.0.x IP range, you should shoot a packet to 192.168.0.255. (this IP might be vary on your netmask setting)
However, it works.
Additionally, response back is also allowed but FOR 5 SECONDS ONLY. Your host received a UDP packet from Windows Phone 7.1 device, the host should response back to the port that UDP packet came from, IN 5 SECONDS. Unless, Windows Phone will close the port then, and it has to be gone.
It's very tricky, weird, and ununderstandable(like this word) way.
but it works as far I know.

Categories